summaryrefslogtreecommitdiff
path: root/src/txn
diff options
context:
space:
mode:
authorSulabh Mahajan <sulabh.mahajan@mongodb.com>2016-06-08 17:20:33 +1000
committerAlex Gorrod <alexander.gorrod@mongodb.com>2016-06-08 17:20:33 +1000
commit37cffe90333b1217ab13ac3f22d645aa4de2dbbb (patch)
treedaaae8085af4b92cc6dcbcdfe47516bfd8e55962 /src/txn
parentc2db6bad7ad373e7445a9f0498074c6ec6bde443 (diff)
downloadmongo-37cffe90333b1217ab13ac3f22d645aa4de2dbbb.tar.gz
WT-2319 Add stats to measure count and duration of the sync calls made for log and checkpoint modules (#2784)
Diffstat (limited to 'src/txn')
-rw-r--r--src/txn/txn_ckpt.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c
index c1b435d9897..2930856fd7c 100644
--- a/src/txn/txn_ckpt.c
+++ b/src/txn/txn_ckpt.c
@@ -350,6 +350,7 @@ __checkpoint_verbose_track(WT_SESSION_IMPL *session,
static int
__txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[])
{
+ struct timespec fsync_start, fsync_stop;
struct timespec start, stop, verb_timer;
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
@@ -359,6 +360,7 @@ __txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[])
WT_TXN_STATE *txn_state;
void *saved_meta_next;
u_int i;
+ uint64_t fsync_duration_usecs;
bool full, idle, logging, tracking;
const char *txn_cfg[] = { WT_CONFIG_BASE(session,
WT_SESSION_begin_transaction), "isolation=snapshot", NULL };
@@ -424,7 +426,13 @@ __txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[])
* completion. Do it after flushing the pages to give the
* asynchronous flush as much time as possible before we wait.
*/
+ WT_ERR(__wt_epoch(session, &fsync_start));
WT_ERR(__checkpoint_apply(session, cfg, __wt_checkpoint_sync));
+ WT_ERR(__wt_epoch(session, &fsync_stop));
+ fsync_duration_usecs = WT_TIMEDIFF_US(fsync_stop, fsync_start);
+ WT_STAT_FAST_CONN_INCR(session, txn_fsync_pre);
+ WT_STAT_FAST_CONN_INCRV(session,
+ txn_fsync_pre_duration, fsync_duration_usecs);
/* Tell logging that we are about to start a database checkpoint. */
if (full && logging)
@@ -523,7 +531,13 @@ __txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[])
* Checkpoints have to hit disk (it would be reasonable to configure for
* lazy checkpoints, but we don't support them yet).
*/
+ WT_ERR(__wt_epoch(session, &fsync_start));
WT_ERR(__checkpoint_apply(session, cfg, __wt_checkpoint_sync));
+ WT_ERR(__wt_epoch(session, &fsync_stop));
+ fsync_duration_usecs = WT_TIMEDIFF_US(fsync_stop, fsync_start);
+ WT_STAT_FAST_CONN_INCR(session, txn_fsync_post);
+ WT_STAT_FAST_CONN_INCRV(session,
+ txn_fsync_post_duration, fsync_duration_usecs);
WT_ERR(__checkpoint_verbose_track(session,
"sync completed", &verb_timer));