// 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
// 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;
PerfFormatter* formatter;
PerfTracker(PerfConfig*, const char* tracker_fname);
+
+private:
+
};
#endif