summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/include/os_fhandle.i
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/src/include/os_fhandle.i')
-rw-r--r--src/third_party/wiredtiger/src/include/os_fhandle.i19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/third_party/wiredtiger/src/include/os_fhandle.i b/src/third_party/wiredtiger/src/include/os_fhandle.i
index e5177e64b57..5685b0f46dc 100644
--- a/src/third_party/wiredtiger/src/include/os_fhandle.i
+++ b/src/third_party/wiredtiger/src/include/os_fhandle.i
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2014-2017 MongoDB, Inc.
+ * Copyright (c) 2014-2018 MongoDB, Inc.
* Copyright (c) 2008-2014 WiredTiger, Inc.
* All rights reserved.
*
@@ -7,6 +7,13 @@
*/
/*
+ * Define functions that increment histogram statistics for filesystem
+ * operations latency.
+ */
+WT_STAT_MSECS_HIST_INCR_FUNC(fsread, perf_hist_fsread_latency, 10)
+WT_STAT_MSECS_HIST_INCR_FUNC(fswrite, perf_hist_fswrite_latency, 10)
+
+/*
* __wt_fsync --
* POSIX fsync.
*/
@@ -94,6 +101,7 @@ __wt_read(
WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t offset, size_t len, void *buf)
{
WT_DECL_RET;
+ uint64_t time_start, time_stop;
__wt_verbose(session, WT_VERB_HANDLEOPS,
"%s: handle-read: %" WT_SIZET_FMT " at %" PRIuMAX,
@@ -101,10 +109,14 @@ __wt_read(
WT_STAT_CONN_INCR_ATOMIC(session, thread_read_active);
WT_STAT_CONN_INCR(session, read_io);
+ time_start = __wt_rdtsc(session);
ret = fh->handle->fh_read(
fh->handle, (WT_SESSION *)session, offset, len, buf);
+ time_stop = __wt_rdtsc(session);
+ __wt_stat_msecs_hist_incr_fsread(session,
+ WT_TSCDIFF_MS(time_stop, time_start));
WT_STAT_CONN_DECR_ATOMIC(session, thread_read_active);
return (ret);
}
@@ -157,6 +169,7 @@ __wt_write(WT_SESSION_IMPL *session,
WT_FH *fh, wt_off_t offset, size_t len, const void *buf)
{
WT_DECL_RET;
+ uint64_t time_start, time_stop;
WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY) ||
WT_STRING_MATCH(fh->name,
@@ -175,10 +188,14 @@ __wt_write(WT_SESSION_IMPL *session,
WT_STAT_CONN_INCR(session, write_io);
WT_STAT_CONN_INCR_ATOMIC(session, thread_write_active);
+ time_start = __wt_rdtsc(session);
ret = fh->handle->fh_write(
fh->handle, (WT_SESSION *)session, offset, len, buf);
+ time_stop = __wt_rdtsc(session);
+ __wt_stat_msecs_hist_incr_fswrite(session,
+ WT_TSCDIFF_MS(time_stop, time_start));
WT_STAT_CONN_DECR_ATOMIC(session, thread_write_active);
return (ret);
}