diff options
author | Alex Gorrod <alexander.gorrod@mongodb.com> | 2016-10-18 15:14:27 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-18 15:14:27 +1100 |
commit | 940a7aba6a2c37f878114e8280eabf161a212deb (patch) | |
tree | 07da6e852354deb0ea455342590bffc682fdbc2e /src/btree/bt_io.c | |
parent | 349f5349eaaeab99f7a7178e03ab34f8ff0ebd0c (diff) | |
download | mongo-940a7aba6a2c37f878114e8280eabf161a212deb.tar.gz |
WT-2976 Add a statistic tracking how long app threads spend reading and writing (#3096)
Diffstat (limited to 'src/btree/bt_io.c')
-rw-r--r-- | src/btree/bt_io.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/btree/bt_io.c b/src/btree/bt_io.c index 42c3a849a88..a8645f79dbe 100644 --- a/src/btree/bt_io.c +++ b/src/btree/bt_io.c @@ -171,6 +171,7 @@ __wt_bt_write(WT_SESSION_IMPL *session, WT_ITEM *buf, uint8_t *addr, size_t *addr_sizep, bool checkpoint, bool checkpoint_io, bool compressed) { + struct timespec start, stop; WT_BM *bm; WT_BTREE *btree; WT_DECL_ITEM(ctmp); @@ -356,6 +357,8 @@ __wt_bt_write(WT_SESSION_IMPL *session, WT_ITEM *buf, data_checksum = !compressed; break; } + if (!F_ISSET(session, WT_SESSION_INTERNAL)) + __wt_epoch(session, &start); /* Call the block manager to write the block. */ WT_ERR(checkpoint ? @@ -363,6 +366,14 @@ __wt_bt_write(WT_SESSION_IMPL *session, WT_ITEM *buf, bm->write( bm, session, ip, addr, addr_sizep, data_checksum, checkpoint_io)); + /* Update some statistics now that the write is done */ + if (!F_ISSET(session, WT_SESSION_INTERNAL)) { + __wt_epoch(session, &stop); + WT_STAT_CONN_INCR(session, cache_write_app_count); + WT_STAT_CONN_INCRV(session, cache_write_app_time, + WT_TIMEDIFF_US(stop, start)); + } + WT_STAT_CONN_INCR(session, cache_write); WT_STAT_DATA_INCR(session, cache_write); S2C(session)->cache->bytes_written += dsk->mem_size; |