diff options
author | Eric Wong <e@80x24.org> | 2022-12-10 01:55:16 +0000 |
---|---|---|
committer | Eric Wong <mwrap-perl@80x24.org> | 2022-12-10 02:09:26 +0000 |
commit | dd7f0f6218561d132f9d7450d9b27bdce7096460 (patch) | |
tree | b4b25e5e40f02365268c982be4aeca71ee5be80c | |
parent | fc7c66c1ebe28920f4232b6ac1234089cd090380 (diff) | |
download | mwrap-dd7f0f6218561d132f9d7450d9b27bdce7096460.tar.gz |
It'll be used for the C HTTP server.
-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; |