Commit b4d376d9 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

Merge all the changes from tokudb.2370. We hope to deprecate 2370.

{{{
svn merge -r17811:18633 https://svn.tokutek.com/tokudb/toku/tokudb.2370
}}}
Refs #2370. [t:2370]


git-svn-id: file:///svn/toku/tokudb@18637 c7de825b-a66e-492c-adef-691d508d4ae1
parent 416e8c43
......@@ -213,6 +213,8 @@ int toku_brt_zombie_needed (BRT brt);
int toku_brt_get_fragmentation(BRT brt, TOKU_DB_FRAGMENTATION report);
double get_tdiff(void) __attribute__((__visibility__("default")));
//TODO: #1485 once we have multiple main threads, restore this code, analyze performance.
#ifndef TOKU_MULTIPLE_MAIN_THREADS
#define TOKU_MULTIPLE_MAIN_THREADS 0
......
......@@ -582,6 +582,20 @@ void toku_logger_trim_log_files (TOKULOGGER logger, BOOL trim_log_files)
logger->trim_log_files = trim_log_files;
}
double get_tdiff(void) {
static struct timeval prev={0,0};
if (prev.tv_sec==0) {
gettimeofday(&prev, 0);
return 0.0;
} else {
struct timeval now;
gettimeofday(&now, 0);
double diff = now.tv_sec - prev.tv_sec + 1e-6*(now.tv_usec - prev.tv_usec);
prev = now;
return diff;
}
}
int toku_logger_maybe_fsync (TOKULOGGER logger, LSN lsn, int do_fsync)
// Effect: If fsync is nonzero, then make sure that the log is flushed and synced at least up to lsn.
// Entry: Holds input lock. The log entry has already been written to the input buffer.
......
......@@ -65,6 +65,9 @@
toku_set_assert_on_write_enospc;
test_db_redirect_dictionary;
get_tdiff;
local: *;
};
......@@ -83,8 +83,11 @@ get_fsync_count (void) {
static int
do_fsync (int fd) {
//fprintf(stderr, "%8.6fs Thread %ld start fsyncing\n", get_tdiff(), pthread_self());
inc_fsync_count();
return fsync(fd);
int r = fsync(fd);
//fprintf(stderr, "%8.6fs Thread %ld done fsyncing\n", get_tdiff(), pthread_self());
return r;
}
static const char *progname;
......
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