summaryrefslogtreecommitdiff
path: root/storage/innobase/sync/sync0sync.cc
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@skysql.com>2015-02-21 21:45:16 +0200
committerJan Lindström <jan.lindstrom@skysql.com>2015-02-21 21:45:16 +0200
commit1cc7befc14cd2ad637ffb6fc29fae0f978735acf (patch)
tree8221773550b173d5b1d41243605b1f5ad72fe7f3 /storage/innobase/sync/sync0sync.cc
parent9152b83973419ea034bb6040703c18b3ee87e084 (diff)
downloadmariadb-git-1cc7befc14cd2ad637ffb6fc29fae0f978735acf.tar.gz
MDEV-7109: Add support for INFORMATION_SCHEMA.INNODB_SEMAPHORE_WAITS
MDEV-7399: Add support for INFORMATION_SCHEMA.INNODB_MUTEXES MDEV-7618: Improve semaphore instrumentation Introduced two new information schema tables to monitor mutex waits and semaphore waits. Added a new configuration variable innodb_intrument_semaphores to add thread_id, file name and line of current holder of mutex/rw_lock.
Diffstat (limited to 'storage/innobase/sync/sync0sync.cc')
-rw-r--r--storage/innobase/sync/sync0sync.cc26
1 files changed, 20 insertions, 6 deletions
diff --git a/storage/innobase/sync/sync0sync.cc b/storage/innobase/sync/sync0sync.cc
index aa2b5fa29db..5f5c6d2a5f2 100644
--- a/storage/innobase/sync/sync0sync.cc
+++ b/storage/innobase/sync/sync0sync.cc
@@ -265,8 +265,8 @@ void
mutex_create_func(
/*==============*/
ib_mutex_t* mutex, /*!< in: pointer to memory */
-#ifdef UNIV_DEBUG
const char* cmutex_name, /*!< in: mutex name */
+#ifdef UNIV_DEBUG
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
@@ -285,9 +285,10 @@ mutex_create_func(
#ifdef UNIV_DEBUG
mutex->magic_n = MUTEX_MAGIC_N;
#endif /* UNIV_DEBUG */
-#ifdef UNIV_SYNC_DEBUG
+
mutex->line = 0;
mutex->file_name = "not yet reserved";
+#ifdef UNIV_SYNC_DEBUG
mutex->level = level;
#endif /* UNIV_SYNC_DEBUG */
mutex->cfile_name = cfile_name;
@@ -398,11 +399,15 @@ mutex_enter_nowait_func(
if (!ib_mutex_test_and_set(mutex)) {
- ut_d(mutex->thread_id = os_thread_get_curr_id());
+ mutex->thread_id = os_thread_get_curr_id();
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
+#else
+ if (srv_instrument_semaphores) {
+ mutex->file_name = file_name;
+ mutex->line = line;
+ }
#endif
-
return(0); /* Succeeded! */
}
@@ -520,10 +525,15 @@ spin_loop:
if (ib_mutex_test_and_set(mutex) == 0) {
/* Succeeded! */
- ut_d(mutex->thread_id = os_thread_get_curr_id());
+ mutex->thread_id = os_thread_get_curr_id();
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif
+ if (srv_instrument_semaphores) {
+ mutex->file_name = file_name;
+ mutex->line = line;
+ }
+
return;
}
@@ -563,10 +573,14 @@ spin_loop:
sync_array_free_cell(sync_arr, index);
- ut_d(mutex->thread_id = os_thread_get_curr_id());
+ mutex->thread_id = os_thread_get_curr_id();
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif
+ if (srv_instrument_semaphores) {
+ mutex->file_name = file_name;
+ mutex->line = line;
+ }
return;