]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
added comments for perfmon APIs
authorCarter Waxman <cwaxman@cisco.com>
Wed, 13 Apr 2016 14:54:39 +0000 (10:54 -0400)
committerCarter Waxman <cwaxman@cisco.com>
Wed, 13 Apr 2016 14:54:39 +0000 (10:54 -0400)
src/network_inspectors/perf_monitor/perf_formatter.h
src/network_inspectors/perf_monitor/perf_tracker.h

index dbb58a0578c447650746eca867782c4259f8ab26..6dc53d2f203fd571dcd94e635480fc7820fcb2dd 100644 (file)
 
 // perf_formatter.h author Carter Waxman <cwaxman@cisco.com>
 
+//
+// PerfFormatter provides an API for PerfTrackers to use for reporting data.
+// The basic flow from the perspective of a PerfTracker is:
+// 
+// 1. Call register_section to create a section of stats
+//
+// 2. Call register_field to insert a field into the most recently created
+//    section. Fields should always be pointers to stable locations in memory,
+//    as they cannot be updated. Data will be pulled from these pointers when
+//    writes occur.
+//
+// 3. Call finalize_fields to complete section and field registration. This is
+//    where any metadata needed will be sent to the provided output.
+//
+// 4. Set the values desired for fields.
+//
+// 5. Call write to output the current values in each field.
+//
+
 #ifndef PERF_FORMATTER_H
 #define PERF_FORMATTER_H
 
index 442b82a24b1ab020d7f2055a235e5b6a833e0cc9..81a65057ab0779e78c1782e81d3df80de2115927 100644 (file)
 
 // perf_tracker.h author Carter Waxman <cwaxman@cisco.com>
 
+//
+// This class defines the data gathering layer of perfmon. PerfMonitor will
+// create an instance of each configued class for each packet processing
+// thread. Subclasses of PerfTrackers should implement or call the following
+// methods, leaving the others for internal use by PerfMonitor:
+// 
+// reset() - perform initialization after the output handle has been opened.
+//
+// update(Packet*) - update statistics basied on the current packet.
+//
+// process(bool) - summarize data and report. This is called after the
+// reporting thresholds have been reached.
+//
+
 #ifndef PERF_TRACKER_H
 #define PERF_TRACKER_H
 
 class PerfTracker
 {
 public:
-    virtual void reset() { }
-    virtual void show() { }         // FIXIT-L would it be better to let perfmon do this if it knows
-                                    // the names of fields?
+    virtual void reset() {}
 
-    virtual void update(Packet*) { }
-    virtual void update_time(time_t time) { cur_time = time; }
-    virtual void process(bool /*summary*/) { } //FIXIT-M get rid of this step.
+    virtual void update(Packet*) {};
+    virtual void process(bool /*summary*/) {}; //FIXIT-M get rid of this step.
 
+    virtual void update_time(time_t time) final { cur_time = time; };
     virtual void open(bool append) final;
     virtual void close() final;
     virtual void rotate() final;
@@ -52,6 +64,9 @@ protected:
     PerfFormatter* formatter;
 
     PerfTracker(PerfConfig*, const char* tracker_fname);
+
+private:
+    
 };
 #endif