Skip to content

Commit

Permalink
add gflag to disable sampler thread (#1990)
Browse files Browse the repository at this point in the history
  • Loading branch information
leaf-potato authored Nov 14, 2022
1 parent 7209d4a commit 81b9397
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/bvar/detail/sampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,14 @@ Sampler::Sampler() : _used(true) {}

Sampler::~Sampler() {}

DEFINE_bool(bvar_enable_sampling, true, "is enable bvar sampling");

void Sampler::schedule() {
*butil::get_leaky_singleton<SamplerCollector>() << this;
// since the SamplerCollector is initialized before the program starts
// flags will not take effect if used in the SamplerCollector constructor
if (FLAGS_bvar_enable_sampling) {
*butil::get_leaky_singleton<SamplerCollector>() << this;
}
}

void Sampler::destroy() {
Expand Down

0 comments on commit 81b9397

Please sign in to comment.