]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #4131: profiler: change time tracking for "rule_time (%)" field in rule_...
authorVitalii Serhiiovych Horbatov -X (vhorbato - SOFTSERVE INC at Cisco) <vhorbato@cisco.com>
Tue, 12 Dec 2023 14:07:19 +0000 (14:07 +0000)
committerOleksii. Shumeiko -X (oshumeik - SOFTSERVE INC at Cisco) <oshumeik@cisco.com>
Tue, 12 Dec 2023 14:07:19 +0000 (14:07 +0000)
Merge in SNORT/snort3 from ~VHORBATO/snort3:rp_percent to master

Squashed commit of the following:

commit a11edea62ed46ae86fbba5ff6f377ef0bc21bd18
Author: vhorbato <vhorbato@cisco.com>
Date:   Wed Dec 6 15:12:12 2023 +0200

    profiler: change time tracking for "rule_time (%)" field in rule_profiler output

src/profiler/profiler_module.cc
src/profiler/rule_profiler.cc

index 7502f04ad7c4f99568a80f2520f3659894c3b219..ec34c128167cb4c03a87178b8b0c18570db437b3 100644 (file)
@@ -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));
index a28e84028025a59d05af7ac6c732998971ee431b..2f95b2542cb5a0b982e22383d59322f72b238812 100644 (file)
@@ -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);
 }