Remove the wrappers ut_time(), ut_difftime(), ib_time_t
This commit is contained in:
parent
c663a9414b
commit
0c7c61019d
@ -1688,7 +1688,7 @@ buf_pool_init_instance(
|
||||
|
||||
buf_pool->zip_hash = hash_create(2 * buf_pool->curr_size);
|
||||
|
||||
buf_pool->last_printout_time = ut_time();
|
||||
buf_pool->last_printout_time = time(NULL);
|
||||
}
|
||||
/* 2. Initialize flushing fields
|
||||
-------------------------------- */
|
||||
@ -6160,7 +6160,7 @@ buf_refresh_io_stats(
|
||||
/*=================*/
|
||||
buf_pool_t* buf_pool) /*!< in: buffer pool instance */
|
||||
{
|
||||
buf_pool->last_printout_time = ut_time();
|
||||
buf_pool->last_printout_time = time(NULL);
|
||||
buf_pool->old_stat = buf_pool->stat;
|
||||
}
|
||||
|
||||
|
@ -750,7 +750,7 @@ void
|
||||
dict_mem_init(void)
|
||||
{
|
||||
/* Initialize a randomly distributed temporary file number */
|
||||
ib_uint32_t now = static_cast<ib_uint32_t>(ut_time());
|
||||
ib_uint32_t now = static_cast<ib_uint32_t>(time(NULL));
|
||||
|
||||
const byte* buf = reinterpret_cast<const byte*>(&now);
|
||||
ut_ad(ut_crc32 != NULL);
|
||||
|
@ -45,7 +45,7 @@ Created Jan 06, 2010 Vasil Dimov
|
||||
#include "trx0trx.h" /* trx_create() */
|
||||
#include "trx0roll.h" /* trx_rollback_to_savepoint() */
|
||||
#include "ut0rnd.h" /* ut_rnd_interval() */
|
||||
#include "ut0ut.h" /* ut_format_name(), ut_time() */
|
||||
#include "ut0ut.h" /* ut_format_name() */
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
@ -1000,7 +1000,7 @@ dict_stats_update_transient(
|
||||
table->stat_sum_of_other_index_sizes = sum_of_index_sizes
|
||||
- index->stat_index_size;
|
||||
|
||||
table->stats_last_recalc = ut_time();
|
||||
table->stats_last_recalc = time(NULL);
|
||||
|
||||
table->stat_modified_counter = 0;
|
||||
|
||||
@ -2325,7 +2325,7 @@ dict_stats_update_persistent(
|
||||
+= index->stat_index_size;
|
||||
}
|
||||
|
||||
table->stats_last_recalc = ut_time();
|
||||
table->stats_last_recalc = time(NULL);
|
||||
|
||||
table->stat_modified_counter = 0;
|
||||
|
||||
@ -2535,7 +2535,7 @@ dict_stats_save(
|
||||
/* MySQL's timestamp is 4 byte, so we use
|
||||
pars_info_add_int4_literal() which takes a lint arg, so "now" is
|
||||
lint */
|
||||
now = (lint) ut_time();
|
||||
now = (lint) time(NULL);
|
||||
|
||||
pinfo = pars_info_create();
|
||||
|
||||
@ -3980,7 +3980,7 @@ dict_stats_save_defrag_summary(
|
||||
dict_index_t* index) /*!< in: index */
|
||||
{
|
||||
dberr_t ret;
|
||||
lint now = (lint) ut_time();
|
||||
lint now = (lint) time(NULL);
|
||||
if (dict_index_is_univ(index)) {
|
||||
return DB_SUCCESS;
|
||||
}
|
||||
@ -4017,7 +4017,7 @@ dict_stats_save_defrag_stats(
|
||||
return DB_SUCCESS;
|
||||
}
|
||||
|
||||
lint now = (lint) ut_time();
|
||||
lint now = (lint) time(NULL);
|
||||
mtr_t mtr;
|
||||
ulint n_leaf_pages;
|
||||
ulint n_leaf_reserved;
|
||||
|
@ -437,14 +437,14 @@ dict_stats_process_entry_from_recalc_pool()
|
||||
|
||||
mutex_exit(&dict_sys->mutex);
|
||||
|
||||
/* ut_time() could be expensive, the current function
|
||||
/* time() could be expensive, the current function
|
||||
is called once every time a table has been changed more than 10% and
|
||||
on a system with lots of small tables, this could become hot. If we
|
||||
find out that this is a problem, then the check below could eventually
|
||||
be replaced with something else, though a time interval is the natural
|
||||
approach. */
|
||||
|
||||
if (ut_difftime(ut_time(), table->stats_last_recalc)
|
||||
if (difftime(time(NULL), table->stats_last_recalc)
|
||||
< MIN_RECALC_INTERVAL) {
|
||||
|
||||
/* Stats were (re)calculated not long ago. To avoid
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 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
|
||||
@ -858,7 +859,7 @@ eval_predefined(
|
||||
dfield_get_data(que_node_get_val(arg1)));
|
||||
|
||||
} else if (func == PARS_SYSDATE_TOKEN) {
|
||||
int_val = (lint) ut_time();
|
||||
int_val = (lint) time(NULL);
|
||||
} else {
|
||||
eval_predefined_2(func_node);
|
||||
|
||||
|
@ -77,8 +77,8 @@ UNIV_INTERN ulong fts_min_token_size;
|
||||
|
||||
|
||||
// FIXME: testing
|
||||
ib_time_t elapsed_time = 0;
|
||||
ulint n_nodes = 0;
|
||||
static time_t elapsed_time;
|
||||
static ulint n_nodes;
|
||||
|
||||
/** Error condition reported by fts_utf8_decode() */
|
||||
const ulint UTF8_ERROR = 0xFFFFFFFF;
|
||||
@ -3798,7 +3798,7 @@ fts_write_node(
|
||||
pars_info_t* info;
|
||||
dberr_t error;
|
||||
ib_uint32_t doc_count;
|
||||
ib_time_t start_time;
|
||||
time_t start_time;
|
||||
doc_id_t last_doc_id;
|
||||
doc_id_t first_doc_id;
|
||||
char table_name[MAX_FULL_NAME_LEN];
|
||||
@ -3845,9 +3845,9 @@ fts_write_node(
|
||||
" :last_doc_id, :doc_count, :ilist);");
|
||||
}
|
||||
|
||||
start_time = ut_time();
|
||||
start_time = time(NULL);
|
||||
error = fts_eval_sql(trx, *graph);
|
||||
elapsed_time += ut_time() - start_time;
|
||||
elapsed_time += time(NULL) - start_time;
|
||||
++n_nodes;
|
||||
|
||||
return(error);
|
||||
@ -4298,7 +4298,7 @@ fts_sync_begin(
|
||||
n_nodes = 0;
|
||||
elapsed_time = 0;
|
||||
|
||||
sync->start_time = ut_time();
|
||||
sync->start_time = time(NULL);
|
||||
|
||||
sync->trx = trx_allocate_for_background();
|
||||
|
||||
@ -4457,7 +4457,7 @@ fts_sync_commit(
|
||||
"SYNC for table %s: SYNC time : %lu secs: "
|
||||
"elapsed %lf ins/sec",
|
||||
sync->table->name,
|
||||
(ulong) (ut_time() - sync->start_time),
|
||||
(ulong) (time(NULL) - sync->start_time),
|
||||
(double) n_nodes/ (double) elapsed_time);
|
||||
}
|
||||
|
||||
|
@ -1648,7 +1648,7 @@ fts_optimize_get_index_start_time(
|
||||
/*==============================*/
|
||||
trx_t* trx, /*!< in: transaction */
|
||||
dict_index_t* index, /*!< in: FTS index */
|
||||
ib_time_t* start_time) /*!< out: time in secs */
|
||||
time_t* start_time) /*!< out: time in secs */
|
||||
{
|
||||
return(fts_config_get_index_ulint(
|
||||
trx, index, FTS_OPTIMIZE_START_TIME,
|
||||
@ -1664,7 +1664,7 @@ fts_optimize_set_index_start_time(
|
||||
/*==============================*/
|
||||
trx_t* trx, /*!< in: transaction */
|
||||
dict_index_t* index, /*!< in: FTS index */
|
||||
ib_time_t start_time) /*!< in: start time */
|
||||
time_t start_time) /*!< in: start time */
|
||||
{
|
||||
return(fts_config_set_index_ulint(
|
||||
trx, index, FTS_OPTIMIZE_START_TIME,
|
||||
@ -1918,7 +1918,7 @@ fts_optimize_index_completed(
|
||||
dberr_t error;
|
||||
byte buf[sizeof(ulint)];
|
||||
#ifdef FTS_OPTIMIZE_DEBUG
|
||||
ib_time_t end_time = ut_time();
|
||||
time_t end_time = time(NULL);
|
||||
|
||||
error = fts_optimize_set_index_end_time(optim->trx, index, end_time);
|
||||
#endif
|
||||
@ -2337,14 +2337,14 @@ fts_optimize_indexes(
|
||||
/* Start time will be 0 only for the first time or after
|
||||
completing the optimization of all FTS indexes. */
|
||||
if (start_time == 0) {
|
||||
start_time = ut_time();
|
||||
start_time = time(NULL);
|
||||
|
||||
error = fts_optimize_set_index_start_time(
|
||||
optim->trx, index, start_time);
|
||||
}
|
||||
|
||||
/* Check if this index needs to be optimized or not. */
|
||||
if (ut_difftime(end_time, start_time) < 0) {
|
||||
if (difftime(end_time, start_time) < 0) {
|
||||
error = fts_optimize_index(optim, index);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
@ -2416,7 +2416,7 @@ fts_optimize_reset_start_time(
|
||||
for (uint i = 0; i < ib_vector_size(fts->indexes); ++i) {
|
||||
dict_index_t* index;
|
||||
|
||||
ib_time_t start_time = 0;
|
||||
time_t start_time = 0;
|
||||
|
||||
/* Reset the start time to 0 for this index. */
|
||||
error = fts_optimize_set_index_start_time(
|
||||
@ -2471,7 +2471,7 @@ fts_optimize_table_bk(
|
||||
&& table->fts->cache->deleted >= FTS_OPTIMIZE_THRESHOLD) {
|
||||
error = fts_optimize_table(table);
|
||||
|
||||
slot->last_run = ut_time();
|
||||
slot->last_run = time(NULL);
|
||||
|
||||
if (error == DB_SUCCESS) {
|
||||
slot->running = false;
|
||||
@ -3001,7 +3001,7 @@ fts_optimize_init(void)
|
||||
|
||||
fts_optimize_wq = ib_wqueue_create();
|
||||
ut_a(fts_optimize_wq != NULL);
|
||||
last_check_sync_time = ut_time();
|
||||
last_check_sync_time = time(NULL);
|
||||
|
||||
os_thread_create(fts_optimize_thread, fts_optimize_wq, NULL);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2012, Facebook Inc.
|
||||
Copyright (c) 2013, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2013, 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
|
||||
@ -1181,7 +1181,7 @@ struct dict_table_t{
|
||||
goes to zero. If it's -1, means there's DDL
|
||||
on the table, DML from memcached will be
|
||||
blocked. */
|
||||
ib_time_t stats_last_recalc;
|
||||
time_t stats_last_recalc;
|
||||
/*!< Timestamp of last recalc of the stats */
|
||||
ib_uint32_t stat_persistent;
|
||||
/*!< The two bits below are set in the
|
||||
|
@ -426,7 +426,7 @@ struct recv_sys_t{
|
||||
log record, or there is a log parsing
|
||||
buffer overflow */
|
||||
/** the time when progress was last reported */
|
||||
ib_time_t progress_time;
|
||||
time_t progress_time;
|
||||
#ifdef UNIV_LOG_ARCHIVE
|
||||
log_group_t* archive_group;
|
||||
/*!< in archive recovery: the log group whose
|
||||
@ -444,7 +444,7 @@ struct recv_sys_t{
|
||||
@param[in] time the current time
|
||||
@return whether progress should be reported
|
||||
(the last report was at least 15 seconds ago) */
|
||||
bool report(ib_time_t time)
|
||||
bool report(time_t time)
|
||||
{
|
||||
if (time - progress_time < 15) {
|
||||
return false;
|
||||
|
@ -58,9 +58,9 @@ create the internal counter ID in "monitor_id_t". */
|
||||
|
||||
/** Structure containing the actual values of a monitor counter. */
|
||||
struct monitor_value_t {
|
||||
ib_time_t mon_start_time; /*!< Start time of monitoring */
|
||||
ib_time_t mon_stop_time; /*!< Stop time of monitoring */
|
||||
ib_time_t mon_reset_time; /*!< Time counter resetted */
|
||||
time_t mon_start_time; /*!< Start time of monitoring */
|
||||
time_t mon_stop_time; /*!< Stop time of monitoring */
|
||||
time_t mon_reset_time; /*!< Time of resetting the counter */
|
||||
mon_type_t mon_value; /*!< Current counter Value */
|
||||
mon_type_t mon_max_value; /*!< Current Max value */
|
||||
mon_type_t mon_min_value; /*!< Current Min value */
|
||||
|
@ -129,7 +129,7 @@ struct i_s_trx_row_t {
|
||||
trx_id_t trx_id; /*!< transaction identifier */
|
||||
const char* trx_state; /*!< transaction state from
|
||||
trx_get_que_state_str() */
|
||||
ib_time_t trx_started; /*!< trx_t::start_time */
|
||||
time_t trx_started; /*!< trx_t::start_time */
|
||||
const i_s_locks_row_t* requested_lock_row;
|
||||
/*!< pointer to a row
|
||||
in innodb_locks if trx
|
||||
|
@ -53,9 +53,6 @@ Created 1/20/1994 Heikki Tuuri
|
||||
/** Index name prefix in fast index creation, as a string constant */
|
||||
#define TEMP_INDEX_PREFIX_STR "\377"
|
||||
|
||||
/** Time stamp */
|
||||
typedef time_t ib_time_t;
|
||||
|
||||
/* In order to call a piece of code, when a function returns or when the
|
||||
scope ends, use this utility class. It will invoke the given function
|
||||
object in its destructor. */
|
||||
@ -235,27 +232,6 @@ store the given number of bits.
|
||||
#define UT_BITS_IN_BYTES(b) (((b) + 7) / 8)
|
||||
|
||||
#ifndef UNIV_INNOCHECKSUM
|
||||
/**********************************************************//**
|
||||
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 */
|
||||
UNIV_INTERN
|
||||
ib_time_t
|
||||
ut_time(void);
|
||||
/*=========*/
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
/**********************************************************//**
|
||||
Returns the number of milliseconds since some epoch. The
|
||||
value may wrap around. It should only be used for heuristic
|
||||
purposes.
|
||||
@return ms since epoch */
|
||||
UNIV_INTERN
|
||||
ulint
|
||||
ut_time_ms(void);
|
||||
/*============*/
|
||||
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
|
||||
/**********************************************************//**
|
||||
Returns the number of milliseconds since some epoch. The
|
||||
value may wrap around. It should only be used for heuristic
|
||||
@ -265,17 +241,6 @@ UNIV_INTERN
|
||||
ulint
|
||||
ut_time_ms(void);
|
||||
/*============*/
|
||||
|
||||
/**********************************************************//**
|
||||
Returns the difference of two times in seconds.
|
||||
@return time2 - time1 expressed in seconds */
|
||||
UNIV_INTERN
|
||||
double
|
||||
ut_difftime(
|
||||
/*========*/
|
||||
ib_time_t time2, /*!< in: time */
|
||||
ib_time_t time1); /*!< in: time */
|
||||
|
||||
#endif /* !UNIV_INNOCHECKSUM */
|
||||
|
||||
/**********************************************************//**
|
||||
|
@ -2171,7 +2171,7 @@ lock_rec_create(
|
||||
/* Set the bit corresponding to rec */
|
||||
lock_rec_set_nth_bit(lock, heap_no);
|
||||
|
||||
lock->requested_time = ut_time();
|
||||
lock->requested_time = time(NULL);
|
||||
lock->wait_time = 0;
|
||||
|
||||
index->table->n_rec_locks++;
|
||||
@ -3052,16 +3052,18 @@ lock_grant(
|
||||
}
|
||||
}
|
||||
|
||||
const time_t now = time(NULL);
|
||||
|
||||
/* Cumulate total lock wait time for statistics */
|
||||
if (lock_get_type_low(lock) & LOCK_TABLE) {
|
||||
lock->trx->total_table_lock_wait_time +=
|
||||
(ulint)difftime(ut_time(), lock->trx->lock.wait_started);
|
||||
(ulint)difftime(now, lock->trx->lock.wait_started);
|
||||
} else {
|
||||
lock->trx->total_rec_lock_wait_time +=
|
||||
(ulint)difftime(ut_time(), lock->trx->lock.wait_started);
|
||||
(ulint)difftime(now, lock->trx->lock.wait_started);
|
||||
}
|
||||
|
||||
lock->wait_time = (ulint)difftime(ut_time(), lock->requested_time);
|
||||
lock->wait_time = (ulint)difftime(now, lock->requested_time);
|
||||
|
||||
if (!owns_trx_mutex) {
|
||||
trx_mutex_exit(lock->trx);
|
||||
@ -4961,7 +4963,7 @@ lock_table_create(
|
||||
|
||||
lock->type_mode = type_mode | LOCK_TABLE;
|
||||
lock->trx = trx;
|
||||
lock->requested_time = ut_time();
|
||||
lock->requested_time = time(NULL);
|
||||
lock->wait_time = 0;
|
||||
|
||||
lock->un_member.tab_lock.table = table;
|
||||
|
@ -60,7 +60,7 @@ lock_wait_table_print(void)
|
||||
(ulong) slot->in_use,
|
||||
(ulong) slot->suspended,
|
||||
slot->wait_timeout,
|
||||
(ulong) difftime(ut_time(), slot->suspend_time));
|
||||
(ulong) difftime(time(NULL), slot->suspend_time));
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ lock_wait_table_reserve_slot(
|
||||
|
||||
os_event_reset(slot->event);
|
||||
slot->suspended = TRUE;
|
||||
slot->suspend_time = ut_time();
|
||||
slot->suspend_time = time(NULL);
|
||||
slot->wait_timeout = wait_timeout;
|
||||
|
||||
if (slot == lock_sys->last_slot) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2009, Google Inc.
|
||||
Copyright (c) 2014, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2014, 2019, MariaDB Corporation.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
@ -2340,7 +2340,7 @@ loop:
|
||||
start_lsn += len;
|
||||
buf += len;
|
||||
|
||||
if (recv_sys->report(ut_time())) {
|
||||
if (recv_sys->report(time(NULL))) {
|
||||
ib_logf(IB_LOG_LEVEL_INFO, "Read redo log up to LSN=" LSN_PF,
|
||||
start_lsn);
|
||||
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
|
||||
|
@ -423,7 +423,7 @@ recv_sys_init(
|
||||
recv_sys->last_block_buf_start, OS_FILE_LOG_BLOCK_SIZE));
|
||||
|
||||
recv_sys->found_corrupt_log = FALSE;
|
||||
recv_sys->progress_time = ut_time();
|
||||
recv_sys->progress_time = time(NULL);
|
||||
|
||||
recv_max_page_lsn = 0;
|
||||
|
||||
@ -1702,7 +1702,7 @@ recv_recover_page_func(
|
||||
|
||||
mtr_commit(&mtr);
|
||||
|
||||
ib_time_t time = ut_time();
|
||||
time_t now = time(NULL);
|
||||
|
||||
mutex_enter(&recv_sys->mutex);
|
||||
|
||||
@ -1714,7 +1714,7 @@ recv_recover_page_func(
|
||||
|
||||
ut_a(recv_sys->n_addrs > 0);
|
||||
if (ulint n = --recv_sys->n_addrs) {
|
||||
if (recv_sys->report(time)) {
|
||||
if (recv_sys->report(now)) {
|
||||
ib_logf(IB_LOG_LEVEL_INFO,
|
||||
"To recover: " ULINTPF " pages from log", n);
|
||||
service_manager_extend_timeout(
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2009, Percona Inc.
|
||||
Copyright (c) 2013, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2013, 2019, MariaDB Corporation.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted
|
||||
by Percona Inc.. Those modifications are
|
||||
@ -4208,7 +4208,7 @@ os_aio_init(
|
||||
|
||||
os_aio_validate();
|
||||
|
||||
os_last_printout = ut_time();
|
||||
os_last_printout = time(NULL);
|
||||
|
||||
if (srv_use_native_aio) {
|
||||
return(TRUE);
|
||||
@ -4521,7 +4521,7 @@ found:
|
||||
}
|
||||
|
||||
slot->reserved = TRUE;
|
||||
slot->reservation_time = ut_time();
|
||||
slot->reservation_time = time(NULL);
|
||||
slot->message1 = message1;
|
||||
slot->message2 = message2;
|
||||
slot->file = file;
|
||||
@ -5600,7 +5600,7 @@ restart:
|
||||
if (slot->reserved) {
|
||||
|
||||
age = (ulint) difftime(
|
||||
ut_time(), slot->reservation_time);
|
||||
time(NULL), slot->reservation_time);
|
||||
|
||||
if ((age >= 2 && age > biggest_age)
|
||||
|| (age >= 2 && age == biggest_age
|
||||
@ -6014,7 +6014,7 @@ os_aio_print(
|
||||
}
|
||||
|
||||
putc('\n', file);
|
||||
current_time = ut_time();
|
||||
current_time = time(NULL);
|
||||
time_elapsed = 0.001 + difftime(current_time, os_last_printout);
|
||||
|
||||
fprintf(file,
|
||||
|
@ -1716,10 +1716,11 @@ DECLARE_THREAD(srv_monitor_thread)(void*)
|
||||
pfs_register_thread(srv_monitor_thread_key);
|
||||
#endif /* UNIV_PFS_THREAD */
|
||||
|
||||
srv_last_monitor_time = ut_time();
|
||||
last_table_monitor_time = ut_time();
|
||||
last_tablespace_monitor_time = ut_time();
|
||||
last_monitor_time = ut_time();
|
||||
current_time = time(NULL);
|
||||
srv_last_monitor_time = current_time;
|
||||
last_table_monitor_time = current_time;
|
||||
last_tablespace_monitor_time = current_time;
|
||||
last_monitor_time = current_time;
|
||||
mutex_skipped = 0;
|
||||
last_srv_print_monitor = srv_print_innodb_monitor;
|
||||
loop:
|
||||
@ -1730,12 +1731,12 @@ loop:
|
||||
|
||||
os_event_wait_time_low(srv_monitor_event, 5000000, sig_count);
|
||||
|
||||
current_time = ut_time();
|
||||
current_time = time(NULL);
|
||||
|
||||
time_elapsed = difftime(current_time, last_monitor_time);
|
||||
|
||||
if (time_elapsed > 15) {
|
||||
last_monitor_time = ut_time();
|
||||
last_monitor_time = current_time;
|
||||
|
||||
if (srv_print_innodb_monitor) {
|
||||
/* Reset mutex_skipped counter everytime
|
||||
@ -1782,7 +1783,7 @@ loop:
|
||||
if (srv_print_innodb_tablespace_monitor
|
||||
&& difftime(current_time,
|
||||
last_tablespace_monitor_time) > 60) {
|
||||
last_tablespace_monitor_time = ut_time();
|
||||
last_tablespace_monitor_time = current_time;
|
||||
|
||||
fputs("========================"
|
||||
"========================\n",
|
||||
@ -1808,7 +1809,7 @@ loop:
|
||||
if (srv_print_innodb_table_monitor
|
||||
&& difftime(current_time, last_table_monitor_time) > 60) {
|
||||
|
||||
last_table_monitor_time = ut_time();
|
||||
last_table_monitor_time = current_time;
|
||||
|
||||
fprintf(stderr, "Warning: %s\n",
|
||||
DEPRECATED_MSG_INNODB_TABLE_MONITOR);
|
||||
@ -2183,20 +2184,16 @@ static
|
||||
void
|
||||
srv_shutdown_print_master_pending(
|
||||
/*==============================*/
|
||||
ib_time_t* last_print_time, /*!< last time the function
|
||||
time_t* last_print_time, /*!< last time the function
|
||||
print the message */
|
||||
ulint n_tables_to_drop, /*!< number of tables to
|
||||
be dropped */
|
||||
ulint n_bytes_merged) /*!< number of change buffer
|
||||
just merged */
|
||||
{
|
||||
ib_time_t current_time;
|
||||
double time_elapsed;
|
||||
time_t current_time = time(NULL);
|
||||
|
||||
current_time = ut_time();
|
||||
time_elapsed = ut_difftime(current_time, *last_print_time);
|
||||
|
||||
if (time_elapsed > 60) {
|
||||
if (difftime(current_time, *last_print_time) > 60) {
|
||||
*last_print_time = current_time;
|
||||
|
||||
if (n_tables_to_drop) {
|
||||
@ -2231,7 +2228,7 @@ void
|
||||
srv_master_do_active_tasks(void)
|
||||
/*============================*/
|
||||
{
|
||||
ib_time_t cur_time = ut_time();
|
||||
time_t cur_time = time(NULL);
|
||||
ulonglong counter_time = microsecond_interval_timer();
|
||||
ulint n_evicted = 0;
|
||||
|
||||
@ -2390,7 +2387,7 @@ srv_shutdown(bool ibuf_merge)
|
||||
{
|
||||
ulint n_bytes_merged = 0;
|
||||
ulint n_tables_to_drop;
|
||||
ib_time_t now = ut_time();
|
||||
time_t now = time(NULL);
|
||||
|
||||
do {
|
||||
ut_ad(!srv_read_only_mode);
|
||||
@ -2539,10 +2536,10 @@ srv_purge_should_exit(ulint n_purged)
|
||||
/* Slow shutdown was requested. */
|
||||
if (n_purged) {
|
||||
#if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY
|
||||
static ib_time_t progress_time;
|
||||
ib_time_t time = ut_time();
|
||||
if (time - progress_time >= 15) {
|
||||
progress_time = time;
|
||||
static time_t progress_time;
|
||||
time_t now = time(NULL);
|
||||
if (now - progress_time >= 15) {
|
||||
progress_time = now;
|
||||
service_manager_extend_timeout(
|
||||
INNODB_EXTEND_TIMEOUT_INTERVAL,
|
||||
"InnoDB: to purge " ULINTPF " transactions",
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2008, Google Inc.
|
||||
Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
|
||||
Copyright (c) 2013, 2019, MariaDB Corporation.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
@ -405,7 +405,7 @@ sync_array_reserve_cell(
|
||||
event = sync_cell_get_event(cell);
|
||||
cell->signal_count = os_event_reset(event);
|
||||
|
||||
cell->reservation_time = ut_time();
|
||||
cell->reservation_time = time(NULL);
|
||||
|
||||
cell->thread = os_thread_get_curr_id();
|
||||
|
||||
|
@ -738,11 +738,11 @@ trx_roll_must_shutdown()
|
||||
return true;
|
||||
}
|
||||
|
||||
ib_time_t time = ut_time();
|
||||
time_t now = time(NULL);
|
||||
mutex_enter(&trx_sys->mutex);
|
||||
mutex_enter(&recv_sys->mutex);
|
||||
|
||||
if (recv_sys->report(time)) {
|
||||
if (recv_sys->report(now)) {
|
||||
ulint n_trx = 0;
|
||||
ulonglong n_rows = 0;
|
||||
for (const trx_t* t = UT_LIST_GET_FIRST(trx_sys->rw_trx_list);
|
||||
|
@ -907,7 +907,7 @@ trx_start_low(
|
||||
|
||||
mutex_exit(&trx_sys->mutex);
|
||||
|
||||
trx->start_time = ut_time();
|
||||
trx->start_time = time(NULL);
|
||||
|
||||
trx->start_time_micro = trx->mysql_thd
|
||||
? thd_query_start_micro(trx->mysql_thd)
|
||||
|
@ -44,21 +44,6 @@ Created 5/11/1994 Heikki Tuuri
|
||||
# include "ha_prototypes.h"
|
||||
# include "mysql_com.h" /* NAME_LEN */
|
||||
# include <string>
|
||||
#endif /* UNIV_HOTBACKUP */
|
||||
|
||||
/**********************************************************//**
|
||||
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 */
|
||||
UNIV_INTERN
|
||||
ib_time_t
|
||||
ut_time(void)
|
||||
/*=========*/
|
||||
{
|
||||
return(time(NULL));
|
||||
}
|
||||
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
/**********************************************************//**
|
||||
Returns the number of milliseconds since some epoch. The
|
||||
value may wrap around. It should only be used for heuristic
|
||||
@ -72,20 +57,6 @@ ut_time_ms(void)
|
||||
return static_cast<ulint>(my_interval_timer() / 1000000);
|
||||
}
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
|
||||
/**********************************************************//**
|
||||
Returns the difference of two times in seconds.
|
||||
@return time2 - time1 expressed in seconds */
|
||||
UNIV_INTERN
|
||||
double
|
||||
ut_difftime(
|
||||
/*========*/
|
||||
ib_time_t time2, /*!< in: time */
|
||||
ib_time_t time1) /*!< in: time */
|
||||
{
|
||||
return(difftime(time2, time1));
|
||||
}
|
||||
|
||||
#endif /* !UNIV_INNOCHECKSUM */
|
||||
|
||||
/**********************************************************//**
|
||||
|
@ -1700,7 +1700,7 @@ buf_pool_init_instance(
|
||||
|
||||
buf_pool->zip_hash = hash_create(2 * buf_pool->curr_size);
|
||||
|
||||
buf_pool->last_printout_time = ut_time();
|
||||
buf_pool->last_printout_time = time(NULL);
|
||||
}
|
||||
/* 2. Initialize flushing fields
|
||||
-------------------------------- */
|
||||
@ -6200,7 +6200,7 @@ buf_refresh_io_stats(
|
||||
/*=================*/
|
||||
buf_pool_t* buf_pool) /*!< in: buffer pool instance */
|
||||
{
|
||||
buf_pool->last_printout_time = ut_time();
|
||||
buf_pool->last_printout_time = time(NULL);
|
||||
buf_pool->old_stat = buf_pool->stat;
|
||||
}
|
||||
|
||||
|
@ -751,7 +751,7 @@ void
|
||||
dict_mem_init(void)
|
||||
{
|
||||
/* Initialize a randomly distributed temporary file number */
|
||||
ib_uint32_t now = static_cast<ib_uint32_t>(ut_time());
|
||||
ib_uint32_t now = static_cast<ib_uint32_t>(time(NULL));
|
||||
|
||||
const byte* buf = reinterpret_cast<const byte*>(&now);
|
||||
ut_ad(ut_crc32 != NULL);
|
||||
|
@ -45,7 +45,7 @@ Created Jan 06, 2010 Vasil Dimov
|
||||
#include "trx0trx.h" /* trx_create() */
|
||||
#include "trx0roll.h" /* trx_rollback_to_savepoint() */
|
||||
#include "ut0rnd.h" /* ut_rnd_interval() */
|
||||
#include "ut0ut.h" /* ut_format_name(), ut_time() */
|
||||
#include "ut0ut.h" /* ut_format_name() */
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
@ -1000,7 +1000,7 @@ dict_stats_update_transient(
|
||||
table->stat_sum_of_other_index_sizes = sum_of_index_sizes
|
||||
- index->stat_index_size;
|
||||
|
||||
table->stats_last_recalc = ut_time();
|
||||
table->stats_last_recalc = time(NULL);
|
||||
|
||||
table->stat_modified_counter = 0;
|
||||
|
||||
@ -2325,7 +2325,7 @@ dict_stats_update_persistent(
|
||||
+= index->stat_index_size;
|
||||
}
|
||||
|
||||
table->stats_last_recalc = ut_time();
|
||||
table->stats_last_recalc = time(NULL);
|
||||
|
||||
table->stat_modified_counter = 0;
|
||||
|
||||
@ -2535,7 +2535,7 @@ dict_stats_save(
|
||||
/* MySQL's timestamp is 4 byte, so we use
|
||||
pars_info_add_int4_literal() which takes a lint arg, so "now" is
|
||||
lint */
|
||||
now = (lint) ut_time();
|
||||
now = (lint) time(NULL);
|
||||
|
||||
pinfo = pars_info_create();
|
||||
|
||||
@ -3980,7 +3980,7 @@ dict_stats_save_defrag_summary(
|
||||
dict_index_t* index) /*!< in: index */
|
||||
{
|
||||
dberr_t ret;
|
||||
lint now = (lint) ut_time();
|
||||
lint now = (lint) time(NULL);
|
||||
if (dict_index_is_univ(index)) {
|
||||
return DB_SUCCESS;
|
||||
}
|
||||
@ -4017,7 +4017,7 @@ dict_stats_save_defrag_stats(
|
||||
return DB_SUCCESS;
|
||||
}
|
||||
|
||||
lint now = (lint) ut_time();
|
||||
lint now = (lint) time(NULL);
|
||||
mtr_t mtr;
|
||||
ulint n_leaf_pages;
|
||||
ulint n_leaf_reserved;
|
||||
|
@ -437,14 +437,14 @@ dict_stats_process_entry_from_recalc_pool()
|
||||
|
||||
mutex_exit(&dict_sys->mutex);
|
||||
|
||||
/* ut_time() could be expensive, the current function
|
||||
/* time() could be expensive, the current function
|
||||
is called once every time a table has been changed more than 10% and
|
||||
on a system with lots of small tables, this could become hot. If we
|
||||
find out that this is a problem, then the check below could eventually
|
||||
be replaced with something else, though a time interval is the natural
|
||||
approach. */
|
||||
|
||||
if (ut_difftime(ut_time(), table->stats_last_recalc)
|
||||
if (difftime(time(NULL), table->stats_last_recalc)
|
||||
< MIN_RECALC_INTERVAL) {
|
||||
|
||||
/* Stats were (re)calculated not long ago. To avoid
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 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
|
||||
@ -858,7 +859,7 @@ eval_predefined(
|
||||
dfield_get_data(que_node_get_val(arg1)));
|
||||
|
||||
} else if (func == PARS_SYSDATE_TOKEN) {
|
||||
int_val = (lint) ut_time();
|
||||
int_val = (lint) time(NULL);
|
||||
} else {
|
||||
eval_predefined_2(func_node);
|
||||
|
||||
|
@ -5128,7 +5128,7 @@ fil_load_single_table_tablespaces(ibool (*pred)(const char*, const char*))
|
||||
ulint dbpath_len = 100;
|
||||
ulint files_read = 0;
|
||||
ulint files_read_at_last_check = 0;
|
||||
ib_time_t prev_report_time = ut_time();
|
||||
time_t prev_report_time = time(NULL);
|
||||
os_file_dir_t dir;
|
||||
os_file_dir_t dbdir;
|
||||
os_file_stat_t dbinfo;
|
||||
@ -5228,11 +5228,10 @@ fil_load_single_table_tablespaces(ibool (*pred)(const char*, const char*))
|
||||
files_read++;
|
||||
if (files_read - files_read_at_last_check >
|
||||
CHECK_TIME_EVERY_N_FILES) {
|
||||
ib_time_t cur_time= ut_time();
|
||||
time_t cur_time= time(NULL);
|
||||
files_read_at_last_check= files_read;
|
||||
double time_elapsed= ut_difftime(cur_time,
|
||||
prev_report_time);
|
||||
if (time_elapsed > 15) {
|
||||
if (cur_time - prev_report_time
|
||||
> 15) {
|
||||
ib_logf(IB_LOG_LEVEL_INFO,
|
||||
"Processed %ld .ibd/.isl files",
|
||||
files_read);
|
||||
|
@ -77,8 +77,8 @@ UNIV_INTERN ulong fts_min_token_size;
|
||||
|
||||
|
||||
// FIXME: testing
|
||||
ib_time_t elapsed_time = 0;
|
||||
ulint n_nodes = 0;
|
||||
static time_t elapsed_time;
|
||||
static ulint n_nodes;
|
||||
|
||||
/** Error condition reported by fts_utf8_decode() */
|
||||
const ulint UTF8_ERROR = 0xFFFFFFFF;
|
||||
@ -3798,7 +3798,7 @@ fts_write_node(
|
||||
pars_info_t* info;
|
||||
dberr_t error;
|
||||
ib_uint32_t doc_count;
|
||||
ib_time_t start_time;
|
||||
time_t start_time;
|
||||
doc_id_t last_doc_id;
|
||||
doc_id_t first_doc_id;
|
||||
char table_name[MAX_FULL_NAME_LEN];
|
||||
@ -3845,9 +3845,9 @@ fts_write_node(
|
||||
" :last_doc_id, :doc_count, :ilist);");
|
||||
}
|
||||
|
||||
start_time = ut_time();
|
||||
start_time = time(NULL);
|
||||
error = fts_eval_sql(trx, *graph);
|
||||
elapsed_time += ut_time() - start_time;
|
||||
elapsed_time += time(NULL) - start_time;
|
||||
++n_nodes;
|
||||
|
||||
return(error);
|
||||
@ -4298,7 +4298,7 @@ fts_sync_begin(
|
||||
n_nodes = 0;
|
||||
elapsed_time = 0;
|
||||
|
||||
sync->start_time = ut_time();
|
||||
sync->start_time = time(NULL);
|
||||
|
||||
sync->trx = trx_allocate_for_background();
|
||||
|
||||
@ -4457,7 +4457,7 @@ fts_sync_commit(
|
||||
"SYNC for table %s: SYNC time : %lu secs: "
|
||||
"elapsed %lf ins/sec",
|
||||
sync->table->name,
|
||||
(ulong) (ut_time() - sync->start_time),
|
||||
(ulong) (time(NULL) - sync->start_time),
|
||||
(double) n_nodes/ (double) elapsed_time);
|
||||
}
|
||||
|
||||
|
@ -1648,7 +1648,7 @@ fts_optimize_get_index_start_time(
|
||||
/*==============================*/
|
||||
trx_t* trx, /*!< in: transaction */
|
||||
dict_index_t* index, /*!< in: FTS index */
|
||||
ib_time_t* start_time) /*!< out: time in secs */
|
||||
time_t* start_time) /*!< out: time in secs */
|
||||
{
|
||||
return(fts_config_get_index_ulint(
|
||||
trx, index, FTS_OPTIMIZE_START_TIME,
|
||||
@ -1664,7 +1664,7 @@ fts_optimize_set_index_start_time(
|
||||
/*==============================*/
|
||||
trx_t* trx, /*!< in: transaction */
|
||||
dict_index_t* index, /*!< in: FTS index */
|
||||
ib_time_t start_time) /*!< in: start time */
|
||||
time_t start_time) /*!< in: start time */
|
||||
{
|
||||
return(fts_config_set_index_ulint(
|
||||
trx, index, FTS_OPTIMIZE_START_TIME,
|
||||
@ -1918,7 +1918,7 @@ fts_optimize_index_completed(
|
||||
dberr_t error;
|
||||
byte buf[sizeof(ulint)];
|
||||
#ifdef FTS_OPTIMIZE_DEBUG
|
||||
ib_time_t end_time = ut_time();
|
||||
time_t end_time = time(NULL);
|
||||
|
||||
error = fts_optimize_set_index_end_time(optim->trx, index, end_time);
|
||||
#endif
|
||||
@ -2337,14 +2337,14 @@ fts_optimize_indexes(
|
||||
/* Start time will be 0 only for the first time or after
|
||||
completing the optimization of all FTS indexes. */
|
||||
if (start_time == 0) {
|
||||
start_time = ut_time();
|
||||
start_time = time(NULL);
|
||||
|
||||
error = fts_optimize_set_index_start_time(
|
||||
optim->trx, index, start_time);
|
||||
}
|
||||
|
||||
/* Check if this index needs to be optimized or not. */
|
||||
if (ut_difftime(end_time, start_time) < 0) {
|
||||
if (difftime(end_time, start_time) < 0) {
|
||||
error = fts_optimize_index(optim, index);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
@ -2416,7 +2416,7 @@ fts_optimize_reset_start_time(
|
||||
for (uint i = 0; i < ib_vector_size(fts->indexes); ++i) {
|
||||
dict_index_t* index;
|
||||
|
||||
ib_time_t start_time = 0;
|
||||
time_t start_time = 0;
|
||||
|
||||
/* Reset the start time to 0 for this index. */
|
||||
error = fts_optimize_set_index_start_time(
|
||||
@ -2471,7 +2471,7 @@ fts_optimize_table_bk(
|
||||
&& table->fts->cache->deleted >= FTS_OPTIMIZE_THRESHOLD) {
|
||||
error = fts_optimize_table(table);
|
||||
|
||||
slot->last_run = ut_time();
|
||||
slot->last_run = time(NULL);
|
||||
|
||||
if (error == DB_SUCCESS) {
|
||||
slot->running = false;
|
||||
@ -3001,7 +3001,7 @@ fts_optimize_init(void)
|
||||
|
||||
fts_optimize_wq = ib_wqueue_create();
|
||||
ut_a(fts_optimize_wq != NULL);
|
||||
last_check_sync_time = ut_time();
|
||||
last_check_sync_time = time(NULL);
|
||||
|
||||
os_thread_create(fts_optimize_thread, fts_optimize_wq, NULL);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2012, Facebook Inc.
|
||||
Copyright (c) 2013, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2013, 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
|
||||
@ -1198,7 +1198,7 @@ struct dict_table_t{
|
||||
goes to zero. If it's -1, means there's DDL
|
||||
on the table, DML from memcached will be
|
||||
blocked. */
|
||||
ib_time_t stats_last_recalc;
|
||||
time_t stats_last_recalc;
|
||||
/*!< Timestamp of last recalc of the stats */
|
||||
ib_uint32_t stat_persistent;
|
||||
/*!< The two bits below are set in the
|
||||
|
@ -431,7 +431,7 @@ struct recv_sys_t{
|
||||
log record, or there is a log parsing
|
||||
buffer overflow */
|
||||
/** the time when progress was last reported */
|
||||
ib_time_t progress_time;
|
||||
time_t progress_time;
|
||||
#ifdef UNIV_LOG_ARCHIVE
|
||||
log_group_t* archive_group;
|
||||
/*!< in archive recovery: the log group whose
|
||||
@ -449,7 +449,7 @@ struct recv_sys_t{
|
||||
@param[in] time the current time
|
||||
@return whether progress should be reported
|
||||
(the last report was at least 15 seconds ago) */
|
||||
bool report(ib_time_t time)
|
||||
bool report(time_t time)
|
||||
{
|
||||
if (time - progress_time < 15) {
|
||||
return false;
|
||||
|
@ -58,9 +58,9 @@ create the internal counter ID in "monitor_id_t". */
|
||||
|
||||
/** Structure containing the actual values of a monitor counter. */
|
||||
struct monitor_value_t {
|
||||
ib_time_t mon_start_time; /*!< Start time of monitoring */
|
||||
ib_time_t mon_stop_time; /*!< Stop time of monitoring */
|
||||
ib_time_t mon_reset_time; /*!< Time counter resetted */
|
||||
time_t mon_start_time; /*!< Start time of monitoring */
|
||||
time_t mon_stop_time; /*!< Stop time of monitoring */
|
||||
time_t mon_reset_time; /*!< Time of resetting the counter */
|
||||
mon_type_t mon_value; /*!< Current counter Value */
|
||||
mon_type_t mon_max_value; /*!< Current Max value */
|
||||
mon_type_t mon_min_value; /*!< Current Min value */
|
||||
|
@ -129,7 +129,7 @@ struct i_s_trx_row_t {
|
||||
trx_id_t trx_id; /*!< transaction identifier */
|
||||
const char* trx_state; /*!< transaction state from
|
||||
trx_get_que_state_str() */
|
||||
ib_time_t trx_started; /*!< trx_t::start_time */
|
||||
time_t trx_started; /*!< trx_t::start_time */
|
||||
const i_s_locks_row_t* requested_lock_row;
|
||||
/*!< pointer to a row
|
||||
in innodb_locks if trx
|
||||
|
@ -51,9 +51,6 @@ Created 1/20/1994 Heikki Tuuri
|
||||
/** Index name prefix in fast index creation, as a string constant */
|
||||
#define TEMP_INDEX_PREFIX_STR "\377"
|
||||
|
||||
/** Time stamp */
|
||||
typedef time_t ib_time_t;
|
||||
|
||||
/* In order to call a piece of code, when a function returns or when the
|
||||
scope ends, use this utility class. It will invoke the given function
|
||||
object in its destructor. */
|
||||
@ -227,14 +224,6 @@ store the given number of bits.
|
||||
@return number of bytes (octets) needed to represent b */
|
||||
#define UT_BITS_IN_BYTES(b) (((b) + 7) / 8)
|
||||
|
||||
/**********************************************************//**
|
||||
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 */
|
||||
UNIV_INTERN
|
||||
ib_time_t
|
||||
ut_time(void);
|
||||
/*=========*/
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
/**********************************************************//**
|
||||
Returns the number of milliseconds since some epoch. The
|
||||
@ -256,17 +245,6 @@ UNIV_INTERN
|
||||
ulint
|
||||
ut_time_ms(void);
|
||||
/*============*/
|
||||
|
||||
/**********************************************************//**
|
||||
Returns the difference of two times in seconds.
|
||||
@return time2 - time1 expressed in seconds */
|
||||
UNIV_INTERN
|
||||
double
|
||||
ut_difftime(
|
||||
/*========*/
|
||||
ib_time_t time2, /*!< in: time */
|
||||
ib_time_t time1); /*!< in: time */
|
||||
|
||||
#endif /* !UNIV_INNOCHECKSUM */
|
||||
|
||||
/**********************************************************//**
|
||||
|
@ -2310,7 +2310,7 @@ lock_rec_create(
|
||||
/* Set the bit corresponding to rec */
|
||||
lock_rec_set_nth_bit(lock, heap_no);
|
||||
|
||||
lock->requested_time = ut_time();
|
||||
lock->requested_time = time(NULL);
|
||||
lock->wait_time = 0;
|
||||
|
||||
index->table->n_rec_locks++;
|
||||
@ -3085,16 +3085,18 @@ lock_grant(
|
||||
}
|
||||
}
|
||||
|
||||
const time_t now = time(NULL);
|
||||
|
||||
/* Cumulate total lock wait time for statistics */
|
||||
if (lock_get_type_low(lock) & LOCK_TABLE) {
|
||||
lock->trx->total_table_lock_wait_time +=
|
||||
(ulint)difftime(ut_time(), lock->trx->lock.wait_started);
|
||||
(ulint)difftime(now, lock->trx->lock.wait_started);
|
||||
} else {
|
||||
lock->trx->total_rec_lock_wait_time +=
|
||||
(ulint)difftime(ut_time(), lock->trx->lock.wait_started);
|
||||
(ulint)difftime(now, lock->trx->lock.wait_started);
|
||||
}
|
||||
|
||||
lock->wait_time = (ulint)difftime(ut_time(), lock->requested_time);
|
||||
lock->wait_time = (ulint)difftime(now, lock->requested_time);
|
||||
|
||||
if (!owns_trx_mutex) {
|
||||
trx_mutex_exit(lock->trx);
|
||||
@ -4997,7 +4999,7 @@ lock_table_create(
|
||||
|
||||
lock->type_mode = type_mode | LOCK_TABLE;
|
||||
lock->trx = trx;
|
||||
lock->requested_time = ut_time();
|
||||
lock->requested_time = time(NULL);
|
||||
lock->wait_time = 0;
|
||||
|
||||
lock->un_member.tab_lock.table = table;
|
||||
|
@ -74,7 +74,7 @@ lock_wait_table_print(void)
|
||||
(ulong) slot->in_use,
|
||||
(ulong) slot->suspended,
|
||||
slot->wait_timeout,
|
||||
(ulong) difftime(ut_time(), slot->suspend_time));
|
||||
(ulong) difftime(time(NULL), slot->suspend_time));
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ lock_wait_table_reserve_slot(
|
||||
|
||||
os_event_reset(slot->event);
|
||||
slot->suspended = TRUE;
|
||||
slot->suspend_time = ut_time();
|
||||
slot->suspend_time = time(NULL);
|
||||
slot->wait_timeout = wait_timeout;
|
||||
|
||||
if (slot == lock_sys->last_slot) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2009, Google Inc.
|
||||
Copyright (c) 2014, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2014, 2019, MariaDB Corporation.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
@ -2591,7 +2591,8 @@ loop:
|
||||
start_lsn += len;
|
||||
buf += len;
|
||||
|
||||
if (recv_recovery_is_on() && recv_sys && recv_sys->report(ut_time())) {
|
||||
if (recv_recovery_is_on() && recv_sys
|
||||
&& recv_sys->report(time(NULL))) {
|
||||
ib_logf(IB_LOG_LEVEL_INFO, "Read redo log up to LSN=" LSN_PF,
|
||||
start_lsn);
|
||||
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
|
||||
|
@ -419,7 +419,7 @@ recv_sys_init(
|
||||
recv_sys->last_block_buf_start, OS_FILE_LOG_BLOCK_SIZE));
|
||||
|
||||
recv_sys->found_corrupt_log = FALSE;
|
||||
recv_sys->progress_time = ut_time();
|
||||
recv_sys->progress_time = time(NULL);
|
||||
|
||||
recv_max_page_lsn = 0;
|
||||
|
||||
@ -1789,7 +1789,7 @@ recv_recover_page_func(
|
||||
|
||||
mtr_commit(&mtr);
|
||||
|
||||
ib_time_t time = ut_time();
|
||||
time_t now = time(NULL);
|
||||
|
||||
mutex_enter(&(recv_sys->mutex));
|
||||
|
||||
@ -1801,7 +1801,7 @@ recv_recover_page_func(
|
||||
|
||||
ut_a(recv_sys->n_addrs > 0);
|
||||
if (ulint n = --recv_sys->n_addrs) {
|
||||
if (recv_sys->report(time)) {
|
||||
if (recv_sys->report(now)) {
|
||||
ib_logf(IB_LOG_LEVEL_INFO,
|
||||
"To recover: " ULINTPF " pages from log", n);
|
||||
service_manager_extend_timeout(
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2009, Percona Inc.
|
||||
Copyright (c) 2013, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2013, 2019, MariaDB Corporation.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted
|
||||
by Percona Inc.. Those modifications are
|
||||
@ -4509,7 +4509,7 @@ os_aio_init(
|
||||
|
||||
os_aio_validate();
|
||||
|
||||
os_last_printout = ut_time();
|
||||
os_last_printout = time(NULL);
|
||||
|
||||
#ifdef _WIN32
|
||||
ut_a(completion_port == 0 && read_completion_port == 0);
|
||||
@ -4837,7 +4837,7 @@ found:
|
||||
}
|
||||
|
||||
slot->reserved = TRUE;
|
||||
slot->reservation_time = ut_time();
|
||||
slot->reservation_time = time(NULL);
|
||||
slot->message1 = message1;
|
||||
slot->message2 = message2;
|
||||
slot->file = file;
|
||||
@ -5979,7 +5979,7 @@ restart:
|
||||
if (slot->reserved) {
|
||||
|
||||
age = (ulint) difftime(
|
||||
ut_time(), slot->reservation_time);
|
||||
time(NULL), slot->reservation_time);
|
||||
|
||||
if ((age >= 2 && age > biggest_age)
|
||||
|| (age >= 2 && age == biggest_age
|
||||
@ -6392,7 +6392,7 @@ os_aio_print(
|
||||
}
|
||||
|
||||
putc('\n', file);
|
||||
current_time = ut_time();
|
||||
current_time = time(NULL);
|
||||
time_elapsed = 0.001 + difftime(current_time, os_last_printout);
|
||||
|
||||
fprintf(file,
|
||||
|
@ -2168,10 +2168,11 @@ DECLARE_THREAD(srv_monitor_thread)(void*)
|
||||
pfs_register_thread(srv_monitor_thread_key);
|
||||
#endif /* UNIV_PFS_THREAD */
|
||||
|
||||
srv_last_monitor_time = ut_time();
|
||||
last_table_monitor_time = ut_time();
|
||||
last_tablespace_monitor_time = ut_time();
|
||||
last_monitor_time = ut_time();
|
||||
current_time = time(NULL);
|
||||
srv_last_monitor_time = current_time;
|
||||
last_table_monitor_time = current_time;
|
||||
last_tablespace_monitor_time = current_time;
|
||||
last_monitor_time = current_time;
|
||||
mutex_skipped = 0;
|
||||
last_srv_print_monitor = srv_print_innodb_monitor;
|
||||
loop:
|
||||
@ -2182,12 +2183,12 @@ loop:
|
||||
|
||||
os_event_wait_time_low(srv_monitor_event, 5000000, sig_count);
|
||||
|
||||
current_time = ut_time();
|
||||
current_time = time(NULL);
|
||||
|
||||
time_elapsed = difftime(current_time, last_monitor_time);
|
||||
|
||||
if (time_elapsed > 15) {
|
||||
last_monitor_time = ut_time();
|
||||
last_monitor_time = current_time;
|
||||
|
||||
if (srv_print_innodb_monitor) {
|
||||
/* Reset mutex_skipped counter everytime
|
||||
@ -2234,7 +2235,7 @@ loop:
|
||||
if (srv_print_innodb_tablespace_monitor
|
||||
&& difftime(current_time,
|
||||
last_tablespace_monitor_time) > 60) {
|
||||
last_tablespace_monitor_time = ut_time();
|
||||
last_tablespace_monitor_time = current_time;
|
||||
|
||||
fputs("========================"
|
||||
"========================\n",
|
||||
@ -2260,7 +2261,7 @@ loop:
|
||||
if (srv_print_innodb_table_monitor
|
||||
&& difftime(current_time, last_table_monitor_time) > 60) {
|
||||
|
||||
last_table_monitor_time = ut_time();
|
||||
last_table_monitor_time = current_time;
|
||||
|
||||
fprintf(stderr, "Warning: %s\n",
|
||||
DEPRECATED_MSG_INNODB_TABLE_MONITOR);
|
||||
@ -2854,20 +2855,16 @@ static
|
||||
void
|
||||
srv_shutdown_print_master_pending(
|
||||
/*==============================*/
|
||||
ib_time_t* last_print_time, /*!< last time the function
|
||||
time_t* last_print_time, /*!< last time the function
|
||||
print the message */
|
||||
ulint n_tables_to_drop, /*!< number of tables to
|
||||
be dropped */
|
||||
ulint n_bytes_merged) /*!< number of change buffer
|
||||
just merged */
|
||||
{
|
||||
ib_time_t current_time;
|
||||
double time_elapsed;
|
||||
time_t current_time = time(NULL);
|
||||
|
||||
current_time = ut_time();
|
||||
time_elapsed = ut_difftime(current_time, *last_print_time);
|
||||
|
||||
if (time_elapsed > 60) {
|
||||
if (difftime(current_time, *last_print_time) > 60) {
|
||||
*last_print_time = current_time;
|
||||
|
||||
if (n_tables_to_drop) {
|
||||
@ -2902,7 +2899,7 @@ void
|
||||
srv_master_do_active_tasks(void)
|
||||
/*============================*/
|
||||
{
|
||||
ib_time_t cur_time = ut_time();
|
||||
time_t cur_time = time(NULL);
|
||||
ulonglong counter_time = microsecond_interval_timer();
|
||||
ulint n_evicted = 0;
|
||||
|
||||
@ -3058,7 +3055,7 @@ srv_master_do_idle_tasks(void)
|
||||
|
||||
if (srv_log_arch_expire_sec) {
|
||||
srv_main_thread_op_info = "purging archived logs";
|
||||
purge_archived_logs(ut_time() - srv_log_arch_expire_sec,
|
||||
purge_archived_logs(time(NULL) - srv_log_arch_expire_sec,
|
||||
0);
|
||||
}
|
||||
}
|
||||
@ -3071,7 +3068,7 @@ srv_shutdown(bool ibuf_merge)
|
||||
{
|
||||
ulint n_bytes_merged = 0;
|
||||
ulint n_tables_to_drop;
|
||||
ib_time_t now = ut_time();
|
||||
time_t now = time(NULL);
|
||||
|
||||
do {
|
||||
ut_ad(!srv_read_only_mode);
|
||||
@ -3232,10 +3229,10 @@ srv_purge_should_exit(ulint n_purged)
|
||||
/* Slow shutdown was requested. */
|
||||
if (n_purged) {
|
||||
#if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY
|
||||
static ib_time_t progress_time;
|
||||
ib_time_t time = ut_time();
|
||||
if (time - progress_time >= 15) {
|
||||
progress_time = time;
|
||||
static time_t progress_time;
|
||||
time_t now = time(NULL);
|
||||
if (now - progress_time >= 15) {
|
||||
progress_time = now;
|
||||
service_manager_extend_timeout(
|
||||
INNODB_EXTEND_TIMEOUT_INTERVAL,
|
||||
"InnoDB: to purge " ULINTPF " transactions",
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2008, Google Inc.
|
||||
Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
|
||||
Copyright (c) 2013, 2019, MariaDB Corporation.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
@ -414,7 +414,7 @@ sync_array_reserve_cell(
|
||||
event = sync_cell_get_event(cell);
|
||||
cell->signal_count = os_event_reset(event);
|
||||
|
||||
cell->reservation_time = ut_time();
|
||||
cell->reservation_time = time(NULL);
|
||||
|
||||
cell->thread = os_thread_get_curr_id();
|
||||
|
||||
|
@ -750,11 +750,11 @@ trx_roll_must_shutdown()
|
||||
return true;
|
||||
}
|
||||
|
||||
ib_time_t time = ut_time();
|
||||
time_t now = time(NULL);
|
||||
mutex_enter(&trx_sys->mutex);
|
||||
mutex_enter(&recv_sys->mutex);
|
||||
|
||||
if (recv_sys->report(time)) {
|
||||
if (recv_sys->report(now)) {
|
||||
ulint n_trx = 0;
|
||||
ulonglong n_rows = 0;
|
||||
for (const trx_t* t = UT_LIST_GET_FIRST(trx_sys->rw_trx_list);
|
||||
|
@ -1106,7 +1106,7 @@ trx_start_low(
|
||||
|
||||
mutex_exit(&trx_sys->mutex);
|
||||
|
||||
trx->start_time = ut_time();
|
||||
trx->start_time = time(NULL);
|
||||
|
||||
trx->start_time_micro = trx->mysql_thd
|
||||
? thd_query_start_micro(trx->mysql_thd)
|
||||
|
@ -45,21 +45,6 @@ Created 5/11/1994 Heikki Tuuri
|
||||
# include "ha_prototypes.h"
|
||||
# include "mysql_com.h" /* NAME_LEN */
|
||||
# include <string>
|
||||
#endif /* UNIV_HOTBACKUP */
|
||||
|
||||
/**********************************************************//**
|
||||
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 */
|
||||
UNIV_INTERN
|
||||
ib_time_t
|
||||
ut_time(void)
|
||||
/*=========*/
|
||||
{
|
||||
return(time(NULL));
|
||||
}
|
||||
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
/**********************************************************//**
|
||||
Returns the number of milliseconds since some epoch. The
|
||||
value may wrap around. It should only be used for heuristic
|
||||
@ -73,20 +58,6 @@ ut_time_ms(void)
|
||||
return static_cast<ulint>(my_interval_timer() / 1000000);
|
||||
}
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
|
||||
/**********************************************************//**
|
||||
Returns the difference of two times in seconds.
|
||||
@return time2 - time1 expressed in seconds */
|
||||
UNIV_INTERN
|
||||
double
|
||||
ut_difftime(
|
||||
/*========*/
|
||||
ib_time_t time2, /*!< in: time */
|
||||
ib_time_t time1) /*!< in: time */
|
||||
{
|
||||
return(difftime(time2, time1));
|
||||
}
|
||||
|
||||
#endif /* !UNIV_INNOCHECKSUM */
|
||||
|
||||
/**********************************************************//**
|
||||
|
Loading…
x
Reference in New Issue
Block a user