summaryrefslogtreecommitdiff
path: root/src/evict/evict_page.c
diff options
context:
space:
mode:
authorDavid Hows <howsdav@gmail.com>2017-05-26 12:29:42 +1000
committerGitHub <noreply@github.com>2017-05-26 12:29:42 +1000
commit4ac341a6860dfc45803b18721250bffd022c8387 (patch)
tree9f4dba258d196106a8071587f688ebed780857d8 /src/evict/evict_page.c
parentdb14d312f68769f358662f5ea7aa74d61b9cd35d (diff)
downloadmongo-4ac341a6860dfc45803b18721250bffd022c8387.tar.gz
WT-3258 Add timers tracking time spent on failed evictions of large p… (#3428)
Diffstat (limited to 'src/evict/evict_page.c')
-rw-r--r--src/evict/evict_page.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/evict/evict_page.c b/src/evict/evict_page.c
index 80aba818153..01818f106fc 100644
--- a/src/evict/evict_page.c
+++ b/src/evict/evict_page.c
@@ -55,10 +55,12 @@ __wt_page_release_evict(WT_SESSION_IMPL *session, WT_REF *ref)
WT_BTREE *btree;
WT_DECL_RET;
WT_PAGE *page;
+ struct timespec start, stop;
bool locked, too_big;
btree = S2BT(session);
page = ref->page;
+ __wt_epoch(session, &start);
/*
* Take some care with order of operations: if we release the hazard
@@ -75,19 +77,34 @@ __wt_page_release_evict(WT_SESSION_IMPL *session, WT_REF *ref)
(void)__wt_atomic_addv32(&btree->evict_busy, 1);
too_big = page->memory_footprint >= btree->splitmempage;
- if ((ret = __wt_evict(session, ref, false)) == 0) {
- if (too_big)
+
+ /*
+ * Track how long the call to evict took. If eviction is successful then
+ * we have one of two pairs of stats to increment.
+ */
+ ret = __wt_evict(session, ref, false);
+ __wt_epoch(session, &stop);
+ if (ret == 0) {
+ if (too_big) {
WT_STAT_CONN_INCR(session, cache_eviction_force);
- else
+ WT_STAT_CONN_INCRV(session, cache_eviction_force_time,
+ WT_TIMEDIFF_US(stop, start));
+ } else {
/*
* If the page isn't too big, we are evicting it because
* it had a chain of deleted entries that make traversal
* expensive.
*/
- WT_STAT_CONN_INCR(
- session, cache_eviction_force_delete);
- } else
+ WT_STAT_CONN_INCR(session, cache_eviction_force_delete);
+ WT_STAT_CONN_INCRV(session,
+ cache_eviction_force_delete_time,
+ WT_TIMEDIFF_US(stop, start));
+ }
+ } else {
WT_STAT_CONN_INCR(session, cache_eviction_force_fail);
+ WT_STAT_CONN_INCRV(session, cache_eviction_force_fail_time,
+ WT_TIMEDIFF_US(stop, start));
+ }
(void)__wt_atomic_subv32(&btree->evict_busy, 1);