summaryrefslogtreecommitdiff
path: root/storage/xtradb/include/sync0sync.ic
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/xtradb/include/sync0sync.ic
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/xtradb/include/sync0sync.ic')
-rw-r--r--storage/xtradb/include/sync0sync.ic26
1 files changed, 18 insertions, 8 deletions
diff --git a/storage/xtradb/include/sync0sync.ic b/storage/xtradb/include/sync0sync.ic
index 8176ae55fd8..90789339249 100644
--- a/storage/xtradb/include/sync0sync.ic
+++ b/storage/xtradb/include/sync0sync.ic
@@ -165,7 +165,7 @@ mutex_exit_func(
{
ut_ad(mutex_own(mutex));
- ut_d(mutex->thread_id = (os_thread_id_t) ULINT_UNDEFINED);
+ mutex->thread_id = (os_thread_id_t) ULINT_UNDEFINED;
#ifdef UNIV_SYNC_DEBUG
sync_thread_reset_level(mutex);
@@ -205,7 +205,7 @@ mutex_exit_func(
{
ut_ad(mutex_own(mutex));
- ut_d(mutex->base_mutex.thread_id = (os_thread_id_t) ULINT_UNDEFINED);
+ mutex->base_mutex.thread_id = (os_thread_id_t) ULINT_UNDEFINED;
#ifdef UNIV_SYNC_DEBUG
sync_thread_reset_level(&mutex->base_mutex);
@@ -264,10 +264,15 @@ mutex_enter_func(
the atomic test_and_set; we could peek, and possibly save time. */
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);
#endif
+ if (srv_instrument_semaphores) {
+ mutex->file_name = file_name;
+ mutex->line = line;
+ }
+
return; /* Succeeded! */
}
@@ -304,10 +309,15 @@ mutex_enter_func(
the atomic test_and_set; we could peek, and possibly save time. */
if (!ib_mutex_test_and_set(&mutex->base_mutex)) {
- ut_d(mutex->base_mutex.thread_id = os_thread_get_curr_id());
+ mutex->base_mutex.thread_id = os_thread_get_curr_id();
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(&mutex->base_mutex, file_name, line);
#endif
+ if(srv_instrument_semaphores) {
+ mutex->base_mutex.file_name = file_name;
+ mutex->base_mutex.line = line;
+ }
+
return; /* Succeeded! */
}
@@ -515,9 +525,9 @@ pfs_mutex_create_func(
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
+# endif /* UNIV_DEBUG */
const char* cfile_name, /*!< in: file name where created */
ulint cline, /*!< in: file line where created */
-# endif /* UNIV_DEBUG */
const char* cmutex_name) /*!< in: mutex name */
{
mutex->pfs_psi = PSI_MUTEX_CALL(init_mutex)(key, mutex);
@@ -527,9 +537,9 @@ pfs_mutex_create_func(
# ifdef UNIV_SYNC_DEBUG
level,
# endif /* UNIV_SYNC_DEBUG */
+# endif /* UNIV_DEBUG */
cfile_name,
cline,
-# endif /* UNIV_DEBUG */
cmutex_name);
}
@@ -550,11 +560,11 @@ pfs_mutex_create_func(
# ifdef UNIV_SYNC_DEBUG
ulint level, /*!< in: level */
# endif /* UNIV_SYNC_DEBUG */
+# endif /* UNIV_DEBUG */
const char* cfile_name, /*!< in: file name where
created */
ulint cline, /*!< in: file line where
created */
-# endif /* UNIV_DEBUG */
const char* cmutex_name)
{
mutex->base_mutex.pfs_psi = PSI_MUTEX_CALL(init_mutex)(key, mutex);
@@ -564,9 +574,9 @@ pfs_mutex_create_func(
# ifdef UNIV_SYNC_DEBUG
level,
# endif /* UNIV_SYNC_DEBUG */
+# endif /* UNIV_DEBUG */
cfile_name,
cline,
-# endif /* UNIV_DEBUG */
cmutex_name);
}