1 |
/* |
2 |
* i-scream central monitoring system |
3 |
* Copyright (C) 2000-2002 i-scream |
4 |
* |
5 |
* This program is free software; you can redistribute it and/or |
6 |
* modify it under the terms of the GNU General Public License |
7 |
* as published by the Free Software Foundation; either version 2 |
8 |
* of the License, or (at your option) any later version. |
9 |
* |
10 |
* This program is distributed in the hope that it will be useful, |
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
* GNU General Public License for more details. |
14 |
* |
15 |
* You should have received a copy of the GNU General Public License |
16 |
* along with this program; if not, write to the Free Software |
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 |
*/ |
19 |
|
20 |
#include <iostream> |
21 |
#include <string> |
22 |
#include <stdlib.h> |
23 |
#include "SubPipe.h" |
24 |
#include "Config.h" |
25 |
#ifndef XMLFORMATTER_H /* Has the file been INCLUDE'd already? */ |
26 |
#define XMLFORMATTER_H yes |
27 |
#include "XMLFormatter.h" |
28 |
#endif |
29 |
|
30 |
#define MAX_UNIQUE_VALUES = 40; |
31 |
|
32 |
using std::string; |
33 |
|
34 |
class SysMon { |
35 |
|
36 |
public: |
37 |
SysMon(Config config, int printDebug); // constructor |
38 |
int collect(); // collect data for an averager |
39 |
string getData(); // return the data from averages, or a snapshot if no data is avaible |
40 |
int getSequence(){ return sequence; }; // inline |
41 |
void clearData(); // reset the data arrays |
42 |
|
43 |
private: |
44 |
SubPipe * p; |
45 |
int sequence; // sequence number for the packets |
46 |
int debug; // print debug info? |
47 |
const static int max_titles = 100; |
48 |
string titles[max_titles]; // names for the packet info |
49 |
string values[max_titles]; // values for those packet infos |
50 |
int titlepointer; // where have we got up to? |
51 |
int checks; // number of checks since the last packet |
52 |
}; // class |