diff options
author | Keith Bostic <keith@wiredtiger.com> | 2013-10-14 09:17:49 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2013-10-14 09:17:49 -0400 |
commit | ee8ce507f9c2f8d199667be863fd8e5fcc37ca00 (patch) | |
tree | 5742ef3b8b0ee1d6a7a908604542e3577164e985 /src/lsm/lsm_stat.c | |
parent | 235b46dc03b17a7fce53a61f64843035197e2c3c (diff) | |
parent | b1d0cad611867157c7b13a0db7fcc4f2fb2cc3e9 (diff) | |
download | mongo-ee8ce507f9c2f8d199667be863fd8e5fcc37ca00.tar.gz |
Merge branch 'develop' into statistics-split
Conflicts:
src/btree/bt_io.c
src/include/stat.h
src/lsm/lsm_stat.c
src/schema/schema_stat.c
Diffstat (limited to 'src/lsm/lsm_stat.c')
-rw-r--r-- | src/lsm/lsm_stat.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/src/lsm/lsm_stat.c b/src/lsm/lsm_stat.c index 0b99c7d5242..c9c522c57bd 100644 --- a/src/lsm/lsm_stat.c +++ b/src/lsm/lsm_stat.c @@ -18,7 +18,7 @@ __wt_lsm_stat_init(WT_SESSION_IMPL *session, WT_CURSOR *stat_cursor; WT_DECL_ITEM(uribuf); WT_DECL_RET; - WT_DSRC_STATS *child, *stats; + WT_DSRC_STATS *new, *stats; WT_LSM_CHUNK *chunk; u_int i; int locked; @@ -49,16 +49,13 @@ __wt_lsm_stat_init(WT_SESSION_IMPL *session, *p++ = "statistics_fast=true"; /* - * Allocate an aggregated statistics structure, or clear any already - * allocated one. + * Set the cursor to reference the data source statistics; we don't + * initialize it, instead we copy (rather than aggregate), the first + * chunk's statistics, which has the same effect. */ - if ((stats = (WT_DSRC_STATS *)cst->stats) == NULL) { - WT_ERR(__wt_calloc_def(session, 1, &stats)); - __wt_stat_init_dsrc_stats(stats); - cst->stats_first = cst->stats = (WT_STATS *)stats; - cst->stats_count = sizeof(*stats) / sizeof(WT_STATS); - } else - __wt_stat_clear_dsrc_stats(stats); + stats = &cst->u.dsrc_stats; + cst->stats_first = cst->stats = (WT_STATS *)stats; + cst->stats_count = sizeof(WT_DSRC_STATS) / sizeof(WT_STATS); /* Hold the LSM lock so that we can safely walk through the chunks. */ WT_ERR(__wt_readlock(session, lsm_tree->rwlock)); @@ -94,10 +91,18 @@ __wt_lsm_stat_init(WT_SESSION_IMPL *session, * values from the chunk's information, then aggregate into the * top-level. */ - child = (WT_DSRC_STATS *)WT_CURSOR_STATS(stat_cursor); - WT_STAT_SET(child, lsm_generation_max, chunk->generation); + new = (WT_DSRC_STATS *)WT_CURSOR_STATS(stat_cursor); + WT_STAT_SET(new, lsm_generation_max, chunk->generation); - __wt_stat_aggregate_dsrc_stats(child, stats); + /* + * We want to aggregate the table's statistics. Get a base set + * of statistics from the first chunk, then aggregate statistics + * from each new chunk. + */ + if (i == 0) + *stats = *new; + else + __wt_stat_aggregate_dsrc_stats(new, stats); WT_ERR(stat_cursor->close(stat_cursor)); if (!F_ISSET(chunk, WT_LSM_CHUNK_BLOOM)) @@ -117,22 +122,22 @@ __wt_lsm_stat_init(WT_SESSION_IMPL *session, * values from the bloom filter's information, then aggregate * into the top-level. */ - child = (WT_DSRC_STATS *)WT_CURSOR_STATS(stat_cursor); - WT_STAT_SET(child, + new = (WT_DSRC_STATS *)WT_CURSOR_STATS(stat_cursor); + WT_STAT_SET(new, bloom_size, (chunk->count * lsm_tree->bloom_bit_count) / 8); - WT_STAT_SET(child, bloom_page_evict, - WT_STAT(child, cache_eviction_clean) + - WT_STAT(child, cache_eviction_dirty)); - WT_STAT_SET(child, bloom_page_read, WT_STAT(child, cache_read)); + WT_STAT_SET(new, bloom_page_evict, + WT_STAT(new, cache_eviction_clean) + + WT_STAT(new, cache_eviction_dirty)); + WT_STAT_SET(new, bloom_page_read, WT_STAT(new, cache_read)); - __wt_stat_aggregate_dsrc_stats(child, stats); + __wt_stat_aggregate_dsrc_stats(new, stats); WT_ERR(stat_cursor->close(stat_cursor)); } /* Aggregate, and optionally clear, LSM-level specific information. */ __wt_stat_aggregate_dsrc_stats(&lsm_tree->stats, stats); if (LF_ISSET(WT_STATISTICS_CLEAR)) - __wt_stat_clear_dsrc_stats(&lsm_tree->stats); + __wt_stat_refresh_dsrc_stats(&lsm_tree->stats); err: if (locked) WT_TRET(__wt_rwunlock(session, lsm_tree->rwlock)); |