Push event handlers to constituent modules

This commit is contained in:
Yinan Zhang
2020-04-17 10:38:06 -07:00
parent 381c97caa4
commit b06dfb9ccc
8 changed files with 78 additions and 57 deletions

View File

@@ -1493,11 +1493,6 @@ stats_print(write_cb_t *write_cb, void *cbopaque, const char *opts) {
emitter_end(&emitter);
}
bool
stats_interval_accum(tsd_t *tsd, uint64_t bytes) {
return counter_accum(tsd_tsdn(tsd), &stats_interval_accumulated, bytes);
}
uint64_t
stats_interval_new_event_wait(tsd_t *tsd) {
return stats_interval_accum_batch;
@@ -1508,6 +1503,15 @@ stats_interval_postponed_event_wait(tsd_t *tsd) {
return TE_MIN_START_WAIT;
}
void
stats_interval_event_handler(tsd_t *tsd, uint64_t elapsed) {
assert(elapsed > 0 && elapsed != TE_INVALID_ELAPSED);
if (counter_accum(tsd_tsdn(tsd), &stats_interval_accumulated,
elapsed)) {
je_malloc_stats_print(NULL, NULL, opt_stats_interval_opts);
}
}
bool
stats_boot(void) {
uint64_t stats_interval;