]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #327 in SNORT/snort3 from perf_procglobal2 to master
authorRuss Combs (rucombs) <rucombs@cisco.com>
Wed, 9 Mar 2016 23:36:26 +0000 (18:36 -0500)
committerRuss Combs (rucombs) <rucombs@cisco.com>
Wed, 9 Mar 2016 23:36:26 +0000 (18:36 -0500)
Squashed commit of the following:

commit 5de0642b9b9d24ae52d06126d00782f3032a7a4b
Author: Carter Waxman <cwaxman@cisco.com>
Date:   Wed Mar 9 17:36:14 2016 -0500

    fixed formatting for clarity

commit 479cd2f035f4fdabe48785e0834c92b25059d332
Author: Carter Waxman <cwaxman@cisco.com>
Date:   Wed Mar 9 13:27:02 2016 -0500

    fixed  thread_local

commit 4e25c463fbb5596f67afece29bd4e17651352122
Author: Carter Waxman <cwaxman@cisco.com>
Date:   Wed Mar 9 12:49:18 2016 -0500

    fixed whitespaceP

commit aae8c40a9537144772e599e49eb14cd139e8a475
Author: Carter Waxman <cwaxman@cisco.com>
Date:   Wed Mar 9 12:47:38 2016 -0500

    fixed whitespaceP

commit f717352f7e6ff79709a40bd3fab7aa0cf6c5ec4b
Author: Carter Waxman <cwaxman@cisco.com>
Date:   Wed Mar 9 12:44:31 2016 -0500

    fixed reporting of process stats

commit dc8e6974db9500c3ef5e887e099ef5bf7faba555
Author: Carter Waxman <cwaxman@cisco.com>
Date:   Wed Mar 9 10:53:10 2016 -0500

    fixed reporting of process stats

src/framework/module.cc
src/framework/module.h
src/main/snort_module.cc

index 076a0cdf4099fd95110b9809682abef2717816ac..510fbc7cdf8d3647d4a0b3748d24502af668e303 100644 (file)
@@ -71,10 +71,18 @@ void Module::sum_stats()
     if ( !p )
         return;
 
-    for ( int i = 0; i < num_counts; i++ )
+    if ( global_stats() )
+    {
+        for ( int i = 0; i < num_counts; i++ )
+            counts[i] = p[i];
+    }
+    else
     {
-        counts[i] += p[i];
-        p[i] = 0;
+        for ( int i = 0; i < num_counts; i++ )
+        {
+            counts[i] += p[i];
+            p[i] = 0;
+        }
     }
 }
 
index 51a3aaae6942eb6dfcb53710f304dc1847d84ddf..7733dd07a1a0ff82aa9da526ae8293ccb89fbf2a 100644 (file)
@@ -141,6 +141,9 @@ public:
     virtual const char* get_defaults() const
     { return nullptr; }
 
+    virtual bool global_stats() const
+    { return false; }
+
     virtual void sum_stats();
     virtual void show_interval_stats(IndexVec&);
     virtual void show_stats();
index 74cb71488bb257fa5b8a5b6798a3bbef2b9af196..2f461385461613b383b3b60ff7fe481a1e22f060 100644 (file)
@@ -518,6 +518,7 @@ public:
     bool set(const char*, Value&, SnortConfig*) override;
     const PegInfo* get_pegs() const override { return proc_names; }
     PegCount* get_counts() const override { return (PegCount*) &proc_stats; }
+    bool global_stats() const override { return true; }
 };
 
 bool SnortModule::set(const char*, Value& v, SnortConfig* sc)