From: Vitalii Serhiiovych Horbatov -X (vhorbato - SOFTSERVE INC at Cisco) Date: Tue, 12 Dec 2023 14:07:19 +0000 (+0000) Subject: Pull request #4131: profiler: change time tracking for "rule_time (%)" field in rule_... X-Git-Tag: 3.1.77.0~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae94459dfc7d8d57571c878a0672391e0d136760;p=thirdparty%2Fsnort3.git Pull request #4131: profiler: change time tracking for "rule_time (%)" field in rule_profiler output Merge in SNORT/snort3 from ~VHORBATO/snort3:rp_percent to master Squashed commit of the following: commit a11edea62ed46ae86fbba5ff6f377ef0bc21bd18 Author: vhorbato Date: Wed Dec 6 15:12:12 2023 +0200 profiler: change time tracking for "rule_time (%)" field in rule_profiler output --- diff --git a/src/profiler/profiler_module.cc b/src/profiler/profiler_module.cc index 7502f04ad..ec34c1281 100644 --- a/src/profiler/profiler_module.cc +++ b/src/profiler/profiler_module.cc @@ -536,6 +536,9 @@ bool ProfilerModule::end(const char* fqn, int, SnortConfig* sc) TimeProfilerStats::set_enabled(sc->profiler->time.show); RuleContext::set_enabled(sc->profiler->rule.show); + if ( sc->profiler->rule.show ) + RuleContext::set_start_time(get_time_curr()); + if ( Snort::is_reloading() && strcmp(fqn, "profiler") == 0 ) sc->register_reload_handler(new ProfilerReloadTuner(sc->profiler->rule.show, sc->profiler->time.show)); diff --git a/src/profiler/rule_profiler.cc b/src/profiler/rule_profiler.cc index a28e84028..2f95b2542 100644 --- a/src/profiler/rule_profiler.cc +++ b/src/profiler/rule_profiler.cc @@ -164,6 +164,7 @@ void show_rule_profiler_stats(const RuleProfilerConfig& config) for ( unsigned i = 0; i < ThreadConfig::get_instance_max(); ++i ) prepare_rule_profiler_stats(nodes, stats, i); + RuleContext::set_end_time(get_time_curr()); print_rule_profiler_stats(config, stats, nullptr); }