summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2014-03-10 11:23:41 -0400
committerKeith Bostic <keith@wiredtiger.com>2014-03-10 11:23:41 -0400
commit10cefad93d4a85819a0c74ca0470f41e57f8661d (patch)
tree7d614a2205fe3fa28704d7e412d2d3443d888453 /src
parentc50ed83f1c0f5e142fa5d260f3bc0b595de21982 (diff)
downloadmongo-10cefad93d4a85819a0c74ca0470f41e57f8661d.tar.gz
Add statistics to show just how much prefix/suffix compression are
buying us.
Diffstat (limited to 'src')
-rw-r--r--src/btree/rec_write.c9
-rw-r--r--src/include/stat.h2
-rw-r--r--src/include/wiredtiger.in12
-rw-r--r--src/support/stat.c8
4 files changed, 26 insertions, 5 deletions
diff --git a/src/btree/rec_write.c b/src/btree/rec_write.c
index 92da02c268e..2524ec9ccfd 100644
--- a/src/btree/rec_write.c
+++ b/src/btree/rec_write.c
@@ -1437,7 +1437,11 @@ __rec_split_row_promote(WT_SESSION_IMPL *session, WT_RECONCILE *r, uint8_t type)
size = len + 1;
for (cnt = 1; len > 0; ++cnt, --len, ++pa, ++pb)
if (*pa != *pb) {
- size = cnt;
+ if (size != cnt) {
+ WT_STAT_FAST_DATA_INCRV(session,
+ rec_suffix_compression, size - cnt);
+ size = cnt;
+ }
break;
}
} else
@@ -4455,6 +4459,9 @@ __rec_cell_build_leaf_key(WT_SESSION_IMPL *session,
*/
if (pfx < btree->prefix_compression_min)
pfx = 0;
+ else
+ WT_STAT_FAST_DATA_INCRV(
+ session, rec_prefix_compression, pfx);
}
/* Copy the non-prefix bytes into the key buffer. */
diff --git a/src/include/stat.h b/src/include/stat.h
index 63db0e65d52..e00b9ee40db 100644
--- a/src/include/stat.h
+++ b/src/include/stat.h
@@ -287,7 +287,9 @@ struct __wt_dsrc_stats {
WT_STATS rec_page_match;
WT_STATS rec_pages;
WT_STATS rec_pages_eviction;
+ WT_STATS rec_prefix_compression;
WT_STATS rec_skipped_update;
+ WT_STATS rec_suffix_compression;
WT_STATS session_compact;
WT_STATS session_cursor_open;
WT_STATS txn_update_conflict;
diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in
index a78edd61983..20c1466dff2 100644
--- a/src/include/wiredtiger.in
+++ b/src/include/wiredtiger.in
@@ -2943,14 +2943,18 @@ extern int wiredtiger_extension_terminate(WT_CONNECTION *connection);
#define WT_STAT_DSRC_REC_PAGES 2078
/*! page reconciliation calls for eviction */
#define WT_STAT_DSRC_REC_PAGES_EVICTION 2079
+/*! leaf page key bytes discarded using prefix compression */
+#define WT_STAT_DSRC_REC_PREFIX_COMPRESSION 2080
/*! reconciliation failed because an update could not be included */
-#define WT_STAT_DSRC_REC_SKIPPED_UPDATE 2080
+#define WT_STAT_DSRC_REC_SKIPPED_UPDATE 2081
+/*! internal page key bytes discarded using suffix compression */
+#define WT_STAT_DSRC_REC_SUFFIX_COMPRESSION 2082
/*! object compaction */
-#define WT_STAT_DSRC_SESSION_COMPACT 2081
+#define WT_STAT_DSRC_SESSION_COMPACT 2083
/*! open cursor count */
-#define WT_STAT_DSRC_SESSION_CURSOR_OPEN 2082
+#define WT_STAT_DSRC_SESSION_CURSOR_OPEN 2084
/*! update conflicts */
-#define WT_STAT_DSRC_TXN_UPDATE_CONFLICT 2083
+#define WT_STAT_DSRC_TXN_UPDATE_CONFLICT 2085
/*! @} */
/*
* Statistics section: END
diff --git a/src/support/stat.c b/src/support/stat.c
index 6fb7de125a9..7a52b3c5a90 100644
--- a/src/support/stat.c
+++ b/src/support/stat.c
@@ -111,8 +111,12 @@ __wt_stat_init_dsrc_stats(WT_DSRC_STATS *stats)
stats->rec_pages.desc = "page reconciliation calls";
stats->rec_pages_eviction.desc =
"page reconciliation calls for eviction";
+ stats->rec_prefix_compression.desc =
+ "leaf page key bytes discarded using prefix compression";
stats->rec_skipped_update.desc =
"reconciliation failed because an update could not be included";
+ stats->rec_suffix_compression.desc =
+ "internal page key bytes discarded using suffix compression";
stats->session_compact.desc = "object compaction";
stats->session_cursor_open.desc = "open cursor count";
stats->txn_update_conflict.desc = "update conflicts";
@@ -204,7 +208,9 @@ __wt_stat_refresh_dsrc_stats(void *stats_arg)
stats->rec_page_match.v = 0;
stats->rec_pages.v = 0;
stats->rec_pages_eviction.v = 0;
+ stats->rec_prefix_compression.v = 0;
stats->rec_skipped_update.v = 0;
+ stats->rec_suffix_compression.v = 0;
stats->session_compact.v = 0;
stats->txn_update_conflict.v = 0;
}
@@ -289,7 +295,9 @@ __wt_stat_aggregate_dsrc_stats(const void *child, const void *parent)
p->rec_page_match.v += c->rec_page_match.v;
p->rec_pages.v += c->rec_pages.v;
p->rec_pages_eviction.v += c->rec_pages_eviction.v;
+ p->rec_prefix_compression.v += c->rec_prefix_compression.v;
p->rec_skipped_update.v += c->rec_skipped_update.v;
+ p->rec_suffix_compression.v += c->rec_suffix_compression.v;
p->session_compact.v += c->session_compact.v;
p->session_cursor_open.v += c->session_cursor_open.v;
p->txn_update_conflict.v += c->txn_update_conflict.v;