diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-07-24 19:43:37 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-07-24 21:21:54 +0300 |
commit | ab6dd774082c57f48d998e03655c06b672799b2d (patch) | |
tree | 25c14f24e255a1480a97960005e415a43a52f3d1 /storage/xtradb/page | |
parent | 86767f4ac15db953c85a94ed81cd374c653e79dd (diff) | |
download | mariadb-git-ab6dd774082c57f48d998e03655c06b672799b2d.tar.gz |
MDEV-14154: Remove ut_time_us()
Use microsecond_interval_timer()
or my_interval_timer() [in nanoseconds] instead.
Diffstat (limited to 'storage/xtradb/page')
-rw-r--r-- | storage/xtradb/page/page0cur.cc | 10 | ||||
-rw-r--r-- | storage/xtradb/page/page0zip.cc | 12 |
2 files changed, 10 insertions, 12 deletions
diff --git a/storage/xtradb/page/page0cur.cc b/storage/xtradb/page/page0cur.cc index 767ae5cbf88..e9ac4b4bb04 100644 --- a/storage/xtradb/page/page0cur.cc +++ b/storage/xtradb/page/page0cur.cc @@ -48,7 +48,7 @@ number between 0 and 2^64-1 inclusive. The formula and the constants being used are: X[n+1] = (a * X[n] + c) mod m where: -X[0] = ut_time_us(NULL) +X[0] = my_interval_timer() a = 1103515245 (3^5 * 5 * 7 * 129749) c = 12345 (3 * 5 * 823) m = 18446744073709551616 (2^64) @@ -61,12 +61,10 @@ page_cur_lcg_prng(void) { #define LCG_a 1103515245 #define LCG_c 12345 - static ib_uint64_t lcg_current = 0; - static ibool initialized = FALSE; + static uint64_t lcg_current; - if (!initialized) { - lcg_current = (ib_uint64_t) ut_time_us(NULL); - initialized = TRUE; + if (!lcg_current) { + lcg_current = my_interval_timer(); } /* no need to "% 2^64" explicitly because lcg_current is diff --git a/storage/xtradb/page/page0zip.cc b/storage/xtradb/page/page0zip.cc index 852807dc239..0c7f9b6feff 100644 --- a/storage/xtradb/page/page0zip.cc +++ b/storage/xtradb/page/page0zip.cc @@ -2,7 +2,7 @@ Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2018, MariaDB Corporation. +Copyright (c) 2014, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1240,7 +1240,7 @@ page_zip_compress( ulint n_blobs = 0; byte* storage;/* storage of uncompressed columns */ #ifndef UNIV_HOTBACKUP - ullint usec = ut_time_us(NULL); + const ulonglong ns = my_interval_timer(); #endif /* !UNIV_HOTBACKUP */ #ifdef PAGE_ZIP_COMPRESS_DBG FILE* logfile = NULL; @@ -1489,7 +1489,7 @@ err_exit: dict_index_zip_failure(index); } - ullint time_diff = ut_time_us(NULL) - usec; + const ullint time_diff = (my_interval_timer() - ns) / 1000; page_zip_stat[page_zip->ssize - 1].compressed_usec += time_diff; if (cmp_per_index_enabled) { @@ -1557,7 +1557,7 @@ err_exit: } #endif /* PAGE_ZIP_COMPRESS_DBG */ #ifndef UNIV_HOTBACKUP - ullint time_diff = ut_time_us(NULL) - usec; + const ullint time_diff = (my_interval_timer() - ns) / 1000; page_zip_stat[page_zip->ssize - 1].compressed_ok++; page_zip_stat[page_zip->ssize - 1].compressed_usec += time_diff; if (cmp_per_index_enabled) { @@ -3006,7 +3006,7 @@ page_zip_decompress( mem_heap_t* heap; ulint* offsets; #ifndef UNIV_HOTBACKUP - ullint usec = ut_time_us(NULL); + const ulonglong ns = my_interval_timer(); #endif /* !UNIV_HOTBACKUP */ ut_ad(page_zip_simple_validate(page_zip)); @@ -3192,7 +3192,7 @@ err_exit: page_zip_fields_free(index); mem_heap_free(heap); #ifndef UNIV_HOTBACKUP - ullint time_diff = ut_time_us(NULL) - usec; + const uint64_t time_diff = (my_interval_timer() - ns) / 1000; page_zip_stat[page_zip->ssize - 1].decompressed++; page_zip_stat[page_zip->ssize - 1].decompressed_usec += time_diff; |