Commit 02029a83 authored by John Esmet's avatar John Esmet Committed by Yoni Fogel

refs #5710 add toku_current_time_nanosec, rename current_time_usec to use...

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
parent 2c3d5ca1
......@@ -1042,10 +1042,10 @@ bool toku_ftnode_pf_req_callback(void* ftnode_pv, void* read_extraargs) {
static void
ft_status_update_partial_fetch_reason(
struct ftnode_fetch_extra* UU(bfe),
int UU(i),
int UU(state),
bool UU(is_leaf)
struct ftnode_fetch_extra* bfe,
int childnum,
enum pt_state state,
bool is_leaf
)
{
invariant(state == PT_COMPRESSED || state == PT_ON_DISK);
......@@ -1062,7 +1062,7 @@ ft_status_update_partial_fetch_reason(
} else {
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) {
STATUS_INC(FT_NUM_BASEMENTS_DECOMPRESSED_NORMAL, 1);
} else {
......@@ -1089,7 +1089,7 @@ ft_status_update_partial_fetch_reason(
} else {
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) {
STATUS_INC(FT_NUM_MSG_BUFFER_DECOMPRESSED_NORMAL, 1);
} else {
......
......@@ -336,7 +336,7 @@ void toku_set_func_fsync(int (*fsync_function)(int)) {
// keep trying if fsync fails because of EINTR
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;
while (r != 0) {
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);
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);
if (duration_p) {
*duration_p = duration;
......
......@@ -89,10 +89,17 @@ static inline tokutime_t get_tokutime (void) {
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;
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
......@@ -1763,7 +1763,7 @@ static void report_overall_fill_table_progress(int num_rows) {
static uint64_t last_report;
static double last_progress;
if (t0 == 0) {
t0 = toku_current_time_usec();
t0 = toku_current_time_microsec();
last_report = t0;
}
......@@ -1771,7 +1771,7 @@ static void report_overall_fill_table_progress(int num_rows) {
double progress = rows_so_far /
(rows_per_table * num_tables_to_fill * 1.0);
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.
// there is a race condition. it is probably harmless.
const uint64_t minimum_report_period = 5 * 1000000;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment