summaryrefslogtreecommitdiff
path: root/storage/innobase/ut
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-07-25 15:31:11 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-07-25 15:31:11 +0300
commitfdef9f9b8960479919285d6aec0bb30d27fa4723 (patch)
treef358b0f34305572ddf5b4fd2466c3a09ba37c7db /storage/innobase/ut
parent55d8ff0de8168d3b7d465644dc93dca01f53f4f6 (diff)
parenta7e9395f9de0cc19cf79064f5df796d98ec19762 (diff)
downloadmariadb-git-fdef9f9b8960479919285d6aec0bb30d27fa4723.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'storage/innobase/ut')
-rw-r--r--storage/innobase/ut/ut0timer.cc90
-rw-r--r--storage/innobase/ut/ut0ut.cc119
-rw-r--r--storage/innobase/ut/ut0wqueue.cc2
3 files changed, 1 insertions, 210 deletions
diff --git a/storage/innobase/ut/ut0timer.cc b/storage/innobase/ut/ut0timer.cc
deleted file mode 100644
index 9aefcafebc6..00000000000
--- a/storage/innobase/ut/ut0timer.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 2013, 2014, Facebook, Inc. All Rights Reserved.
-Copyright (c) 2014, SkySQL Ab. All Rights Reserved.
-
-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
-Foundation; version 2 of the License.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
-
-*****************************************************************************/
-
-/********************************************************************//**
-@file ut/ut0timer.cc
-Timer rountines
-
-Created 30/07/2014 Jan Lindström jan.lindstrom@skysql.com
-modified from https://github.com/facebook/mysql-5.6/commit/c75a413edeb96eb99bf11d7269bdfea06f96d6b6
-*************************************************************************/
-
-#include "data0type.h"
-#include <my_rdtsc.h>
-#include <ut0timer.h>
-
-/**************************************************************//**
-Initial timer definition
-@return 0 */
-static
-ulonglong
-ut_timer_none(void)
-/*===============*/
-{
- return 0;
-}
-
-/**************************************************************//**
-Function pointer to point selected timer function.
-@return timer current value */
-ulonglong (*ut_timer_now)(void) = &ut_timer_none;
-
-struct my_timer_unit_info ut_timer;
-extern MYSQL_PLUGIN_IMPORT MY_TIMER_INFO sys_timer_info;
-
-/**************************************************************//**
-Sets up the data required for use of my_timer_* functions.
-Selects the best timer by high frequency, and tight resolution.
-Points my_timer_now() to the selected timer function.
-Initializes my_timer struct to contain the info for selected timer.*/
-UNIV_INTERN
-void
-ut_init_timer(void)
-/*===============*/
-{
- if (sys_timer_info.cycles.frequency > 1000000 &&
- sys_timer_info.cycles.resolution == 1) {
- ut_timer = sys_timer_info.cycles;
- ut_timer_now = &my_timer_cycles;
- } else if (sys_timer_info.nanoseconds.frequency > 1000000 &&
- sys_timer_info.nanoseconds.resolution == 1) {
- ut_timer = sys_timer_info.nanoseconds;
- ut_timer_now = &my_timer_nanoseconds;
- } else if (sys_timer_info.microseconds.frequency >= 1000000 &&
- sys_timer_info.microseconds.resolution == 1) {
- ut_timer = sys_timer_info.microseconds;
- ut_timer_now = &my_timer_microseconds;
-
- } else if (sys_timer_info.milliseconds.frequency >= 1000 &&
- sys_timer_info.milliseconds.resolution == 1) {
- ut_timer = sys_timer_info.milliseconds;
- ut_timer_now = &my_timer_milliseconds;
- } else if (sys_timer_info.ticks.frequency >= 1000 &&
- /* Will probably be false */
- sys_timer_info.ticks.resolution == 1) {
- ut_timer = sys_timer_info.ticks;
- ut_timer_now = &my_timer_ticks;
- } else {
- /* None are acceptable, so leave it as "None", and fill in struct */
- ut_timer.frequency = 1; /* Avoid div-by-zero */
- ut_timer.overhead = 0; /* Since it doesn't do anything */
- ut_timer.resolution = 10; /* Another sign it's bad */
- ut_timer.routine = 0; /* None */
- }
-}
diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc
index de12ab0cc11..0d6e9c45aec 100644
--- a/storage/innobase/ut/ut0ut.cc
+++ b/storage/innobase/ut/ut0ut.cc
@@ -39,112 +39,6 @@ Created 5/11/1994 Heikki Tuuri
#include "log.h"
#include "my_cpu.h"
-#ifdef _WIN32
-typedef VOID(WINAPI *time_fn)(LPFILETIME);
-static time_fn ut_get_system_time_as_file_time = GetSystemTimeAsFileTime;
-
-/*****************************************************************//**
-NOTE: The Windows epoch starts from 1601/01/01 whereas the Unix
-epoch starts from 1970/1/1. For selection of constant see:
-http://support.microsoft.com/kb/167296/ */
-#define WIN_TO_UNIX_DELTA_USEC 11644473600000000LL
-
-
-/*****************************************************************//**
-This is the Windows version of gettimeofday(2).
-@return 0 if all OK else -1 */
-static
-int
-ut_gettimeofday(
-/*============*/
- struct timeval* tv, /*!< out: Values are relative to Unix epoch */
- void* tz) /*!< in: not used */
-{
- FILETIME ft;
- int64_t tm;
-
- if (!tv) {
- errno = EINVAL;
- return(-1);
- }
-
- ut_get_system_time_as_file_time(&ft);
-
- tm = (int64_t) ft.dwHighDateTime << 32;
- tm |= ft.dwLowDateTime;
-
- ut_a(tm >= 0); /* If tm wraps over to negative, the quotient / 10
- does not work */
-
- tm /= 10; /* Convert from 100 nsec periods to usec */
-
- /* If we don't convert to the Unix epoch the value for
- struct timeval::tv_sec will overflow.*/
- tm -= WIN_TO_UNIX_DELTA_USEC;
-
- tv->tv_sec = (long) (tm / 1000000L);
- tv->tv_usec = (long) (tm % 1000000L);
-
- return(0);
-}
-#else
-/** An alias for gettimeofday(2). On Microsoft Windows, we have to
-reimplement this function. */
-#define ut_gettimeofday gettimeofday
-#endif
-
-/**********************************************************//**
-Returns system time. We do not specify the format of the time returned:
-the only way to manipulate it is to use the function ut_difftime.
-@return system time */
-ib_time_t
-ut_time(void)
-/*=========*/
-{
- return(time(NULL));
-}
-
-
-/**********************************************************//**
-Returns system time.
-Upon successful completion, the value 0 is returned; otherwise the
-value -1 is returned and the global variable errno is set to indicate the
-error.
-@return 0 on success, -1 otherwise */
-int
-ut_usectime(
-/*========*/
- ulint* sec, /*!< out: seconds since the Epoch */
- ulint* ms) /*!< out: microseconds since the Epoch+*sec */
-{
- struct timeval tv;
- int ret;
- int errno_gettimeofday;
- int i;
-
- for (i = 0; i < 10; i++) {
-
- ret = ut_gettimeofday(&tv, NULL);
-
- if (ret == -1) {
- errno_gettimeofday = errno;
- ib::error() << "gettimeofday(): "
- << strerror(errno_gettimeofday);
- os_thread_sleep(100000); /* 0.1 sec */
- errno = errno_gettimeofday;
- } else {
- break;
- }
- }
-
- if (ret != -1) {
- *sec = (ulint) tv.tv_sec;
- *ms = (ulint) tv.tv_usec;
- }
-
- return(ret);
-}
-
/**********************************************************//**
Returns the number of milliseconds since some epoch. The
value may wrap around. It should only be used for heuristic
@@ -156,19 +50,6 @@ ut_time_ms(void)
{
return static_cast<ulint>(my_interval_timer() / 1000000);
}
-
-/**********************************************************//**
-Returns the difference of two times in seconds.
-@return time2 - time1 expressed in seconds */
-double
-ut_difftime(
-/*========*/
- ib_time_t time2, /*!< in: time */
- ib_time_t time1) /*!< in: time */
-{
- return(difftime(time2, time1));
-}
-
#endif /* !UNIV_INNOCHECKSUM */
/**********************************************************//**
diff --git a/storage/innobase/ut/ut0wqueue.cc b/storage/innobase/ut/ut0wqueue.cc
index 4697aa2fc46..026431695ed 100644
--- a/storage/innobase/ut/ut0wqueue.cc
+++ b/storage/innobase/ut/ut0wqueue.cc
@@ -135,7 +135,7 @@ ib_wqueue_timedwait(
/*================*/
/* out: work item or NULL on timeout*/
ib_wqueue_t* wq, /* in: work queue */
- ib_time_t wait_in_usecs) /* in: wait time in micro seconds */
+ ulint wait_in_usecs) /* in: wait time in micro seconds */
{
ib_list_node_t* node = NULL;