| 1 | 
 ab11 | 
 1.1 | 
 #include <iostream> | 
 
 
 
 
 
 | 2 | 
   | 
   | 
 #include <string> | 
 
 
 
 
 
 
 
 
 | 3 | 
 ab11 | 
 1.4 | 
 #include <stdlib.h>  | 
 
 
 
 
 
 
 
 
 | 4 | 
 ab11 | 
 1.2 | 
 #include "SubPipe.h" | 
 
 
 
 
 
 
 
 
 | 5 | 
 ab11 | 
 1.1 | 
 #include "Config.h" | 
 
 
 
 
 
 | 6 | 
   | 
   | 
 #ifndef  XMLFORMATTER_H         /* Has the file been INCLUDE'd already? */ | 
 
 
 
 
 
 | 7 | 
   | 
   | 
     #define  XMLFORMATTER_H  yes | 
 
 
 
 
 
 | 8 | 
   | 
   | 
     #include "XMLFormatter.h" | 
 
 
 
 
 
 | 9 | 
   | 
   | 
 #endif | 
 
 
 
 
 
 | 10 | 
   | 
   | 
  | 
 
 
 
 
 
 | 11 | 
   | 
   | 
 #define MAX_UNIQUE_VALUES = 40; | 
 
 
 
 
 
 | 12 | 
   | 
   | 
  | 
 
 
 
 
 
 | 13 | 
   | 
   | 
 using std::string; | 
 
 
 
 
 
 | 14 | 
   | 
   | 
  | 
 
 
 
 
 
 | 15 | 
   | 
   | 
 class SysMon { | 
 
 
 
 
 
 | 16 | 
   | 
   | 
          | 
 
 
 
 
 
 | 17 | 
   | 
   | 
         public: | 
 
 
 
 
 
 | 18 | 
   | 
   | 
                 SysMon(Config config, int printDebug); // constructor | 
 
 
 
 
 
 
 
 
 | 19 | 
 ab11 | 
 1.4 | 
                 int collect();                      // collect data for an averager | 
 
 
 
 
 
 | 20 | 
   | 
   | 
                 string getData();                   // return the data from averages, or a snapshot if no data is avaible | 
 
 
 
 
 
 
 
 
 | 21 | 
 ab11 | 
 1.1 | 
                 int getSequence(){ return sequence; }; // inline | 
 
 
 
 
 
 
 
 
 | 22 | 
 ab11 | 
 1.4 | 
                 void clearData();                   // reset the data arrays | 
 
 
 
 
 
 
 
 
 | 23 | 
 ab11 | 
 1.1 | 
                  | 
 
 
 
 
 
 | 24 | 
   | 
   | 
         private: | 
 
 
 
 
 
 
 
 
 | 25 | 
 ab11 | 
 1.2 | 
             SubPipe * p; | 
 
 
 
 
 
 
 
 
 | 26 | 
 ab11 | 
 1.4 | 
                 int sequence;                           // sequence number for the packets | 
 
 
 
 
 
 | 27 | 
   | 
   | 
                 int debug;                                  // print debug info? | 
 
 
 
 
 
 | 28 | 
   | 
   | 
                 const static int max_titles = 100; | 
 
 
 
 
 
 | 29 | 
   | 
   | 
                 string titles[max_titles];              // names for the packet info | 
 
 
 
 
 
 | 30 | 
   | 
   | 
                 string values[max_titles];              // values for those packet infos | 
 
 
 
 
 
 | 31 | 
   | 
   | 
                 int titlepointer;                       // where have we got up to? | 
 
 
 
 
 
 | 32 | 
   | 
   | 
                 int checks;                                 // number of checks since the last packet | 
 
 
 
 
 
 
 
 
 | 33 | 
 ab11 | 
 1.1 | 
 }; // class |