Control idump and gdump with prof_active.

This commit is contained in:
Qi Wang 2018-04-06 13:45:37 -07:00 committed by Qi Wang
parent 6d02421730
commit 2dccf45640
4 changed files with 14 additions and 14 deletions

View File

@ -25,7 +25,7 @@ static inline bool
arena_prof_accum(tsdn_t *tsdn, arena_t *arena, uint64_t accumbytes) {
cassert(config_prof);
if (likely(prof_interval == 0)) {
if (likely(prof_interval == 0 || !prof_active_get_unlocked())) {
return false;
}

View File

@ -69,4 +69,15 @@ prof_accum_cancel(tsdn_t *tsdn, prof_accum_t *prof_accum, size_t usize) {
#endif
}
JEMALLOC_ALWAYS_INLINE bool
prof_active_get_unlocked(void) {
/*
* Even if opt_prof is true, sampling can be temporarily disabled by
* setting prof_active to false. No locking is used when reading
* prof_active in the fast path, so there are no guarantees regarding
* how long it will take for all threads to notice state changes.
*/
return prof_active;
}
#endif /* JEMALLOC_INTERNAL_PROF_INLINES_A_H */

View File

@ -3,17 +3,6 @@
#include "jemalloc/internal/sz.h"
JEMALLOC_ALWAYS_INLINE bool
prof_active_get_unlocked(void) {
/*
* Even if opt_prof is true, sampling can be temporarily disabled by
* setting prof_active to false. No locking is used when reading
* prof_active in the fast path, so there are no guarantees regarding
* how long it will take for all threads to notice state changes.
*/
return prof_active;
}
JEMALLOC_ALWAYS_INLINE bool
prof_gdump_get_unlocked(void) {
/*

View File

@ -1780,7 +1780,7 @@ prof_idump(tsdn_t *tsdn) {
cassert(config_prof);
if (!prof_booted || tsdn_null(tsdn)) {
if (!prof_booted || tsdn_null(tsdn) || !prof_active_get_unlocked()) {
return;
}
tsd = tsdn_tsd(tsdn);
@ -1837,7 +1837,7 @@ prof_gdump(tsdn_t *tsdn) {
cassert(config_prof);
if (!prof_booted || tsdn_null(tsdn)) {
if (!prof_booted || tsdn_null(tsdn) || !prof_active_get_unlocked()) {
return;
}
tsd = tsdn_tsd(tsdn);