-
Notifications
You must be signed in to change notification settings - Fork 113
/
showgeneric.h
286 lines (241 loc) · 6.56 KB
/
showgeneric.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
/*
** ATOP - System & Process Monitor
**
** The program 'atop' offers the possibility to view the activity of
** the system on system-level as well as process-level.
**
** Include-file describing prototypes and structures for visualization
** of counters.
** ================================================================
** Author: Gerlof Langeveld
** E-mail: [email protected]
** Date: July 2002
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2, or (at your option) any
** later version.
**
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU General Public License for more details.
*/
#ifndef __SHOWGENERIC__
#define __SHOWGENERIC__
#define USERSTUB 9999999
#define MAXUSERSEL 64
#define MAXPID 32
// minimum screen dimensions
//
#define MINLINES 24
#define MINCOLUMNS 60
struct syscap {
int nrcpu;
count_t availcpu;
count_t availmem;
count_t availdsk;
count_t availnet;
int nrgpu;
count_t availgpumem; // GPU memory in Kb!
int nrmemnuma;
int nrcpunuma;
};
struct pselection {
char username[256];
uid_t userid[MAXUSERSEL];
pid_t pid[MAXPID];
char progname[64];
int prognamesz;
regex_t progregex;
char argname[64];
int argnamesz;
regex_t argregex;
char utsname[UTSLEN+1];
char states[16];
};
struct sselection {
char lvmname[64]; // logical volume selection
int lvmnamesz;
regex_t lvmregex;
char dskname[64]; // disk selection
int dsknamesz;
regex_t dskregex;
char itfname[64]; // network interface selection
int itfnamesz;
regex_t itfregex;
};
/*
** color definitions
*/
#define COLOR_MYORANGE 20
#define COLOR_MYGREEN 21
#define COLOR_MYGREY 22
#define COLOR_MYLGREY 23
#define COLOR_MYBROWN1 24
#define COLOR_MYBROWN2 25
#define COLOR_MYBLUE0 26
#define COLOR_MYBLUE1 27
#define COLOR_MYBLUE2 28
#define COLOR_MYBLUE3 29
#define COLOR_MYBLUE4 30
#define COLOR_MYBLUE5 31
#define COLOR_MYGREEN0 35
#define COLOR_MYGREEN1 36
#define COLOR_MYGREEN2 37
/*
** color pair definitions
*/
#define FGCOLORBORDER 1
#define FGCOLORINFO 2
#define FGCOLORALMOST 3
#define FGCOLORCRIT 4
#define FGCOLORTHR 5
#define FGCOLORGREY 6
#define WHITE_GREEN 10
#define WHITE_ORANGE 11
#define WHITE_RED 12
#define WHITE_GREY 13
#define WHITE_BLUE 14
#define WHITE_MAGENTA 15
#define WHITE_BROWN1 18
#define WHITE_BROWN2 19
#define WHITE_BLUE0 20
#define WHITE_BLUE1 21
#define WHITE_BLUE2 22
#define WHITE_BLUE3 23
#define WHITE_BLUE4 24
#define WHITE_BLUE5 25
#define WHITE_GREEN0 30
#define WHITE_GREEN1 31
#define WHITE_GREEN2 32
/*
** text and bar color selections
*/
#define COLOROKAY WHITE_GREEN
#define COLORWARN WHITE_ORANGE
#define COLORBAD WHITE_RED
#define COLORCPUSYS WHITE_BLUE1
#define COLORCPUUSR WHITE_BLUE2
#define COLORCPUINTR WHITE_BLUE3
#define COLORCPUSTEAL WHITE_BLUE4
#define COLORCPUGUEST WHITE_BLUE5
#define COLORMEMFREE WHITE_GREEN
#define COLORMEMCACH WHITE_ORANGE
#define COLORMEMHUGE WHITE_BLUE5
#define COLORMEMUSED WHITE_GREY
#define COLORMEMSHM WHITE_BROWN1
#define COLORMEMTMP WHITE_BLUE
#define COLORMEMSLAB WHITE_MAGENTA
#define COLORMEMBAR WHITE_BLUE3
#define COLORDSKREAD WHITE_GREEN1
#define COLORDSKWRITE WHITE_GREEN2
#define COLORNETRECV WHITE_BROWN1
#define COLORNETSEND WHITE_BROWN2
/*
** list with keystrokes/flags
*/
#define MPROCGEN 'g'
#define MPROCMEM 'm'
#define MPROCDSK 'd'
#define MPROCNET 'n'
#define MPROCGPU 'e'
#define MPROCSCH 's'
#define MPROCVAR 'v'
#define MPROCARG 'c'
#define MCGROUPS 'G'
#define MPROCOWN 'o'
#define MCUMUSER 'u'
#define MCUMPROC 'p'
#define MCUMCONT 'j'
#define MSORTCPU 'C'
#define MSORTDSK 'D'
#define MSORTMEM 'M'
#define MSORTNET 'N'
#define MSORTGPU 'E'
#define MSORTAUTO 'A'
#define MTHREAD 'y'
#define MTHRSORT 'Y'
#define MCALCPSS 'R'
#define MGETWCHAN 'W'
#define MSUPEXITS 'X'
#define MCOLORS 'x'
#define MSYSFIXED 'f'
#define MSYSNOSORT 'F'
#define MSYSLIMIT 'l'
#define MRMSPACES 'Z'
#define MSELUSER 'U'
#define MSELPROC 'P'
#define MSELCONT 'J'
#define MSELPID 'I'
#define MSELARG '/'
#define MSELSTATE 'Q'
#define MSELSYS 'S'
#define MALLACTIVE 'a'
#define MKILLPROC 'k'
#define MLISTFW 0x06
#define MLISTBW 0x02
#define MREDRAW 0x0c
#define MINTERVAL 'i'
#define MPAUSE 'z'
#define MQUIT 'q'
#define MRESET 'r'
#define MSAMPNEXT 't'
#define MSAMPPREV 'T'
#define MSAMPBRANCH 'b'
#define MVERSION 'V'
#define MAVGVAL '1'
#define MHELP1 '?'
#define MHELP2 'h'
#define MBARGRAPH 'B'
#define MBARLOWER 'L'
#define MBARMONO 'H'
/*
** extern values for globals
*/
extern int paused;
extern int cgroupdepth;
/*
** general function prototypes
*/
void totalcap (struct syscap *, struct sstat *, struct tstat **, int);
void pricumproc (struct sstat *, struct devtstat *,
int, unsigned int, int, int);
void showgenproc(struct tstat *, double, int, int);
void showmemproc(struct tstat *, double, int, int);
void showdskproc(struct tstat *, double, int, int);
void shownetproc(struct tstat *, double, int, int);
void showvarproc(struct tstat *, double, int, int);
void showschproc(struct tstat *, double, int, int);
void showtotproc(struct tstat *, double, int, int);
void showcmdproc(struct tstat *, double, int, int);
void printg(const char *, ...);
int prisyst(struct sstat *, int, int, int, int, struct sselection *,
char *, int, int, int, int, int, int, int, int, int, int, int);
void prihead(int, int, char *, char *, char, count_t);
struct cglinesel;
int pricgroup(struct cglinesel *, int, int, int, int, int,
struct syscap *, int, int);
int priproc(struct tstat **, int, int, int, int, int, char, char,
struct syscap *, int, int);
char draw_samp(time_t, int, struct sstat *, char, char);
void do_username(char *, char *);
void do_procname(char *, char *);
void do_maxcpu(char *, char *);
void do_maxgpu(char *, char *);
void do_maxdisk(char *, char *);
void do_maxmdd(char *, char *);
void do_maxlvm(char *, char *);
void do_maxintf(char *, char *);
void do_maxifb(char *, char *);
void do_maxnfsm(char *, char *);
void do_maxcont(char *, char *);
void do_maxnuma(char *, char *);
void do_maxllc(char *, char *);
void do_colinfo(char *, char *);
void do_colalmost(char *, char *);
void do_colcrit(char *, char *);
void do_colthread(char *, char *);
void do_twindir(char *, char *);
void do_flags(char *, char *);
#endif