diff options
author | unknown <vtkachenko@intelp4d.mysql.com> | 2004-12-24 12:13:32 +0100 |
---|---|---|
committer | unknown <vtkachenko@intelp4d.mysql.com> | 2004-12-24 12:13:32 +0100 |
commit | 40d7e74efd94a62ca9d71a24f348e8ea5c3e4790 (patch) | |
tree | c26b31d028fae331ef7cf148ca410771f43ef0ef /innobase/include | |
parent | 1fabc5de0adaf326e86f01fb93e0e895b12bebe8 (diff) | |
download | mariadb-git-40d7e74efd94a62ca9d71a24f348e8ea5c3e4790.tar.gz |
logging_ok:
Logging to logging@openlogging.org accepted
sql_yacc.yy, sql_parse.cc, sql_lex.h, lex.h:
Implements the SHOW MUTEX STATUS command
set_var.cc, mysqld.cc, mysql_priv.h:
Added new GLOBAL variable timed_mutexes
ha_innodb.h:
New function innodb_mutex_show_status
ha_innodb.cc:
Added new innodb variables in SHOW STATUS
Implements the SHOW MUTEX STATUS command
innodb.test, innodb.result:
Added new row_lock_waits status variables tests.
variables.test, variables.result:
test new variable timed_mutexes
ut0ut.c:
New function ut_usectime.
sync0sync.c:
Mutex counting.
sync0rw.c:
New mutex parameters initialization.
srv0srv.c:
Counting row lock waits
row0sel.c, row0mysql.c:
Setting row_lock or table_lock state to thd.
que0que.c:
Added default no_lock_state to thd.
univ.i:
Added UNIV_SRV_PRINT_LATCH_WAITS debug define
sync0sync.ic:
Count mutex using.
sync0sync.h:
Added new parameters to mutex structure for counting.
sync0rw.h:
Added new parameters to rw_create_func.
srv0srv.h:
Added new innodb varuables to SHOW STATUS.
que0que.h:
Added thread lock states.
innobase/include/que0que.h:
Added thread lock states.
innobase/include/srv0srv.h:
Added new innodb varuables to SHOW STATUS.
innobase/include/sync0rw.h:
Added new parameters to rw_create_func.
innobase/include/sync0sync.h:
Added new parameters to mutex structure for counting.
innobase/include/sync0sync.ic:
Count mutex using.
innobase/include/univ.i:
Added UNIV_SRV_PRINT_LATCH_WAITS debug define
innobase/que/que0que.c:
Added default no_lock_state to thd.
innobase/row/row0mysql.c:
Setting row_lock or table_lock state to thd.
innobase/row/row0sel.c:
Setting row_lock or table_lock state to thd.
innobase/srv/srv0srv.c:
Counting row lock waits
innobase/sync/sync0rw.c:
New mutex parameters initialization.
innobase/sync/sync0sync.c:
Mutex counting.
innobase/ut/ut0ut.c:
New function ut_usectime.
mysql-test/r/variables.result:
test new variable timed_mutexes
mysql-test/r/innodb.result:
Added new row_lock_waits status variables tests.
mysql-test/t/variables.test:
test new variable timed_mutexes
mysql-test/t/innodb.test:
Added new row_lock_waits status variables tests.
sql/ha_innodb.cc:
Added new innodb variables in SHOW STATUS
Implements the SHOW MUTEX STATUS command
sql/ha_innodb.h:
New function innodb_mutex_show_status
sql/lex.h:
Implements the SHOW MUTEX STATUS command
sql/mysql_priv.h:
Added new GLOBAL variable timed_mutexes
sql/mysqld.cc:
Added new GLOBAL variable timed_mutexes
sql/set_var.cc:
Added new GLOBAL variable timed_mutexes
sql/sql_lex.h:
Implements the SHOW MUTEX STATUS command
sql/sql_parse.cc:
Implements the SHOW MUTEX STATUS command
sql/sql_yacc.yy:
Implements the SHOW MUTEX STATUS command
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
Diffstat (limited to 'innobase/include')
-rw-r--r-- | innobase/include/que0que.h | 6 | ||||
-rw-r--r-- | innobase/include/srv0srv.h | 5 | ||||
-rw-r--r-- | innobase/include/sync0rw.h | 8 | ||||
-rw-r--r-- | innobase/include/sync0sync.h | 24 | ||||
-rw-r--r-- | innobase/include/sync0sync.ic | 6 | ||||
-rw-r--r-- | innobase/include/univ.i | 1 |
6 files changed, 43 insertions, 7 deletions
diff --git a/innobase/include/que0que.h b/innobase/include/que0que.h index e1874edcaf2..d45ae032ddb 100644 --- a/innobase/include/que0que.h +++ b/innobase/include/que0que.h @@ -359,6 +359,7 @@ struct que_thr_struct{ the control came */ ulint resource; /* resource usage of the query thread thus far */ + ulint lock_state; /* lock state of thread (table or row) */ }; #define QUE_THR_MAGIC_N 8476583 @@ -482,6 +483,11 @@ struct que_fork_struct{ #define QUE_THR_SUSPENDED 7 #define QUE_THR_ERROR 8 +/* Query thread lock states */ +#define QUE_THR_LOCK_NOLOCK 0 +#define QUE_THR_LOCK_ROW 1 +#define QUE_THR_LOCK_TABLE 2 + /* From where the cursor position is counted */ #define QUE_CUR_NOT_DEFINED 1 #define QUE_CUR_START 2 diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h index 84b7d14ca00..5f752717fcc 100644 --- a/innobase/include/srv0srv.h +++ b/innobase/include/srv0srv.h @@ -525,6 +525,11 @@ struct export_var_struct{ ulint innodb_pages_created; ulint innodb_pages_read; ulint innodb_pages_written; + ulint innodb_row_lock_waits; + ulint innodb_row_lock_current_waits; + ib_longlong innodb_row_lock_time; + ulint innodb_row_lock_time_avg; + ulint innodb_row_lock_time_max; ulint innodb_rows_read; ulint innodb_rows_inserted; ulint innodb_rows_updated; diff --git a/innobase/include/sync0rw.h b/innobase/include/sync0rw.h index 9a988a03e92..6e3a4cf4dc7 100644 --- a/innobase/include/sync0rw.h +++ b/innobase/include/sync0rw.h @@ -61,8 +61,9 @@ Creates, or rather, initializes an rw-lock object in a specified memory location (which must be appropriately aligned). The rw-lock is initialized to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free is necessary only if the memory block containing it is freed. */ - -#define rw_lock_create(L) rw_lock_create_func((L), __FILE__, __LINE__) +#define rw_lock_create(L) rw_lock_create_func(\ + (L), __FILE__, __LINE__, __STRING(L)) + /*=====================*/ /********************************************************************** Creates, or rather, initializes an rw-lock object in a specified memory @@ -75,7 +76,8 @@ rw_lock_create_func( /*================*/ rw_lock_t* lock, /* in: pointer to memory */ const char* cfile_name, /* in: file name where created */ - ulint cline); /* in: file line where created */ + ulint cline, /* in: file line where created */ + const char* cmutex_name); /* in: mutex name */ /********************************************************************** Calling this function is obligatory only if the memory buffer containing the rw-lock is freed. Removes an rw-lock object from the global list. The diff --git a/innobase/include/sync0sync.h b/innobase/include/sync0sync.h index 8e0ec715b12..98d61c129b1 100644 --- a/innobase/include/sync0sync.h +++ b/innobase/include/sync0sync.h @@ -17,6 +17,8 @@ Created 9/5/1995 Heikki Tuuri #include "os0sync.h" #include "sync0arr.h" +extern my_bool timed_mutexes; + /********************************************************************** Initializes the synchronization data structures. */ @@ -35,8 +37,7 @@ location (which must be appropriately aligned). The mutex is initialized in the reset state. Explicit freeing of the mutex with mutex_free is necessary only if the memory block containing it is freed. */ - -#define mutex_create(M) mutex_create_func((M), __FILE__, __LINE__) +#define mutex_create(M) mutex_create_func((M), __FILE__, __LINE__, __STRING(M)) /*===================*/ /********************************************************************** Creates, or rather, initializes a mutex object in a specified memory @@ -49,7 +50,8 @@ mutex_create_func( /*==============*/ mutex_t* mutex, /* in: pointer to memory */ const char* cfile_name, /* in: file name where created */ - ulint cline); /* in: file line where created */ + ulint cline, /* in: file line where created */ + const char* cmutex_name); /* in: mutex name */ /********************************************************************** Calling this function is obligatory only if the memory buffer containing the mutex is freed. Removes a mutex object from the mutex list. The mutex @@ -471,6 +473,15 @@ struct mutex_struct { const char* cfile_name;/* File name where mutex created */ ulint cline; /* Line where created */ ulint magic_n; + ulong count_using; /* count of times mutex used */ + ulong count_spin_loop; /* count of spin loops */ + ulong count_spin_rounds; /* count of spin rounds */ + ulong count_os_wait; /* count of os_wait */ + ulong count_os_yield; /* count of os_wait */ + ulonglong lspent_time; /* mutex os_wait timer msec */ + ulonglong lmax_spent_time; /* mutex os_wait timer msec */ + const char* cmutex_name;/* mutex name */ + ulint mutex_type;/* 0 - usual mutex 1 - rw_lock mutex */ }; #define MUTEX_MAGIC_N (ulint)979585 @@ -504,6 +515,13 @@ extern ibool sync_order_checks_on; /* This variable is set to TRUE when sync_init is called */ extern ibool sync_initialized; +/* Global list of database mutexes (not OS mutexes) created. */ +UT_LIST_BASE_NODE_T(mutex_t) mutex_list; + +/* Mutex protecting the mutex_list variable */ +mutex_t mutex_list_mutex; + + #ifndef UNIV_NONINL #include "sync0sync.ic" #endif diff --git a/innobase/include/sync0sync.ic b/innobase/include/sync0sync.ic index aaf5e1fd9e9..1731b47db58 100644 --- a/innobase/include/sync0sync.ic +++ b/innobase/include/sync0sync.ic @@ -249,8 +249,11 @@ mutex_enter_func( /* Note that we do not peek at the value of lock_word before trying the atomic test_and_set; we could peek, and possibly save time. */ + + mutex->count_using++; - if (!mutex_test_and_set(mutex)) { + if (!mutex_test_and_set(mutex)) + { #ifdef UNIV_SYNC_DEBUG mutex_set_debug_info(mutex, file_name, line); #endif @@ -258,4 +261,5 @@ mutex_enter_func( } mutex_spin_wait(mutex, file_name, line); + } diff --git a/innobase/include/univ.i b/innobase/include/univ.i index be71d4211b3..80024f71992 100644 --- a/innobase/include/univ.i +++ b/innobase/include/univ.i @@ -88,6 +88,7 @@ memory is read outside the allocated blocks. */ #define UNIV_SEARCH_DEBUG #define UNIV_SYNC_PERF_STAT #define UNIV_SEARCH_PERF_STAT +#define UNIV_SRV_PRINT_LATCH_WAITS; */ #define UNIV_LIGHT_MEM_DEBUG |