summaryrefslogtreecommitdiff
path: root/innobase/sync/sync0sync.c
diff options
context:
space:
mode:
authorunknown <dfischer/mysqldev@mysql.com/production.mysql.com>2006-12-19 11:48:08 +0100
committerunknown <dfischer/mysqldev@mysql.com/production.mysql.com>2006-12-19 11:48:08 +0100
commit9d8c9e9d96dc85cfac055b6014ac65d867152edf (patch)
tree240a6aad36c9a5aeeb5585308324ab3fc2449512 /innobase/sync/sync0sync.c
parentc32d646d252dd234947dcb54c1fedb9703053819 (diff)
parent306f42701cdbf0801c710f3c0fe0e74c521455fc (diff)
downloadmariadb-git-9d8c9e9d96dc85cfac055b6014ac65d867152edf.tar.gz
Merge mysql.com:/data0/mysqldev/my/mysql-5.0-release
into mysql.com:/data0/mysqldev/my/build-200612151202-5.0.32/mysql-5.0-release sql/ha_innodb.cc: Auto merged
Diffstat (limited to 'innobase/sync/sync0sync.c')
-rw-r--r--innobase/sync/sync0sync.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c
index 95bf83dce79..25b7a5588d9 100644
--- a/innobase/sync/sync0sync.c
+++ b/innobase/sync/sync0sync.c
@@ -202,9 +202,11 @@ void
mutex_create_func(
/*==============*/
mutex_t* mutex, /* in: pointer to memory */
+#ifdef UNIV_DEBUG
+ const char* cmutex_name, /* in: mutex name */
+#endif /* UNIV_DEBUG */
const char* cfile_name, /* in: file name where created */
- ulint cline, /* in: file line where created */
- const char* cmutex_name) /* in: mutex name */
+ ulint cline) /* in: file line where created */
{
#if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER)
mutex_reset_lock_word(mutex);
@@ -223,6 +225,8 @@ mutex_create_func(
mutex->cfile_name = cfile_name;
mutex->cline = cline;
#ifndef UNIV_HOTBACKUP
+ mutex->count_os_wait = 0;
+# ifdef UNIV_DEBUG
mutex->cmutex_name= cmutex_name;
mutex->count_using= 0;
mutex->mutex_type= 0;
@@ -230,8 +234,8 @@ mutex_create_func(
mutex->lmax_spent_time= 0;
mutex->count_spin_loop= 0;
mutex->count_spin_rounds= 0;
- mutex->count_os_wait= 0;
mutex->count_os_yield= 0;
+# endif /* UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */
/* Check that lock_word is aligned; this is important on Intel */
@@ -378,13 +382,13 @@ mutex_spin_wait(
{
ulint index; /* index of the reserved wait cell */
ulint i; /* spin round count */
-#ifndef UNIV_HOTBACKUP
+#if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
ib_longlong lstart_time = 0, lfinish_time; /* for timing os_wait */
ulint ltime_diff;
ulint sec;
ulint ms;
uint timer_started = 0;
-#endif /* !UNIV_HOTBACKUP */
+#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
ut_ad(mutex);
mutex_loop:
@@ -398,10 +402,10 @@ mutex_loop:
memory word. */
spin_loop:
-#ifndef UNIV_HOTBACKUP
+#if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
mutex_spin_wait_count++;
mutex->count_spin_loop++;
-#endif /* !UNIV_HOTBACKUP */
+#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
while (mutex_get_lock_word(mutex) != 0 && i < SYNC_SPIN_ROUNDS)
{
@@ -415,7 +419,7 @@ spin_loop:
if (i == SYNC_SPIN_ROUNDS)
{
-#ifndef UNIV_HOTBACKUP
+#if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
mutex->count_os_yield++;
if (timed_mutexes == 1 && timer_started==0)
{
@@ -423,7 +427,7 @@ spin_loop:
lstart_time= (ib_longlong)sec * 1000000 + ms;
timer_started = 1;
}
-#endif /* !UNIV_HOTBACKUP */
+#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
os_thread_yield();
}
@@ -436,9 +440,9 @@ spin_loop:
mutex_spin_round_count += i;
-#ifndef UNIV_HOTBACKUP
+#if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
mutex->count_spin_rounds += i;
-#endif /* !UNIV_HOTBACKUP */
+#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
if (mutex_test_and_set(mutex) == 0)
{
@@ -522,6 +526,7 @@ Now there is no risk of infinite wait on the event. */
#ifndef UNIV_HOTBACKUP
mutex->count_os_wait++;
+# ifdef UNIV_DEBUG
/*
!!!!! Sometimes os_wait can be called without os_thread_yield
*/
@@ -532,13 +537,14 @@ Now there is no risk of infinite wait on the event. */
lstart_time= (ib_longlong)sec * 1000000 + ms;
timer_started = 1;
}
+# endif /* UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */
sync_array_wait_event(sync_primary_wait_array, index);
goto mutex_loop;
finish_timing:
-#ifndef UNIV_HOTBACKUP
+#if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
if (timed_mutexes == 1 && timer_started==1)
{
ut_usectime(&sec, &ms);
@@ -551,7 +557,7 @@ finish_timing:
mutex->lmax_spent_time= ltime_diff;
}
}
-#endif /* !UNIV_HOTBACKUP */
+#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
return;
}