read process info
This commit is contained in:
+24
-2
@@ -7,12 +7,34 @@
|
||||
|
||||
#ifndef TEST_H
|
||||
#define TEST_H
|
||||
#define MaxCache 256
|
||||
|
||||
//proc/PID/stat
|
||||
typedef struct Proc_CPU_Time {
|
||||
unsigned long utime; //user time
|
||||
unsigned long stime; //kernel time
|
||||
} Proc_CPU_Time;
|
||||
|
||||
#include<math.h>
|
||||
//proc/PID/statm,the value should multiply 4
|
||||
typedef struct Proc_Mem {
|
||||
unsigned long vsz; //Virtual Memory Size, includes all memory that the process can access
|
||||
unsigned long rss; //Resident Set Size
|
||||
} Proc_Mem;
|
||||
|
||||
double get_sqrt(double var1);
|
||||
typedef struct Proc_Info {
|
||||
unsigned int pid;
|
||||
char name[128];
|
||||
int point; //0-29
|
||||
struct Proc_CPU_Time cpuInfo[30];
|
||||
struct Proc_Mem memInfo[30];
|
||||
} Proc_Info;
|
||||
|
||||
void updateMem(unsigned int *all, unsigned int *fre, float *useage);
|
||||
|
||||
int updateProcInfo(Proc_Info *proc);
|
||||
unsigned int* getProcess();
|
||||
|
||||
int foundProcess(Proc_Info *pList, unsigned int id);
|
||||
int assertProcess(Proc_Info *pList, unsigned int id);
|
||||
|
||||
#endif /* !TEST_H */
|
||||
|
||||
Reference in New Issue
Block a user