Skip to content

Commit

Permalink
resource_mgmt: check if underlying state has changed in config handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
ballard26 committed Nov 2, 2023
1 parent e51deb6 commit ee1d886
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/v/resource_mgmt/cpu_profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ void cpu_profiler::on_enabled_change() {
return;
}

if (ss::engine().get_cpu_profiler_enabled() == is_enabled()) {
return;
}

ss::engine().set_cpu_profiler_enabled(is_enabled());
_query_timer.cancel();

Expand All @@ -148,7 +152,18 @@ void cpu_profiler::on_sample_period_change() {
return;
}

if (ss::engine().get_cpu_profiler_period() == _sample_period()) {
return;
}

ss::engine().set_cpu_profiler_period(_sample_period());

if (is_enabled()) {
// Arm the timer to fire whenever the profiler collects
// the maximum number of traces it can retain.
_query_timer.rearm_periodic(
ss::max_number_of_traces * _sample_period());
}
}

ss::future<std::vector<cpu_profiler::shard_samples>>
Expand Down

0 comments on commit ee1d886

Please sign in to comment.