summaryrefslogtreecommitdiff
path: root/innobase/srv/srv0srv.c
diff options
context:
space:
mode:
authorunknown <petr@mysql.com>2004-11-18 13:00:42 +0300
committerunknown <petr@mysql.com>2004-11-18 13:00:42 +0300
commit4dac69eb11839d9c996669f88aba0230916efcbc (patch)
treec0b7e411284eca2bfbf5ae94888013bb48010c75 /innobase/srv/srv0srv.c
parent163d8b27aaf0a18df6583cac58930a84eb70ebbc (diff)
downloadmariadb-git-4dac69eb11839d9c996669f88aba0230916efcbc.tar.gz
WL 2059 Engine-specific status variables framework and WL 1922
InnoDB status variables innobase/buf/buf0buf.c: Added function to get the number of latched pages innobase/buf/buf0flu.c: Added support for dblwr_pages_written, dblwr_writes and buffer_pool_pages_flushed status variables innobase/buf/buf0lru.c: Added support for _buffer_pool_wait_free status variable innobase/buf/buf0rea.c: Added support for buffer_pool_read_ahead_rnd, buffer_pool_read_ahead_seq and srv_buf_pool_reads status variables innobase/fil/fil0fil.c: Added support for os_log_fsyncs, data_read, and data_written innobase/include/buf0buf.h: Functions and variables needed for new status variables declared innobase/include/buf0flu.ic: Added support for buffer_pool_write_requests status variable innobase/include/fil0fil.h: Variable declared innobase/include/os0file.h: Declared several variabled innobase/include/srv0srv.h: Declared all new variables needed for InnoDB status variables innobase/log/log0log.c: Added support for various log-related status variables innobase/os/os0file.c: Added support for pending_writes, pending_reads status variables innobase/srv/srv0srv.c: Added internal counters and function to accumulate information for InnoDB status variables mysql-test/r/innodb.result: result fot the test mysql-test/t/innodb.test: We have tests only for few variables, as we cannot predict value for most of the added variables. It depends on the system load, OS, HDD e.t.c Thus, we cannot test them with mysql-test. sql/ha_innodb.cc: Added an array for InnoDB status variables. This is part of the WL2059 Engine-specific status variables framework sql/ha_innodb.h: Declared status variables array and the function to refresh statistics sql/handler.cc: Added function to get statistics sql/handler.h: Declared function to update handlers statistics sql/mysql_priv.h: declared opt_innodb to see it from handlers sql/mysqld.cc: Don't include Innodb_* status variables into "show status" if we are compiling without InnoDB sql/sql_show.cc: mysqld_show modified and split into two parts to support enclosed arrays in the show_var_st structure. This is a part of WL2059 Engine-specific status variables framework. sql/structs.h: Added new value to mark enclosed array in the status variables array
Diffstat (limited to 'innobase/srv/srv0srv.c')
-rw-r--r--innobase/srv/srv0srv.c106
1 files changed, 106 insertions, 0 deletions
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index b8d03cfab5f..80aea50be2e 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -186,6 +186,61 @@ that during a time of heavy update/insert activity. */
ulint srv_max_buf_pool_modified_pct = 90;
+/* variable counts amount of data read in total (in bytes) */
+ulint srv_data_read = 0;
+
+/* here we count the amount of data written in total (in bytes) */
+ulint srv_data_written = 0;
+
+/* the number of the log write requests done */
+ulint srv_log_write_requests = 0;
+
+/* the number of physical writes to the log performed */
+ulint srv_log_writes = 0;
+
+/* amount of data written to the log files in bytes */
+ulint srv_os_log_written = 0;
+
+/* amount of writes being done to the log files */
+ulint srv_os_log_pending_writes = 0;
+
+/* we increase this counter, when there we don't have enough space in the
+log buffer and have to flush it */
+ulint srv_log_waits = 0;
+
+/* this variable counts the amount of times, when the doublewrite buffer
+was flushed */
+ulint srv_dblwr_writes = 0;
+
+/* here we store the number of pages that have been flushed to the
+doublewrite buffer */
+ulint srv_dblwr_pages_written = 0;
+
+/* in this variable we store the number of write requests issued */
+ulint srv_buf_pool_write_requests = 0;
+
+/* here we store the number of times when we had to wait for a free page
+in the buffer pool. It happens when the buffer pool is full and we need
+to make a flush, in order to be able to read or create a page. */
+ulint srv_buf_pool_wait_free = 0;
+
+/* variable to count the number of pages that were written from buffer
+pool to the disk */
+ulint srv_buf_pool_flushed = 0;
+
+/* variable to count the number of buffer pool reads that led to the
+reading of a disk page */
+ulint srv_buf_pool_reads = 0;
+
+/* variable to count the number of sequential read-aheads */
+ulint srv_read_ahead_seq = 0;
+
+/* variable to count the number of random read-aheads */
+ulint srv_read_ahead_rnd = 0;
+
+/* structure to pass status variables to MySQL */
+export_struc export_vars;
+
/* If the following is != 0 we do not allow inserts etc. This protects
the user from forgetting the innodb_force_recovery keyword to my.cnf */
@@ -1619,6 +1674,57 @@ srv_printf_innodb_monitor(
fflush(file);
}
+/**********************************************************************
+Function to pass InnoDB status variables to MySQL */
+
+void
+srv_export_innodb_status(void)
+{
+
+ mutex_enter(&srv_innodb_monitor_mutex);
+ export_vars.innodb_data_pending_reads= os_n_pending_reads;
+ export_vars.innodb_data_pending_writes= os_n_pending_writes;
+ export_vars.innodb_data_pending_fsyncs=
+ fil_n_pending_log_flushes + fil_n_pending_tablespace_flushes;
+ export_vars.innodb_data_fsyncs= os_n_fsyncs;
+ export_vars.innodb_data_read= srv_data_read;
+ export_vars.innodb_data_reads= os_n_file_reads;
+ export_vars.innodb_data_writes= os_n_file_writes;
+ export_vars.innodb_data_written= srv_data_written;
+ export_vars.innodb_buffer_pool_read_requests= buf_pool->n_page_gets;
+ export_vars.innodb_buffer_pool_write_requests= srv_buf_pool_write_requests;
+ export_vars.innodb_buffer_pool_wait_free= srv_buf_pool_wait_free;
+ export_vars.innodb_buffer_pool_pages_flushed= srv_buf_pool_flushed;
+ export_vars.innodb_buffer_pool_reads= srv_buf_pool_reads;
+ export_vars.innodb_buffer_pool_read_ahead_rnd= srv_read_ahead_rnd;
+ export_vars.innodb_buffer_pool_read_ahead_seq= srv_read_ahead_seq;
+ export_vars.innodb_buffer_pool_pages_data= UT_LIST_GET_LEN(buf_pool->LRU);
+ export_vars.innodb_buffer_pool_pages_dirty= UT_LIST_GET_LEN(buf_pool->flush_list);
+ export_vars.innodb_buffer_pool_pages_free= UT_LIST_GET_LEN(buf_pool->free);
+ export_vars.innodb_buffer_pool_pages_latched= buf_get_latched_pages_number();
+ export_vars.innodb_buffer_pool_pages_total= buf_pool->curr_size;
+ export_vars.innodb_buffer_pool_pages_misc= buf_pool->max_size -
+ UT_LIST_GET_LEN(buf_pool->LRU) - UT_LIST_GET_LEN(buf_pool->free);
+ export_vars.innodb_page_size= UNIV_PAGE_SIZE;
+ export_vars.innodb_log_waits= srv_log_waits;
+ export_vars.innodb_os_log_written= srv_os_log_written;
+ export_vars.innodb_os_log_fsyncs= fil_n_log_flushes;
+ export_vars.innodb_os_log_pending_fsyncs= fil_n_pending_log_flushes;
+ export_vars.innodb_os_log_pending_writes= srv_os_log_pending_writes;
+ export_vars.innodb_log_write_requests= srv_log_write_requests;
+ export_vars.innodb_log_writes= srv_log_writes;
+ export_vars.innodb_dblwr_pages_written= srv_dblwr_pages_written;
+ export_vars.innodb_dblwr_writes= srv_dblwr_writes;
+ export_vars.innodb_pages_created= buf_pool->n_pages_created;
+ export_vars.innodb_pages_read= buf_pool->n_pages_read;
+ export_vars.innodb_pages_written= buf_pool->n_pages_written;
+ export_vars.innodb_rows_read= srv_n_rows_read;
+ export_vars.innodb_rows_inserted= srv_n_rows_inserted;
+ export_vars.innodb_rows_updated= srv_n_rows_updated;
+ export_vars.innodb_rows_deleted= srv_n_rows_deleted;
+ mutex_exit(&srv_innodb_monitor_mutex);
+}
+
/*************************************************************************
A thread which wakes up threads whose lock wait may have lasted too long.
This also prints the info output by various InnoDB monitors. */