mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 21:23:06 +00:00
[thread_event] Remove macros from thread_event and replace with dynamic event objects
This commit is contained in:
committed by
Guangli Dai
parent
1972241cd2
commit
e6864c6075
22
src/stats.c
22
src/stats.c
@@ -65,7 +65,7 @@ char opt_stats_interval_opts[stats_print_tot_num_options+1] = "";
|
||||
|
||||
static counter_accum_t stats_interval_accumulated;
|
||||
/* Per thread batch accum size for stats_interval. */
|
||||
static uint64_t stats_interval_accum_batch;
|
||||
uint64_t stats_interval_accum_batch;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
@@ -2128,7 +2128,12 @@ stats_interval_postponed_event_wait(tsd_t *tsd) {
|
||||
}
|
||||
|
||||
void
|
||||
stats_interval_event_handler(tsd_t *tsd, uint64_t elapsed) {
|
||||
stats_interval_event_handler(tsd_t *tsd) {
|
||||
uint64_t last_event = thread_allocated_last_event_get(tsd);
|
||||
uint64_t last_sample_event = tsd_stats_interval_last_event_get(tsd);
|
||||
tsd_stats_interval_last_event_set(tsd, last_event);
|
||||
uint64_t elapsed = last_event - last_sample_event;
|
||||
|
||||
assert(elapsed > 0 && elapsed != TE_INVALID_ELAPSED);
|
||||
if (counter_accum(tsd_tsdn(tsd), &stats_interval_accumulated,
|
||||
elapsed)) {
|
||||
@@ -2136,6 +2141,19 @@ stats_interval_event_handler(tsd_t *tsd, uint64_t elapsed) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
stats_interval_enabled(void) {
|
||||
return opt_stats_interval >= 0;
|
||||
}
|
||||
|
||||
te_base_cb_t stats_interval_te_handler = {
|
||||
.enabled = &stats_interval_enabled,
|
||||
.new_event_wait = &stats_interval_new_event_wait,
|
||||
.postponed_event_wait = &stats_interval_postponed_event_wait,
|
||||
.event_handler = &stats_interval_event_handler,
|
||||
};
|
||||
|
||||
|
||||
bool
|
||||
stats_boot(void) {
|
||||
uint64_t stats_interval;
|
||||
|
||||
Reference in New Issue
Block a user