Commit e391bf38 authored by marko's avatar marko

branches/zip: Make SHOW ENGINE INNODB MUTEX display SUM(os_waits)

for block mutexes and blocks.

Designed by Michael and Marko. rb://188, Issue #358
parent 369570f6
2010-03-09 The InnoDB Team
* handler/ha_innodb.cc:
Make SHOW ENGINE INNODB MUTEX STATUS display SUM(os_waits)
for the buffer pool block mutexes and locks.
2010-03-08 The InnoDB Team 2010-03-08 The InnoDB Team
* fil/fil0fil.c: * fil/fil0fil.c:
......
...@@ -8659,7 +8659,8 @@ innodb_show_status( ...@@ -8659,7 +8659,8 @@ innodb_show_status(
} }
/************************************************************************//** /************************************************************************//**
Implements the SHOW MUTEX STATUS command. . */ Implements the SHOW MUTEX STATUS command.
@return TRUE on failure, FALSE on success. */
static static
bool bool
innodb_mutex_show_status( innodb_mutex_show_status(
...@@ -8667,11 +8668,16 @@ innodb_mutex_show_status( ...@@ -8667,11 +8668,16 @@ innodb_mutex_show_status(
handlerton* hton, /*!< in: the innodb handlerton */ handlerton* hton, /*!< in: the innodb handlerton */
THD* thd, /*!< in: the MySQL query thread of the THD* thd, /*!< in: the MySQL query thread of the
caller */ caller */
stat_print_fn* stat_print) stat_print_fn* stat_print) /*!< in: function for printing
statistics */
{ {
char buf1[IO_SIZE], buf2[IO_SIZE]; char buf1[IO_SIZE], buf2[IO_SIZE];
mutex_t* mutex; mutex_t* mutex;
rw_lock_t* lock; rw_lock_t* lock;
ulint block_mutex_oswait_count = 0;
ulint block_lock_oswait_count = 0;
mutex_t* block_mutex = NULL;
rw_lock_t* block_lock = NULL;
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
ulint rw_lock_count= 0; ulint rw_lock_count= 0;
ulint rw_lock_count_spin_loop= 0; ulint rw_lock_count_spin_loop= 0;
...@@ -8686,12 +8692,16 @@ innodb_mutex_show_status( ...@@ -8686,12 +8692,16 @@ innodb_mutex_show_status(
mutex_enter(&mutex_list_mutex); mutex_enter(&mutex_list_mutex);
mutex = UT_LIST_GET_FIRST(mutex_list); for (mutex = UT_LIST_GET_FIRST(mutex_list); mutex != NULL;
mutex = UT_LIST_GET_NEXT(list, mutex)) {
if (mutex->count_os_wait == 0) {
continue;
}
while (mutex != NULL) { if (buf_pool_is_block_mutex(mutex)) {
if (mutex->count_os_wait == 0 block_mutex = mutex;
|| buf_pool_is_block_mutex(mutex)) { block_mutex_oswait_count += mutex->count_os_wait;
goto next_mutex; continue;
} }
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
if (mutex->mutex_type != 1) { if (mutex->mutex_type != 1) {
...@@ -8718,8 +8728,7 @@ innodb_mutex_show_status( ...@@ -8718,8 +8728,7 @@ innodb_mutex_show_status(
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
} } else {
else {
rw_lock_count += mutex->count_using; rw_lock_count += mutex->count_using;
rw_lock_count_spin_loop += mutex->count_spin_loop; rw_lock_count_spin_loop += mutex->count_spin_loop;
rw_lock_count_spin_rounds += mutex->count_spin_rounds; rw_lock_count_spin_rounds += mutex->count_spin_rounds;
...@@ -8731,7 +8740,7 @@ innodb_mutex_show_status( ...@@ -8731,7 +8740,7 @@ innodb_mutex_show_status(
buf1len= (uint) my_snprintf(buf1, sizeof(buf1), "%s:%lu", buf1len= (uint) my_snprintf(buf1, sizeof(buf1), "%s:%lu",
mutex->cfile_name, (ulong) mutex->cline); mutex->cfile_name, (ulong) mutex->cline);
buf2len= (uint) my_snprintf(buf2, sizeof(buf2), "os_waits=%lu", buf2len= (uint) my_snprintf(buf2, sizeof(buf2), "os_waits=%lu",
mutex->count_os_wait); (ulong) mutex->count_os_wait);
if (stat_print(thd, innobase_hton_name, if (stat_print(thd, innobase_hton_name,
hton_name_len, buf1, buf1len, hton_name_len, buf1, buf1len,
...@@ -8740,24 +8749,45 @@ innodb_mutex_show_status( ...@@ -8740,24 +8749,45 @@ innodb_mutex_show_status(
DBUG_RETURN(1); DBUG_RETURN(1);
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
}
if (block_mutex) {
buf1len = (uint) my_snprintf(buf1, sizeof buf1,
"combined %s:%lu",
block_mutex->cfile_name,
(ulong) block_mutex->cline);
buf2len = (uint) my_snprintf(buf2, sizeof buf2,
"os_waits=%lu",
(ulong) block_mutex_oswait_count);
next_mutex: if (stat_print(thd, innobase_hton_name,
mutex = UT_LIST_GET_NEXT(list, mutex); hton_name_len, buf1, buf1len,
buf2, buf2len)) {
mutex_exit(&mutex_list_mutex);
DBUG_RETURN(1);
}
} }
mutex_exit(&mutex_list_mutex); mutex_exit(&mutex_list_mutex);
mutex_enter(&rw_lock_list_mutex); mutex_enter(&rw_lock_list_mutex);
lock = UT_LIST_GET_FIRST(rw_lock_list); for (lock = UT_LIST_GET_FIRST(rw_lock_list); lock != NULL;
lock = UT_LIST_GET_NEXT(list, lock)) {
if (lock->count_os_wait) {
continue;
}
if (buf_pool_is_block_lock(lock)) {
block_lock = lock;
block_lock_oswait_count += lock->count_os_wait;
continue;
}
while (lock != NULL) { buf1len = my_snprintf(buf1, sizeof buf1, "%s:%lu",
if (lock->count_os_wait
&& !buf_pool_is_block_lock(lock)) {
buf1len= my_snprintf(buf1, sizeof(buf1), "%s:%lu",
lock->cfile_name, (ulong) lock->cline); lock->cfile_name, (ulong) lock->cline);
buf2len= my_snprintf(buf2, sizeof(buf2), buf2len = my_snprintf(buf2, sizeof buf2, "os_waits=%lu",
"os_waits=%lu", lock->count_os_wait); (ulong) lock->count_os_wait);
if (stat_print(thd, innobase_hton_name, if (stat_print(thd, innobase_hton_name,
hton_name_len, buf1, buf1len, hton_name_len, buf1, buf1len,
...@@ -8766,19 +8796,36 @@ innodb_mutex_show_status( ...@@ -8766,19 +8796,36 @@ innodb_mutex_show_status(
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
lock = UT_LIST_GET_NEXT(list, lock);
if (block_lock) {
buf1len = (uint) my_snprintf(buf1, sizeof buf1,
"combined %s:%lu",
block_lock->cfile_name,
(ulong) block_lock->cline);
buf2len = (uint) my_snprintf(buf2, sizeof buf2,
"os_waits=%lu",
(ulong) block_lock_oswait_count);
if (stat_print(thd, innobase_hton_name,
hton_name_len, buf1, buf1len,
buf2, buf2len)) {
mutex_exit(&rw_lock_list_mutex);
DBUG_RETURN(1);
}
} }
mutex_exit(&rw_lock_list_mutex); mutex_exit(&rw_lock_list_mutex);
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
buf2len= my_snprintf(buf2, sizeof(buf2), buf2len = my_snprintf(buf2, sizeof buf2,
"count=%lu, spin_waits=%lu, spin_rounds=%lu, " "count=%lu, spin_waits=%lu, spin_rounds=%lu, "
"os_waits=%lu, os_yields=%lu, os_wait_times=%lu", "os_waits=%lu, os_yields=%lu, os_wait_times=%lu",
rw_lock_count, rw_lock_count_spin_loop, (ulong) rw_lock_count,
rw_lock_count_spin_rounds, (ulong) rw_lock_count_spin_loop,
rw_lock_count_os_wait, rw_lock_count_os_yield, (ulong) rw_lock_count_spin_rounds,
(ulong) (rw_lock_wait_time/1000)); (ulong) rw_lock_count_os_wait,
(ulong) rw_lock_count_os_yield,
(ulong) (rw_lock_wait_time / 1000));
if (stat_print(thd, innobase_hton_name, hton_name_len, if (stat_print(thd, innobase_hton_name, hton_name_len,
STRING_WITH_LEN("rw_lock_mutexes"), buf2, buf2len)) { STRING_WITH_LEN("rw_lock_mutexes"), buf2, buf2len)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment