#ifndef PROCESS_MON_H #define PROCESS_MON_H #include typedef struct st_process { // For our own purposes struct st_process *next; // next process in order we read them struct st_process *parent; // parent process struct st_process *child; // pointer to first child struct st_process *sibling; // pointer to next sibling int visited; uint32_t flags; char cpuset[128]; int tgid; // attributes identifying thread int lxc; int pid; int ppid; char label[128]; // statistics - each outputs 1 line per process int level; int iskernel; uint64_t cpuTime; uint64_t nThreads; uint64_t resident; uint64_t swap; uint64_t written; uint64_t read; // cumulative fields - process + children uint64_t cCpuTime; uint64_t cMemory; uint64_t cSwap; uint64_t cRead; uint64_t cWrite; } Process; char *readProcesses(char *procdir); void aggregateStats(Process *head); int resetVisits(Process *head); void linkFamily(Process *head); void printFamilyTree(Process *head); int parseStatFile(Process *proc, char *filedata); int parseStatusFile(Process *proc, char *filedata); int parseIOFile(Process *proc, char *filedata); #endif