diff options
author | Alex Gorrod <alexg@wiredtiger.com> | 2012-10-10 09:11:44 +1100 |
---|---|---|
committer | Alex Gorrod <alexg@wiredtiger.com> | 2012-10-10 09:11:44 +1100 |
commit | cdc0b2462fe39d8d2d62f58bbe7de3578e7d508a (patch) | |
tree | be89b115463501c3b2f9eff2635e449ae1349faa | |
parent | fe41d088600ee2e0dc0dc4c5db4527ee5f17ef5f (diff) | |
download | mongo-cdc0b2462fe39d8d2d62f58bbe7de3578e7d508a.tar.gz |
Add an eviction statistic to file and LSM statistics cursors.
-rw-r--r-- | dist/stat_data.py | 6 | ||||
-rw-r--r-- | src/btree/bt_evict.c | 1 | ||||
-rw-r--r-- | src/include/stat.h | 6 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 82 | ||||
-rw-r--r-- | src/lsm/lsm_stat.c | 17 | ||||
-rw-r--r-- | src/support/stat.c | 15 |
6 files changed, 75 insertions, 52 deletions
diff --git a/dist/stat_data.py b/dist/stat_data.py index 2c436a38bf5..2b91606b041 100644 --- a/dist/stat_data.py +++ b/dist/stat_data.py @@ -80,6 +80,7 @@ btree_stats = [ Stat('file_write_conflicts', 'write generation conflicts'), Stat('free', 'file: block frees'), Stat('overflow_read', 'file: overflow pages read from the file'), + Stat('page_evict', 'file: pages evicted from the file'), Stat('page_read', 'file: pages read from the file'), Stat('page_write', 'file: pages written to the file'), Stat('rec_dictionary', 'reconcile: dictionary match'), @@ -98,16 +99,17 @@ btree_stats = [ # LSM statistics ########################################## lsm_stats = [ + Stat('chunk_cache_evict', 'Number of pages evicted from LSM chunks'), Stat('chunk_cache_read', 'Number of pages read into LSM chunks'), - Stat('chunk_cache_write', 'Number of pages written from chunks'), Stat('bloom_hits', 'Number of successful bloom filter lookups'), Stat('bloom_misses', 'Number of successful bloom filter false positives'), Stat('bloom_skips', 'Number of unsuccessful bloom filter lookups'), Stat('bloom_space', 'Total space used by bloom filters'), + Stat('bloom_cache_evict', 'Number of bloom pages evicted from cache'), Stat('bloom_cache_read', 'Number of bloom pages read into cache'), - Stat('bloom_cache_write', 'Number of bloom pages written from cache'), Stat('chunk_count', 'Number of chunks in the LSM tree'), Stat('bloom_count', 'Number of bloom filters in the LSM tree'), + Stat('cache_evict', 'Number of pages evicted from cache'), Stat('cache_read', 'Number of pages read into cache'), Stat('cache_write', 'Number of pages written from cache'), ] diff --git a/src/btree/bt_evict.c b/src/btree/bt_evict.c index 6ba8d6efb2c..064e1b096f6 100644 --- a/src/btree/bt_evict.c +++ b/src/btree/bt_evict.c @@ -965,6 +965,7 @@ __wt_evict_lru_page(WT_SESSION_IMPL *session, int is_app) WT_SET_BTREE_IN_SESSION(session, btree); ret = __evict_page(session, page); + WT_BSTAT_INCR(session, page_evict); (void)WT_ATOMIC_SUB(btree->lru_count, 1); diff --git a/src/include/stat.h b/src/include/stat.h index a2656acd6ed..d61f8d334bc 100644 --- a/src/include/stat.h +++ b/src/include/stat.h @@ -70,6 +70,7 @@ struct __wt_btree_stats { WT_STATS extend; WT_STATS free; WT_STATS overflow_read; + WT_STATS page_evict; WT_STATS page_read; WT_STATS page_write; WT_STATS file_size; @@ -134,13 +135,14 @@ struct __wt_connection_stats { */ struct __wt_lsm_stats { WT_STATS bloom_count; + WT_STATS bloom_cache_evict; WT_STATS bloom_cache_read; - WT_STATS bloom_cache_write; WT_STATS chunk_count; + WT_STATS chunk_cache_evict; + WT_STATS cache_evict; WT_STATS chunk_cache_read; WT_STATS cache_read; WT_STATS cache_write; - WT_STATS chunk_cache_write; WT_STATS bloom_misses; WT_STATS bloom_hits; WT_STATS bloom_skips; diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index 071f5f36bc5..048efdd0b74 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -1726,60 +1726,62 @@ extern int wiredtiger_extension_init(WT_SESSION *session, #define WT_STAT_free 15 /*! file: overflow pages read from the file */ #define WT_STAT_overflow_read 16 +/*! file: pages evicted from the file */ +#define WT_STAT_page_evict 17 /*! file: pages read from the file */ -#define WT_STAT_page_read 17 +#define WT_STAT_page_read 18 /*! file: pages written to the file */ -#define WT_STAT_page_write 18 +#define WT_STAT_page_write 19 /*! file: size */ -#define WT_STAT_file_size 19 +#define WT_STAT_file_size 20 /*! fixed-record size */ -#define WT_STAT_file_fixed_len 20 +#define WT_STAT_file_fixed_len 21 /*! magic number */ -#define WT_STAT_file_magic 21 +#define WT_STAT_file_magic 22 /*! major version number */ -#define WT_STAT_file_major 22 +#define WT_STAT_file_major 23 /*! maximum internal page item size */ -#define WT_STAT_file_maxintlitem 23 +#define WT_STAT_file_maxintlitem 24 /*! maximum internal page size */ -#define WT_STAT_file_maxintlpage 24 +#define WT_STAT_file_maxintlpage 25 /*! maximum leaf page item size */ -#define WT_STAT_file_maxleafitem 25 +#define WT_STAT_file_maxleafitem 26 /*! maximum leaf page size */ -#define WT_STAT_file_maxleafpage 26 +#define WT_STAT_file_maxleafpage 27 /*! minor version number */ -#define WT_STAT_file_minor 27 +#define WT_STAT_file_minor 28 /*! overflow pages */ -#define WT_STAT_file_overflow 28 +#define WT_STAT_file_overflow 29 /*! page size allocation unit */ -#define WT_STAT_file_allocsize 29 +#define WT_STAT_file_allocsize 30 /*! reconcile: deleted or temporary pages merged */ -#define WT_STAT_rec_page_merge 30 +#define WT_STAT_rec_page_merge 31 /*! reconcile: dictionary match */ -#define WT_STAT_rec_dictionary 31 +#define WT_STAT_rec_dictionary 32 /*! reconcile: internal pages split */ -#define WT_STAT_rec_split_intl 32 +#define WT_STAT_rec_split_intl 33 /*! reconcile: leaf pages split */ -#define WT_STAT_rec_split_leaf 33 +#define WT_STAT_rec_split_leaf 34 /*! reconcile: overflow key */ -#define WT_STAT_rec_ovfl_key 34 +#define WT_STAT_rec_ovfl_key 35 /*! reconcile: overflow value */ -#define WT_STAT_rec_ovfl_value 35 +#define WT_STAT_rec_ovfl_value 36 /*! reconcile: pages deleted */ -#define WT_STAT_rec_page_delete 36 +#define WT_STAT_rec_page_delete 37 /*! reconcile: pages written */ -#define WT_STAT_rec_written 37 +#define WT_STAT_rec_written 38 /*! reconcile: unable to acquire hazard reference */ -#define WT_STAT_rec_hazard 38 +#define WT_STAT_rec_hazard 39 /*! row-store internal pages */ -#define WT_STAT_file_row_int_pages 39 +#define WT_STAT_file_row_int_pages 40 /*! row-store leaf pages */ -#define WT_STAT_file_row_leaf_pages 40 +#define WT_STAT_file_row_leaf_pages 41 /*! total entries */ -#define WT_STAT_file_entries 41 +#define WT_STAT_file_entries 42 /*! update conflicts */ -#define WT_STAT_update_conflict 42 +#define WT_STAT_update_conflict 43 /*! write generation conflicts */ -#define WT_STAT_file_write_conflicts 43 +#define WT_STAT_file_write_conflicts 44 /*! @} */ /*! @@ -1790,28 +1792,30 @@ extern int wiredtiger_extension_init(WT_SESSION *session, */ /*! Number of bloom filters in the LSM tree */ #define WT_STAT_bloom_count 0 +/*! Number of bloom pages evicted from cache */ +#define WT_STAT_bloom_cache_evict 1 /*! Number of bloom pages read into cache */ -#define WT_STAT_bloom_cache_read 1 -/*! Number of bloom pages written from cache */ -#define WT_STAT_bloom_cache_write 2 +#define WT_STAT_bloom_cache_read 2 /*! Number of chunks in the LSM tree */ #define WT_STAT_chunk_count 3 +/*! Number of pages evicted from LSM chunks */ +#define WT_STAT_chunk_cache_evict 4 +/*! Number of pages evicted from cache */ +#define WT_STAT_cache_evict 5 /*! Number of pages read into LSM chunks */ -#define WT_STAT_chunk_cache_read 4 +#define WT_STAT_chunk_cache_read 6 /*! Number of pages read into cache */ -#define WT_STAT_cache_read 5 +#define WT_STAT_cache_read 7 /*! Number of pages written from cache */ -#define WT_STAT_cache_write 6 -/*! Number of pages written from chunks */ -#define WT_STAT_chunk_cache_write 7 +#define WT_STAT_cache_write 8 /*! Number of successful bloom filter false positives */ -#define WT_STAT_bloom_misses 8 +#define WT_STAT_bloom_misses 9 /*! Number of successful bloom filter lookups */ -#define WT_STAT_bloom_hits 9 +#define WT_STAT_bloom_hits 10 /*! Number of unsuccessful bloom filter lookups */ -#define WT_STAT_bloom_skips 10 +#define WT_STAT_bloom_skips 11 /*! Total space used by bloom filters */ -#define WT_STAT_bloom_space 11 +#define WT_STAT_bloom_space 12 /*! @} */ /* * Statistics section: END diff --git a/src/lsm/lsm_stat.c b/src/lsm/lsm_stat.c index ea64441acdf..eb41c9769f4 100644 --- a/src/lsm/lsm_stat.c +++ b/src/lsm/lsm_stat.c @@ -42,7 +42,6 @@ __wt_lsm_stat_init( WT_STAT_SET(lsm_tree->stats, chunk_cache_read, 0); WT_STAT_SET(lsm_tree->stats, cache_read, 0); WT_STAT_SET(lsm_tree->stats, cache_write, 0); - WT_STAT_SET(lsm_tree->stats, chunk_cache_write, 0); WT_STAT_SET(lsm_tree->stats, bloom_space, 0); /* Grab a snapshot of the LSM tree chunks. */ @@ -65,6 +64,12 @@ __wt_lsm_stat_init( WT_ERR(__wt_curstat_open(session, uri, F_ISSET(chunk, WT_LSM_CHUNK_ONDISK) ? disk_cfg : cfg, &stat_cursor)); + stat_cursor->set_key(stat_cursor, WT_STAT_page_evict); + stat_cursor->search(stat_cursor); + WT_ERR(stat_cursor->get_value( + stat_cursor, &desc, &pvalue, &value)); + WT_STAT_INCRV(lsm_tree->stats, cache_evict, value); + WT_STAT_INCRV(lsm_tree->stats, chunk_cache_evict, value); stat_cursor->set_key(stat_cursor, WT_STAT_page_read); stat_cursor->search(stat_cursor); WT_ERR(stat_cursor->get_value( @@ -76,7 +81,6 @@ __wt_lsm_stat_init( WT_ERR(stat_cursor->get_value( stat_cursor, &desc, &pvalue, &value)); WT_STAT_INCRV(lsm_tree->stats, cache_write, value); - WT_STAT_INCRV(lsm_tree->stats, chunk_cache_write, value); stat_cursor->close(stat_cursor); if (chunk->bloom_uri != NULL) { @@ -92,6 +96,13 @@ __wt_lsm_stat_init( chunk->bloom_uri); WT_ERR(__wt_curstat_open(session, uri, cfg, &stat_cursor)); + stat_cursor->set_key(stat_cursor, WT_STAT_page_evict); + stat_cursor->search(stat_cursor); + WT_ERR(stat_cursor->get_value( + stat_cursor, &desc, &pvalue, &value)); + WT_STAT_INCRV(lsm_tree->stats, cache_evict, value); + WT_STAT_INCRV(lsm_tree->stats, + bloom_cache_evict, value); stat_cursor->set_key(stat_cursor, WT_STAT_page_read); stat_cursor->search(stat_cursor); WT_ERR(stat_cursor->get_value( @@ -104,8 +115,6 @@ __wt_lsm_stat_init( WT_ERR(stat_cursor->get_value( stat_cursor, &desc, &pvalue, &value)); WT_STAT_INCRV(lsm_tree->stats, cache_write, value); - WT_STAT_INCRV(lsm_tree->stats, - bloom_cache_write, value); stat_cursor->close(stat_cursor); } } diff --git a/src/support/stat.c b/src/support/stat.c index 7cc5b33ff71..331330a38ee 100644 --- a/src/support/stat.c +++ b/src/support/stat.c @@ -42,6 +42,7 @@ __wt_stat_alloc_btree_stats(WT_SESSION_IMPL *session, WT_BTREE_STATS **statsp) stats->file_write_conflicts.desc = "write generation conflicts"; stats->free.desc = "file: block frees"; stats->overflow_read.desc = "file: overflow pages read from the file"; + stats->page_evict.desc = "file: pages evicted from the file"; stats->page_read.desc = "file: pages read from the file"; stats->page_write.desc = "file: pages written to the file"; stats->rec_dictionary.desc = "reconcile: dictionary match"; @@ -99,6 +100,7 @@ __wt_stat_clear_btree_stats(WT_STATS *stats_arg) stats->file_write_conflicts.v = 0; stats->free.v = 0; stats->overflow_read.v = 0; + stats->page_evict.v = 0; stats->page_read.v = 0; stats->page_write.v = 0; stats->rec_dictionary.v = 0; @@ -190,9 +192,9 @@ __wt_stat_alloc_lsm_stats(WT_SESSION_IMPL *session, WT_LSM_STATS **statsp) WT_RET(__wt_calloc_def(session, 1, &stats)); + stats->bloom_cache_evict.desc = + "Number of bloom pages evicted from cache"; stats->bloom_cache_read.desc = "Number of bloom pages read into cache"; - stats->bloom_cache_write.desc = - "Number of bloom pages written from cache"; stats->bloom_count.desc = "Number of bloom filters in the LSM tree"; stats->bloom_hits.desc = "Number of successful bloom filter lookups"; stats->bloom_misses.desc = @@ -200,10 +202,12 @@ __wt_stat_alloc_lsm_stats(WT_SESSION_IMPL *session, WT_LSM_STATS **statsp) stats->bloom_skips.desc = "Number of unsuccessful bloom filter lookups"; stats->bloom_space.desc = "Total space used by bloom filters"; + stats->cache_evict.desc = "Number of pages evicted from cache"; stats->cache_read.desc = "Number of pages read into cache"; stats->cache_write.desc = "Number of pages written from cache"; + stats->chunk_cache_evict.desc = + "Number of pages evicted from LSM chunks"; stats->chunk_cache_read.desc = "Number of pages read into LSM chunks"; - stats->chunk_cache_write.desc = "Number of pages written from chunks"; stats->chunk_count.desc = "Number of chunks in the LSM tree"; *statsp = stats; @@ -216,16 +220,17 @@ __wt_stat_clear_lsm_stats(WT_STATS *stats_arg) WT_LSM_STATS *stats; stats = (WT_LSM_STATS *)stats_arg; + stats->bloom_cache_evict.v = 0; stats->bloom_cache_read.v = 0; - stats->bloom_cache_write.v = 0; stats->bloom_count.v = 0; stats->bloom_hits.v = 0; stats->bloom_misses.v = 0; stats->bloom_skips.v = 0; stats->bloom_space.v = 0; + stats->cache_evict.v = 0; stats->cache_read.v = 0; stats->cache_write.v = 0; + stats->chunk_cache_evict.v = 0; stats->chunk_cache_read.v = 0; - stats->chunk_cache_write.v = 0; stats->chunk_count.v = 0; } |