1 /* Copyright (C) 2006 Sergei Golubchik
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License version 2
5 as published by the Free Software Foundation
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
18 WMgMon - Window Maker Generic Monitor
19 by Nicolas Chauvat <nico@caesium.fr>
21 WMMon from Antoine Nulle and Martijn Pieterse.
35 #define STRARG_LEN 255
37 #define MIN_FILE_LEN 8192
38 /******************************************************************************/
39 /* stat_dev structure and related functions */
40 /******************************************************************************/
46 /* note that P_SMOOTH and P_LOG *must* be 0 and 1 respectively */
47 #define P_SMOOTH (1L << 0)
48 #define P_LOG (1L << 1)
49 #define P_LABEL (1L << 2)
50 #define P_FLOAT (1L << 3)
51 #define P_SMALL (1L << 4)
52 #define P_MEDIUM (1L << 5)
53 #define P_BIG (1L << 6)
54 #define P_SCALEDOWN (1L << 7)
56 #define P_SIZE (P_SMALL | P_MEDIUM | P_BIG)
57 /* the following is an index in stat_dev::hist[] array */
58 #define P_HIST (P_SMOOTH | P_LOG)
60 #define F_SINGLE_LINE 1 /* regex flag */
65 double data
[HIST_SIZE
];
71 char name
[NAME_LEN
+1]; /* cpu, mem, swap, i/o, etc. */
73 double min
,max
; /* range for the bar/graph */
74 unsigned flags
; /* F_xxx from above */
80 double *diff_old
, *diff_new
, *sum_acc
;
81 unsigned nsum
; /* number of elements in sum_acc */
83 double value
[P_SMOOTH
+1]; /* "real-time" stat */
84 double *smooth
; /* 0 if unused */
85 history
*hist
[P_HIST
+1]; /* 0 if unused */
87 unsigned update_interval
;
89 unsigned hist_update_interval
;
90 unsigned hist_next_update
;
93 void stat_dev_init(stat_dev
* st
);
94 void stat_dev_initstat(stat_dev
* st
);
95 void stat_dev_update_history (stat_dev
* st
);
96 void update_stat(stat_dev
*);