Collaboration diagram for Storage Manager Statistics:
![]() |
Volumes can be analyzed to gather usage statistics. See ss_m::get_du_statistics and ss_m::get_volume_meta_stats.
Bulk-loading indexes gathers statistics about the bulk-load activity. See ss_m::bulkld_index and ss_m::bulkld_md_index.
All statistics are collected on a per-smthread_t basis (thus avoiding expensive atomic updates on a per-counter basis). Each smthread has its own local sm_stats_info_t structure for these statistics. Any time this structure is cleared, its contents are added to a single global statistics structure (protected by a mutex) before it is cleared. The clearing happens in two circumstances:
Thus, the single global statistics structure's contents reflect the activities of finished threads and of instrumented transactions' collected statistics, and all other activities are reflected in per-thread statistics structures.
A value-added server may collect the global statistics with the ss_m::gather_stats method. This method first adds together all the per-thread statistics, adds in the global statistics, and returns. The global statistics cannot be reset, and, indeed, they survive the storage manager so that they can be gathered after the storage manager shuts down. This means that to determine incremental statistics, the value-added server has to keep the prior copy of statistics and diff the current statistics from the prior statistics. The sm_stats_info_t has a difference operator to make this easy.
Instrumenting a transaction consists in allocating a structure in which to store the collected statistics, and passing in that structure to the storage manager using using the variants of begin_xct, commit_xct, etc that take an argument of this type.
When a transaction is detached from a thread, the statistics it gathered up to that point by the thread are added to the per-transaction statistics, and the thread statistics are cleared so they don't get over-counted.
A server may gather the per-transaction statistics for the attached running transaction with ss_m::gather_xct_stats.
A server may choose to reset the per-transaction statistics when it gathers them; this facilitates gathering incremental statistics. These counters aren't lost to the world, since their values were added to the global statistics before they were gathered in the first place.
Functions | |
static rc_t | ss_m::gather_stats (sm_stats_info_t &stats) |
Get a copy of the global statistics. |
static rc_t ss_m::gather_stats | ( | sm_stats_info_t & | stats | ) | [static, inherited] |
Get a copy of the global statistics.
[out] | stats | A pre-allocated structure. |