mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
refs #5710 add toku_current_time_nanosec, rename current_time_usec to use 'microsec' to be more consistent
git-svn-id: file:///svn/toku/tokudb@50454 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
b4f91e0727
commit
7962622c05
4 changed files with 19 additions and 12 deletions
12
ft/ft-ops.cc
12
ft/ft-ops.cc
|
@ -1042,10 +1042,10 @@ bool toku_ftnode_pf_req_callback(void* ftnode_pv, void* read_extraargs) {
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ft_status_update_partial_fetch_reason(
|
ft_status_update_partial_fetch_reason(
|
||||||
struct ftnode_fetch_extra* UU(bfe),
|
struct ftnode_fetch_extra* bfe,
|
||||||
int UU(i),
|
int childnum,
|
||||||
int UU(state),
|
enum pt_state state,
|
||||||
bool UU(is_leaf)
|
bool is_leaf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
invariant(state == PT_COMPRESSED || state == PT_ON_DISK);
|
invariant(state == PT_COMPRESSED || state == PT_ON_DISK);
|
||||||
|
@ -1062,7 +1062,7 @@ ft_status_update_partial_fetch_reason(
|
||||||
} else {
|
} else {
|
||||||
STATUS_INC(FT_NUM_BASEMENTS_FETCHED_WRITE, 1);
|
STATUS_INC(FT_NUM_BASEMENTS_FETCHED_WRITE, 1);
|
||||||
}
|
}
|
||||||
} else if (i == bfe->child_to_read) {
|
} else if (childnum == bfe->child_to_read) {
|
||||||
if (state == PT_COMPRESSED) {
|
if (state == PT_COMPRESSED) {
|
||||||
STATUS_INC(FT_NUM_BASEMENTS_DECOMPRESSED_NORMAL, 1);
|
STATUS_INC(FT_NUM_BASEMENTS_DECOMPRESSED_NORMAL, 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1089,7 +1089,7 @@ ft_status_update_partial_fetch_reason(
|
||||||
} else {
|
} else {
|
||||||
STATUS_INC(FT_NUM_MSG_BUFFER_FETCHED_WRITE, 1);
|
STATUS_INC(FT_NUM_MSG_BUFFER_FETCHED_WRITE, 1);
|
||||||
}
|
}
|
||||||
} else if (i == bfe->child_to_read) {
|
} else if (childnum == bfe->child_to_read) {
|
||||||
if (state == PT_COMPRESSED) {
|
if (state == PT_COMPRESSED) {
|
||||||
STATUS_INC(FT_NUM_MSG_BUFFER_DECOMPRESSED_NORMAL, 1);
|
STATUS_INC(FT_NUM_MSG_BUFFER_DECOMPRESSED_NORMAL, 1);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -336,7 +336,7 @@ void toku_set_func_fsync(int (*fsync_function)(int)) {
|
||||||
|
|
||||||
// keep trying if fsync fails because of EINTR
|
// keep trying if fsync fails because of EINTR
|
||||||
static void file_fsync_internal (int fd, uint64_t *duration_p) {
|
static void file_fsync_internal (int fd, uint64_t *duration_p) {
|
||||||
uint64_t tstart = toku_current_time_usec();
|
uint64_t tstart = toku_current_time_microsec();
|
||||||
int r = -1;
|
int r = -1;
|
||||||
while (r != 0) {
|
while (r != 0) {
|
||||||
if (t_fsync) {
|
if (t_fsync) {
|
||||||
|
@ -349,7 +349,7 @@ static void file_fsync_internal (int fd, uint64_t *duration_p) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toku_sync_fetch_and_add(&toku_fsync_count, 1);
|
toku_sync_fetch_and_add(&toku_fsync_count, 1);
|
||||||
uint64_t duration = toku_current_time_usec() - tstart;
|
uint64_t duration = toku_current_time_microsec() - tstart;
|
||||||
toku_sync_fetch_and_add(&toku_fsync_time, duration);
|
toku_sync_fetch_and_add(&toku_fsync_time, duration);
|
||||||
if (duration_p) {
|
if (duration_p) {
|
||||||
*duration_p = duration;
|
*duration_p = duration;
|
||||||
|
|
|
@ -89,10 +89,17 @@ static inline tokutime_t get_tokutime (void) {
|
||||||
return (uint64_t)hi << 32 | lo;
|
return (uint64_t)hi << 32 | lo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t toku_current_time_usec(void) {
|
static inline uint64_t toku_current_time_microsec(void) {
|
||||||
struct timeval t;
|
struct timeval t;
|
||||||
gettimeofday(&t, NULL);
|
gettimeofday(&t, NULL);
|
||||||
return t.tv_sec * 1000000UL + t.tv_usec;
|
return t.tv_sec * (1UL * 1000 * 1000) + t.tv_usec;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint64_t toku_current_time_nanosec(void) {
|
||||||
|
struct timespec t;
|
||||||
|
int r = toku_clock_gettime(CLOCK_REALTIME, &t);
|
||||||
|
invariant_zero(r);
|
||||||
|
return t.tv_sec * (1UL * 1000 * 1000 * 1000) + t.tv_nsec;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1763,7 +1763,7 @@ static void report_overall_fill_table_progress(int num_rows) {
|
||||||
static uint64_t last_report;
|
static uint64_t last_report;
|
||||||
static double last_progress;
|
static double last_progress;
|
||||||
if (t0 == 0) {
|
if (t0 == 0) {
|
||||||
t0 = toku_current_time_usec();
|
t0 = toku_current_time_microsec();
|
||||||
last_report = t0;
|
last_report = t0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1771,7 +1771,7 @@ static void report_overall_fill_table_progress(int num_rows) {
|
||||||
double progress = rows_so_far /
|
double progress = rows_so_far /
|
||||||
(rows_per_table * num_tables_to_fill * 1.0);
|
(rows_per_table * num_tables_to_fill * 1.0);
|
||||||
if (progress > (last_progress + .01)) {
|
if (progress > (last_progress + .01)) {
|
||||||
uint64_t t1 = toku_current_time_usec();
|
uint64_t t1 = toku_current_time_microsec();
|
||||||
// report no more often than once every 5 seconds, for less output.
|
// report no more often than once every 5 seconds, for less output.
|
||||||
// there is a race condition. it is probably harmless.
|
// there is a race condition. it is probably harmless.
|
||||||
const uint64_t minimum_report_period = 5 * 1000000;
|
const uint64_t minimum_report_period = 5 * 1000000;
|
||||||
|
|
Loading…
Add table
Reference in a new issue