diff options
author | Alex Gorrod <alexg@wiredtiger.com> | 2014-06-25 18:22:28 +1000 |
---|---|---|
committer | Alex Gorrod <alexg@wiredtiger.com> | 2014-06-25 18:22:28 +1000 |
commit | c8f08c91bb01c8d29610fd89c031c3fa3ee4aca1 (patch) | |
tree | d22f5823512cea3e4f8bf9a90ee1dde8f603e034 /src/cursor/cur_stat.c | |
parent | cfc45cdae670e6411e6f3087d5075c8742f1b00a (diff) | |
download | mongo-c8f08c91bb01c8d29610fd89c031c3fa3ee4aca1.tar.gz |
Change from using separate fields to define stat states to flags.
We used to use stat_all, stat_fast and stat_clear. Now use flags.
Diffstat (limited to 'src/cursor/cur_stat.c')
-rw-r--r-- | src/cursor/cur_stat.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/cursor/cur_stat.c b/src/cursor/cur_stat.c index 9e4bf1df3f0..110897c4ab1 100644 --- a/src/cursor/cur_stat.c +++ b/src/cursor/cur_stat.c @@ -325,7 +325,7 @@ __curstat_conn_init(WT_SESSION_IMPL *session, WT_CURSOR_STAT *cst) */ __wt_conn_stat_init(session); cst->u.conn_stats = conn->stats; - if (cst->stat_clear) + if (F_ISSET(cst, WT_CONN_STAT_CLEAR)) __wt_stat_refresh_connection_stats(&conn->stats); cst->stats_first = cst->stats = (WT_STATS *)&cst->u.conn_stats; @@ -391,7 +391,7 @@ __curstat_file_init(WT_SESSION_IMPL *session, */ if ((ret = __wt_btree_stat_init(session, cst)) == 0) { cst->u.dsrc_stats = dhandle->stats; - if (cst->stat_clear) + if (F_ISSET(cst, WT_CONN_STAT_CLEAR)) __wt_stat_refresh_dsrc_stats(&dhandle->stats); __wt_curstat_dsrc_final(cst); } @@ -407,7 +407,7 @@ __curstat_file_init(WT_SESSION_IMPL *session, if (dhandle->checkpoint == NULL) { args.name = dhandle->name; args.stats = &cst->u.dsrc_stats; - args.clear = cst->stat_clear; + args.clear = F_ISSET(cst, WT_CONN_STAT_CLEAR); cfg_arg[0] = (char *)&args; /* @@ -518,39 +518,44 @@ __wt_curstat_open(WT_SESSION_IMPL *session, * Statistics cursor configuration: must match (and defaults to), the * database configuration. */ - if (conn->stat_all == 0 && conn->stat_fast == 0) + if (FLD_ISSET(conn->stat_flags, WT_CONN_STAT_NONE)) goto config_err; if ((ret = __wt_config_gets(session, cfg, "statistics", &cval)) == 0) { + /* Start with a valid setting, this will be overridden. */ + F_SET(cst, WT_CONN_STAT_NONE); if ((ret = __wt_config_subgets( session, &cval, "all", &sval)) == 0 && sval.val != 0) { - if (!conn->stat_all) + if (!FLD_ISSET(conn->stat_flags, WT_CONN_STAT_ALL)) goto config_err; - cst->stat_all = 1; + F_SET(cst, WT_CONN_STAT_ALL); } WT_ERR_NOTFOUND_OK(ret); if ((ret = __wt_config_subgets( session, &cval, "fast", &sval)) == 0 && sval.val != 0) { - if (cst->stat_all) + if (F_ISSET(cst, WT_CONN_STAT_ALL)) WT_ERR_MSG(session, EINVAL, "only one statistics configuration value " "may be specified"); - cst->stat_fast = 1; + F_SET(cst, WT_CONN_STAT_FAST); } WT_ERR_NOTFOUND_OK(ret); if ((ret = __wt_config_subgets( session, &cval, "clear", &sval)) == 0 && sval.val != 0) - cst->stat_clear = 1; + F_SET(cst, WT_CONN_STAT_CLEAR); WT_ERR_NOTFOUND_OK(ret); /* If no configuration, use the connection's configuration. */ - if (cst->stat_all == 0 && cst->stat_fast == 0) { - cst->stat_all = conn->stat_all; - cst->stat_fast = conn->stat_fast; + if (F_ISSET(cst, WT_CONN_STAT_NONE)) { + F_CLR(cst, WT_CONN_STAT_NONE); + if (FLD_ISSET(conn->stat_flags, WT_CONN_STAT_ALL)) + F_SET(cst, WT_CONN_STAT_ALL); + if (FLD_ISSET(conn->stat_flags, WT_CONN_STAT_FAST)) + F_SET(cst, WT_CONN_STAT_FAST); } /* If the connection configures clear, so do we. */ - if (conn->stat_clear) - cst->stat_clear = 1; + if (FLD_ISSET(conn->stat_flags, WT_CONN_STAT_CLEAR)) + F_SET(cst, WT_CONN_STAT_CLEAR); } /* |