Add forking handling for stats
This commit is contained in:
parent
508303077b
commit
f533ab6da6
@ -44,5 +44,8 @@ bool stats_interval_accum(tsd_t *tsd, uint64_t bytes);
|
|||||||
void stats_print(write_cb_t *write_cb, void *cbopaque, const char *opts);
|
void stats_print(write_cb_t *write_cb, void *cbopaque, const char *opts);
|
||||||
|
|
||||||
bool stats_boot(void);
|
bool stats_boot(void);
|
||||||
|
void stats_prefork(tsdn_t *tsdn);
|
||||||
|
void stats_postfork_parent(tsdn_t *tsdn);
|
||||||
|
void stats_postfork_child(tsdn_t *tsdn);
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_STATS_H */
|
#endif /* JEMALLOC_INTERNAL_STATS_H */
|
||||||
|
@ -3989,6 +3989,7 @@ _malloc_prefork(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
prof_prefork1(tsd_tsdn(tsd));
|
prof_prefork1(tsd_tsdn(tsd));
|
||||||
|
stats_prefork(tsd_tsdn(tsd));
|
||||||
tsd_prefork(tsd);
|
tsd_prefork(tsd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4016,6 +4017,7 @@ _malloc_postfork(void)
|
|||||||
|
|
||||||
witness_postfork_parent(tsd_witness_tsdp_get(tsd));
|
witness_postfork_parent(tsd_witness_tsdp_get(tsd));
|
||||||
/* Release all mutexes, now that fork() has completed. */
|
/* Release all mutexes, now that fork() has completed. */
|
||||||
|
stats_postfork_parent(tsd_tsdn(tsd));
|
||||||
for (i = 0, narenas = narenas_total_get(); i < narenas; i++) {
|
for (i = 0, narenas = narenas_total_get(); i < narenas; i++) {
|
||||||
arena_t *arena;
|
arena_t *arena;
|
||||||
|
|
||||||
@ -4045,6 +4047,7 @@ jemalloc_postfork_child(void) {
|
|||||||
|
|
||||||
witness_postfork_child(tsd_witness_tsdp_get(tsd));
|
witness_postfork_child(tsd_witness_tsdp_get(tsd));
|
||||||
/* Release all mutexes, now that fork() has completed. */
|
/* Release all mutexes, now that fork() has completed. */
|
||||||
|
stats_postfork_child(tsd_tsdn(tsd));
|
||||||
for (i = 0, narenas = narenas_total_get(); i < narenas; i++) {
|
for (i = 0, narenas = narenas_total_get(); i < narenas; i++) {
|
||||||
arena_t *arena;
|
arena_t *arena;
|
||||||
|
|
||||||
|
15
src/stats.c
15
src/stats.c
@ -1526,3 +1526,18 @@ stats_boot(void) {
|
|||||||
|
|
||||||
return counter_accum_init(&stats_interval_accumulated, stats_interval);
|
return counter_accum_init(&stats_interval_accumulated, stats_interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
stats_prefork(tsdn_t *tsdn) {
|
||||||
|
counter_prefork(tsdn, &stats_interval_accumulated);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
stats_postfork_parent(tsdn_t *tsdn) {
|
||||||
|
counter_postfork_parent(tsdn, &stats_interval_accumulated);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
stats_postfork_child(tsdn_t *tsdn) {
|
||||||
|
counter_postfork_child(tsdn, &stats_interval_accumulated);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user