diff options
-rw-r--r-- | Mwrap.xs | 20 | ||||
-rw-r--r-- | mwrap_core.h | 23 |
2 files changed, 24 insertions, 19 deletions
@@ -130,26 +130,8 @@ CLEANUP: void mwrap_reset() -PREINIT: - struct cds_lfht *t; - struct cds_lfht_iter iter; - struct src_loc *l; CODE: - uatomic_set(&total_bytes_inc, 0); - uatomic_set(&total_bytes_dec, 0); - - rcu_read_lock(); - t = CMM_LOAD_SHARED(totals); - if (t) - cds_lfht_for_each_entry(t, &iter, l, hnode) { - uatomic_set(&l->total, 0); - uatomic_set(&l->allocations, 0); - uatomic_set(&l->frees, 0); - uatomic_set(&l->freed_bytes, 0); - uatomic_set(&l->age_total, 0); - uatomic_set(&l->max_lifespan, 0); - } - rcu_read_unlock(); + mwrap_reset(); Devel::Mwrap::SrcLoc mwrap_get(loc) diff --git a/mwrap_core.h b/mwrap_core.h index f2d5a09..730699a 100644 --- a/mwrap_core.h +++ b/mwrap_core.h @@ -835,6 +835,29 @@ out: --locating; } +static void mwrap_reset(void) +{ + struct cds_lfht *t; + struct cds_lfht_iter iter; + struct src_loc *l; + + uatomic_set(&total_bytes_inc, 0); + uatomic_set(&total_bytes_dec, 0); + + rcu_read_lock(); + t = CMM_LOAD_SHARED(totals); + if (t) + cds_lfht_for_each_entry(t, &iter, l, hnode) { + uatomic_set(&l->total, 0); + uatomic_set(&l->allocations, 0); + uatomic_set(&l->frees, 0); + uatomic_set(&l->freed_bytes, 0); + uatomic_set(&l->age_total, 0); + uatomic_set(&l->max_lifespan, 0); + } + rcu_read_unlock(); +} + __attribute__((constructor)) static void mwrap_ctor(void) { sigset_t set, old; |