17 #ifndef _PROCESSTOOLS_H
18 #define _PROCESSTOOLS_H
20 #include <semaphore.h>
25 #include <sys/types.h>
29 #define PROCESSINFOLISTSIZE 10000
32 #define MAXNBSUBPROCESS 50
35 #define PROCESSINFO_NBtimer 100
39 #ifndef __STDC_LIB_EXT1__
48 #define STRINGMAXLEN_PROCESSINFO_NAME 80
49 #define STRINGMAXLEN_PROCESSINFO_SRCFUNC 200
50 #define STRINGMAXLEN_PROCESSINFO_SRCFILE 200
51 #define STRINGMAXLEN_PROCESSINFO_TMUXNAME 100
52 #define STRINGMAXLEN_PROCESSINFO_STATUSMSG 200
53 #define STRINGMAXLEN_PROCESSINFO_LOGFILENAME 250
54 #define STRINGMAXLEN_PROCESSINFO_DESCRIPTION 200
60 #define PROCESSINFO_TRIGGERMODE_IMMEDIATE 0
63 #define PROCESSINFO_TRIGGERMODE_CNT0 1
66 #define PROCESSINFO_TRIGGERMODE_CNT1 2
69 #define PROCESSINFO_TRIGGERMODE_SEMAPHORE 3
72 #define PROCESSINFO_TRIGGERMODE_DELAY 4
76 #define PROCESSINFO_TRIGGERSTATUS_WAITING 1
78 #define PROCESSINFO_TRIGGERSTATUS_RECEIVED 2
79 #define PROCESSINFO_TRIGGERSTATUS_TIMEDOUT 3
93 char name[STRINGMAXLEN_PROCESSINFO_NAME];
95 char source_FUNCTION[STRINGMAXLEN_PROCESSINFO_SRCFUNC];
96 char source_FILE[STRINGMAXLEN_PROCESSINFO_SRCFILE];
101 struct timespec createtime;
111 char tmuxname[STRINGMAXLEN_PROCESSINFO_TMUXNAME];
122 char statusmsg[STRINGMAXLEN_PROCESSINFO_STATUSMSG];
126 char logfilename[STRINGMAXLEN_PROCESSINFO_LOGFILENAME];
136 imageID triggerstreamID;
137 ino_t triggerstreaminode;
138 char triggerstreamname[STRINGMAXLEN_IMAGE_NAME];
140 uint64_t triggerstreamcnt;
141 struct timespec triggerdelay;
142 struct timespec triggertimeout;
143 uint64_t trigggertimeoutcnt;
144 int triggermissedframe;
148 uint64_t triggermissedframe_cumul;
167 struct timespec texecstart[PROCESSINFO_NBtimer];
168 struct timespec texecend[PROCESSINFO_NBtimer];
170 long dtmedian_iter_ns;
171 long dtmedian_exec_ns;
174 int dtiter_limit_enable;
175 long dtiter_limit_value;
176 long dtiter_limit_cnt;
179 int dtexec_limit_enable;
180 long dtexec_limit_value;
181 long dtexec_limit_cnt;
184 char description[STRINGMAXLEN_PROCESSINFO_DESCRIPTION];
197 pid_t PIDarray[PROCESSINFOLISTSIZE];
198 int active[PROCESSINFOLISTSIZE];
199 char pnamearray[PROCESSINFOLISTSIZE][STRINGMAXLEN_PROCESSINFO_NAME];
221 char cpusallowed[20];
222 int cpuOKarray[MAXNBCPU];
232 int subprocPIDarray[MAXNBSUBPROCESS];
234 double sampletimearray[MAXNBSUBPROCESS];
235 double sampletimearray_prev[MAXNBSUBPROCESS];
237 long ctxtsw_voluntary[MAXNBSUBPROCESS];
238 long ctxtsw_nonvoluntary[MAXNBSUBPROCESS];
239 long ctxtsw_voluntary_prev[MAXNBSUBPROCESS];
240 long ctxtsw_nonvoluntary_prev[MAXNBSUBPROCESS];
242 long long cpuloadcntarray[MAXNBSUBPROCESS];
243 long long cpuloadcntarray_prev[MAXNBSUBPROCESS];
244 float subprocCPUloadarray[MAXNBSUBPROCESS];
245 float subprocCPUloadarray_timeaveraged[MAXNBSUBPROCESS];
247 long VmRSSarray[MAXNBSUBPROCESS];
249 int processorarray[MAXNBSUBPROCESS];
270 int SCANBLOCK_requested;
279 int DisplayDetailedMode;
287 int pinfommapped[PROCESSINFOLISTSIZE];
288 pid_t PIDarray[PROCESSINFOLISTSIZE];
289 int updatearray[PROCESSINFOLISTSIZE];
290 int fdarray[PROCESSINFOLISTSIZE];
291 long loopcntarray[PROCESSINFOLISTSIZE];
292 long loopcntoffsetarray[PROCESSINFOLISTSIZE];
293 int selectedarray[PROCESSINFOLISTSIZE];
295 int sorted_pindex_time[PROCESSINFOLISTSIZE];
301 float CPUload[MAXNBCPU];
302 long long CPUcnt0[MAXNBCPU];
303 long long CPUcnt1[MAXNBCPU];
304 long long CPUcnt2[MAXNBCPU];
305 long long CPUcnt3[MAXNBCPU];
306 long long CPUcnt4[MAXNBCPU];
307 long long CPUcnt5[MAXNBCPU];
308 long long CPUcnt6[MAXNBCPU];
309 long long CPUcnt7[MAXNBCPU];
310 long long CPUcnt8[MAXNBCPU];
312 int CPUids[MAXNBCPU];
313 int CPUphys[MAXNBCPU];
315 int CPUpcnt[MAXNBCPU];
318 int pindexActive[PROCESSINFOLISTSIZE];
319 int psysinfostatus[PROCESSINFOLISTSIZE];
331 char description[200];
342 char descriptionstring[200],
344 const char *functionname,
345 const char *filename,
349 errno_t processinfo_error(
354 errno_t processinfo_loopstart(
358 int processinfo_loopstep(
362 int processinfo_compute_status(
370 PROCESSINFO *processinfo_shm_link(
const char *pname,
int *fd);
371 int processinfo_shm_close(
PROCESSINFO *pinfo,
int fd);
372 int processinfo_cleanExit(
PROCESSINFO *processinfo);
373 int processinfo_SIGexit(
PROCESSINFO *processinfo,
int SignalNumber);
374 int processinfo_WriteMessage(
PROCESSINFO *processinfo,
const char *msgstring);
375 int processinfo_exec_start(
PROCESSINFO *processinfo);
376 int processinfo_exec_end(
PROCESSINFO *processinfo);
379 int processinfo_CatchSignals();
380 int processinfo_ProcessSignals(
PROCESSINFO *processinfo);
386 int semindexrequested
406 #endif // _PROCESSTOOLS_H