05.11.2011 - stable version, 0.1.0, self-test program, work at GCC 2.95 - 4.5, VC 2010, MinGW, Linux, Windows, QNX
This commit is contained in:
52
pisystemmonitor.h
Normal file
52
pisystemmonitor.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef PISYSTEMMONITOR_H
|
||||
#define PISYSTEMMONITOR_H
|
||||
|
||||
#include "pithread.h"
|
||||
#include "piprocess.h"
|
||||
|
||||
class PISystemMonitor: public PIThread
|
||||
{
|
||||
public:
|
||||
PISystemMonitor();
|
||||
|
||||
struct ProcessStats {
|
||||
PIString exec_name;
|
||||
PIString state;
|
||||
int ID;
|
||||
int parent_ID;
|
||||
int group_ID;
|
||||
int session_ID;
|
||||
int priority;
|
||||
int threads;
|
||||
ulong physical_memsize;
|
||||
ulong resident_memsize;
|
||||
ulong share_memsize;
|
||||
ulong virtual_memsize;
|
||||
ulong data_memsize;
|
||||
PIString physical_memsize_readable;
|
||||
PIString resident_memsize_readable;
|
||||
PIString share_memsize_readable;
|
||||
PIString virtual_memsize_readable;
|
||||
PIString data_memsize_readable;
|
||||
float cpu_load_system;
|
||||
float cpu_load_user;
|
||||
};
|
||||
|
||||
bool startOnProcess(int pID);
|
||||
bool startOnSelf() {return startOnProcess(PIProcess::currentPID());}
|
||||
ProcessStats & statistic() {return stat;}
|
||||
|
||||
private:
|
||||
void run();
|
||||
PIString readableSize(long bytes);
|
||||
|
||||
PIFile file, filem;
|
||||
ProcessStats stat;
|
||||
int pID_, page_size, cpu_count, cycle;
|
||||
#ifndef WINDOWS
|
||||
llong cpu_u_cur, cpu_u_prev, cpu_s_cur, cpu_s_prev;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif // PISYSTEMMONITOR_H
|
||||
Reference in New Issue
Block a user