Commit 0f8b518b authored by unknown's avatar unknown

InnoDB: Fix compiler warnings and some bad formatting introduced

in ChangeSet@1.1721.48.1


innobase/include/ut0ut.h:
  Add prototype for ut_usectime()
innobase/srv/srv0srv.c:
  Fix some misformatted code.
  Remove a compiler warning about possibly uninitialized variable
  in srv_suspend_mysql_thread().
innobase/sync/sync0sync.c:
  Remove a compiler warning about possibly uninitialized variable
  in mutex_spin_wait().
innobase/ut/ut0ut.c:
  Improve the documentation and formatting of ut_usectime().
parent 509554c3
...@@ -139,6 +139,14 @@ ib_time_t ...@@ -139,6 +139,14 @@ ib_time_t
ut_time(void); ut_time(void);
/*=========*/ /*=========*/
/************************************************************** /**************************************************************
Returns system time. */
void
ut_usectime(
/*========*/
ulint* sec, /* out: seconds since the Epoch */
ulint* ms); /* out: microseconds since the Epoch+*sec */
/**************************************************************
Returns the difference of two times in seconds. */ Returns the difference of two times in seconds. */
double double
......
...@@ -346,10 +346,10 @@ static ulint srv_n_rows_updated_old = 0; ...@@ -346,10 +346,10 @@ static ulint srv_n_rows_updated_old = 0;
static ulint srv_n_rows_deleted_old = 0; static ulint srv_n_rows_deleted_old = 0;
static ulint srv_n_rows_read_old = 0; static ulint srv_n_rows_read_old = 0;
ulint srv_n_lock_wait_count= 0; ulint srv_n_lock_wait_count = 0;
ulint srv_n_lock_wait_current_count= 0; ulint srv_n_lock_wait_current_count = 0;
ib_longlong srv_n_lock_wait_time= 0; ib_longlong srv_n_lock_wait_time = 0;
ulint srv_n_lock_max_wait_time= 0; ulint srv_n_lock_max_wait_time = 0;
/* /*
...@@ -1384,7 +1384,8 @@ srv_suspend_mysql_thread( ...@@ -1384,7 +1384,8 @@ srv_suspend_mysql_thread(
trx_t* trx; trx_t* trx;
ibool had_dict_lock = FALSE; ibool had_dict_lock = FALSE;
ibool was_declared_inside_innodb = FALSE; ibool was_declared_inside_innodb = FALSE;
ib_longlong start_time, finish_time; ib_longlong start_time = 0;
ib_longlong finish_time;
ulint diff_time; ulint diff_time;
ulint sec; ulint sec;
ulint ms; ulint ms;
...@@ -1430,14 +1431,13 @@ srv_suspend_mysql_thread( ...@@ -1430,14 +1431,13 @@ srv_suspend_mysql_thread(
os_event_reset(event); os_event_reset(event);
slot->suspend_time = ut_time(); slot->suspend_time = ut_time();
if (thr->lock_state == QUE_THR_LOCK_ROW)
{ if (thr->lock_state == QUE_THR_LOCK_ROW) {
srv_n_lock_wait_count++; srv_n_lock_wait_count++;
srv_n_lock_wait_current_count++; srv_n_lock_wait_current_count++;
ut_usectime(&sec, &ms); ut_usectime(&sec, &ms);
start_time= (ib_longlong)sec * 1000000 + ms; start_time = (ib_longlong)sec * 1000000 + ms;
} }
/* Wake the lock timeout monitor thread, if it is suspended */ /* Wake the lock timeout monitor thread, if it is suspended */
...@@ -1490,18 +1490,16 @@ srv_suspend_mysql_thread( ...@@ -1490,18 +1490,16 @@ srv_suspend_mysql_thread(
wait_time = ut_difftime(ut_time(), slot->suspend_time); wait_time = ut_difftime(ut_time(), slot->suspend_time);
if (thr->lock_state == QUE_THR_LOCK_ROW) if (thr->lock_state == QUE_THR_LOCK_ROW) {
{
ut_usectime(&sec, &ms); ut_usectime(&sec, &ms);
finish_time= (ib_longlong)sec * 1000000 + ms; finish_time = (ib_longlong)sec * 1000000 + ms;
diff_time= finish_time-start_time; diff_time = finish_time - start_time;
srv_n_lock_wait_current_count--; srv_n_lock_wait_current_count--;
srv_n_lock_wait_time= srv_n_lock_wait_time + diff_time; srv_n_lock_wait_time = srv_n_lock_wait_time + diff_time;
if (diff_time > srv_n_lock_max_wait_time) if (diff_time > srv_n_lock_max_wait_time) {
{ srv_n_lock_max_wait_time = diff_time;
srv_n_lock_max_wait_time= diff_time;
} }
} }
......
...@@ -368,7 +368,7 @@ mutex_spin_wait( ...@@ -368,7 +368,7 @@ mutex_spin_wait(
{ {
ulint index; /* index of the reserved wait cell */ ulint index; /* index of the reserved wait cell */
ulint i; /* spin round count */ ulint i; /* spin round count */
ib_longlong lstart_time, lfinish_time; /* for timing os_wait */ ib_longlong lstart_time = 0, lfinish_time; /* for timing os_wait */
ulint ltime_diff; ulint ltime_diff;
ulint sec; ulint sec;
ulint ms; ulint ms;
......
...@@ -74,18 +74,18 @@ ut_time(void) ...@@ -74,18 +74,18 @@ ut_time(void)
} }
/************************************************************** /**************************************************************
Returns system time. We do not specify the format of the time returned: Returns system time. */
the only way to manipulate it is to use the function ut_difftime. */
void void
ut_usectime(ulint* sec, ulint* ms) ut_usectime(
/*=========*/ /*========*/
ulint* sec, /* out: seconds since the Epoch */
ulint* ms) /* out: microseconds since the Epoch+*sec */
{ {
struct timeval tv; struct timeval tv;
gettimeofday(&tv,NULL); gettimeofday(&tv,NULL);
*sec = (ulint) tv.tv_sec; *sec = (ulint) tv.tv_sec;
*ms = (ulint) tv.tv_usec; *ms = (ulint) tv.tv_usec;
return;
} }
/************************************************************** /**************************************************************
......
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