From: Rishabh Choudhary (rishacho) Date: Mon, 9 Jun 2025 06:37:27 +0000 (+0000) Subject: Pull request #4770: profiler: add note for total percentage for profiler_dump X-Git-Tag: 3.9.1.0~12 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=400f7b4434e20e00afce313f64e798cbff82b5e6;p=thirdparty%2Fsnort3.git Pull request #4770: profiler: add note for total percentage for profiler_dump Merge in SNORT/snort3 from ~RISHACHO/snort3:cpu_profiler_warn_msg to master Squashed commit of the following: commit d23e9ce41dae05647dab0221969e20399660a91e Author: Rishabh Choudhary Date: Thu Jun 5 15:01:01 2025 +0530 profiler: add note for total percentage for profiler_dump --- diff --git a/src/profiler/profiler_printer.h b/src/profiler/profiler_printer.h index 8082116a5..8e30b9e11 100644 --- a/src/profiler/profiler_printer.h +++ b/src/profiler/profiler_printer.h @@ -170,6 +170,11 @@ public: print_t(ss.str().c_str()); } + float get_total() + { + return total; + } + private: const StatsTable::Field* fields; const PrintFn print; diff --git a/src/profiler/time_profiler.cc b/src/profiler/time_profiler.cc index bc45ffff4..89a1fdf1b 100644 --- a/src/profiler/time_profiler.cc +++ b/src/profiler/time_profiler.cc @@ -22,6 +22,8 @@ #include "config.h" #endif +#include + #include "time_profiler.h" #include "profiler_nodes.h" @@ -184,6 +186,9 @@ void print_time_profiler_stats(ProfilerNodeMap& nodes, const TimeProfilerConfig& ProfilerPrinter printer(time_stats::fields, time_stats::print_fn, sorter, printer_t); printer.print_table(s_time_table_title, root, config.count, config.max_depth); + + if (std::roundf(printer.get_total()) > 100.0f) + LogRespond(ctrlcon, "Note: Total time for a module includes time spent in submodules. Total percentage may exceed 100\n"); } #ifdef UNIT_TEST