summaryrefslogtreecommitdiff
path: root/storage/xtradb/buf/buf0buf.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-07-24 20:02:07 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-07-24 21:59:26 +0300
commit10ee1b95b80ef1dc2fd3142e04f6031cc8be9e9d (patch)
treebe046f8641f09bbf7ac413c8184883ff969a3d28 /storage/xtradb/buf/buf0buf.cc
parente764d5bc012beacc1ed26c9022829423829b621d (diff)
downloadmariadb-git-10ee1b95b80ef1dc2fd3142e04f6031cc8be9e9d.tar.gz
Remove ut_usectime(), ut_gettimeofday()
Replace ut_usectime() with my_interval_timer(), which is equivalent, but monotonically counting nanoseconds instead of counting the microseconds of real time. os_event_wait_time_low(): Use my_hrtime() instead of ut_usectime(). FIXME: Set a clock attribute on the condition variable that allows a monotonic clock to be chosen as the time base, so that the wait is immune to adjustments of the system clock.
Diffstat (limited to 'storage/xtradb/buf/buf0buf.cc')
-rw-r--r--storage/xtradb/buf/buf0buf.cc51
1 files changed, 14 insertions, 37 deletions
diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc
index 3326f734e45..0f83e7ce011 100644
--- a/storage/xtradb/buf/buf0buf.cc
+++ b/storage/xtradb/buf/buf0buf.cc
@@ -2485,10 +2485,6 @@ buf_page_get_zip(
ibool discard_attempted = FALSE;
ibool must_read;
trx_t* trx = NULL;
- ulint sec;
- ulint ms;
- ib_uint64_t start_time;
- ib_uint64_t finish_time;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
if (UNIV_UNLIKELY(innobase_get_slow_log())) {
@@ -2607,14 +2603,10 @@ got_block:
if (must_read) {
/* Let us wait until the read operation
completes */
-
- if (UNIV_UNLIKELY(trx && trx->take_stats))
- {
- ut_usectime(&sec, &ms);
- start_time = (ib_uint64_t)sec * 1000000 + ms;
- } else {
- start_time = 0;
- }
+ const ulonglong start_time = UNIV_UNLIKELY(trx
+ && trx->take_stats)
+ ? my_interval_timer()
+ : 0;
for (;;) {
enum buf_io_fix io_fix;
@@ -2629,11 +2621,9 @@ got_block:
break;
}
}
- if (UNIV_UNLIKELY(start_time != 0))
- {
- ut_usectime(&sec, &ms);
- finish_time = (ib_uint64_t)sec * 1000000 + ms;
- trx->io_reads_wait_timer += (ulint)(finish_time - start_time);
+ if (UNIV_UNLIKELY(start_time != 0)) {
+ trx->io_reads_wait_timer += ulint(
+ (my_interval_timer() - start_time) / 1000);
}
}
@@ -3013,21 +3003,13 @@ buf_wait_for_read(buf_block_t* block, trx_t* trx)
if (buf_block_get_io_fix_unlocked(block) == BUF_IO_READ) {
- ib_uint64_t start_time;
- ulint sec;
- ulint ms;
-
/* Wait until the read operation completes */
ib_mutex_t* mutex = buf_page_get_mutex(&block->page);
-
- if (UNIV_UNLIKELY(trx && trx->take_stats))
- {
- ut_usectime(&sec, &ms);
- start_time = (ib_uint64_t)sec * 1000000 + ms;
- } else {
- start_time = 0;
- }
+ const ulonglong start_time = UNIV_UNLIKELY(trx
+ && trx->take_stats)
+ ? my_interval_timer()
+ : 0;
for (;;) {
buf_io_fix io_fix;
@@ -3047,15 +3029,10 @@ buf_wait_for_read(buf_block_t* block, trx_t* trx)
}
}
- if (UNIV_UNLIKELY(start_time != 0))
- {
- ut_usectime(&sec, &ms);
- ib_uint64_t finish_time
- = (ib_uint64_t)sec * 1000000 + ms;
- trx->io_reads_wait_timer
- += (ulint)(finish_time - start_time);
+ if (UNIV_UNLIKELY(start_time != 0)) {
+ trx->io_reads_wait_timer += ulint(
+ (my_interval_timer() - start_time) / 1000);
}
-
}
}