]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
profiling: fix percentage of detect phases
authorVictor Julien <victor@inliniac.net>
Tue, 4 Feb 2014 11:52:07 +0000 (12:52 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 4 Feb 2014 12:42:21 +0000 (13:42 +0100)
Use proper 'total' to calculate weigth of each detection phase.

src/util-profiling.c

index 9dfb53099d8714478182676e823f945850a73a20..085f39b4b7dc0636f7996fa8d8415a3cb77e45ff 100644 (file)
@@ -531,6 +531,17 @@ void SCProfilingDumpPacketStats(void) {
     }
     fprintf(fp, "\nGeneral detection engine stats:\n");
 
+    total = 0;
+    for (m = 0; m < PROF_DETECT_SIZE; m++) {
+        int p;
+        for (p = 0; p < 257; p++) {
+            SCProfilePacketData *pd = &packet_profile_detect_data4[m][p];
+            total += pd->tot;
+            pd = &packet_profile_detect_data6[m][p];
+            total += pd->tot;
+        }
+    }
+
     fprintf(fp, "\n%-24s   %-6s   %-5s   %-12s   %-12s   %-12s   %-12s   %-12s\n",
             "Detection phase", "IP ver", "Proto", "cnt", "min", "max", "avg", "tot");
     fprintf(fp, "%-24s   %-6s   %-5s   %-12s   %-12s   %-12s   %-12s   %-12s\n",