forked from voipmonitor/sniffer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pstat.h
28 lines (21 loc) · 780 Bytes
/
pstat.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
#ifndef PSTAT_H
#define PSTAT_H
struct pstat_data {
long long unsigned int utime_ticks;
long long int cutime_ticks;
long long unsigned int stime_ticks;
long long int cstime_ticks;
long long unsigned int vsize; // virtual memory size in bytes
long long unsigned int rss; // resident set size in bytes
long long unsigned int cpu_total_time;
};
bool pstat_get_data(const int pid, pstat_data* result);
void pstat_calc_cpu_usage_pct(const pstat_data* cur_usage,
const pstat_data* last_usage,
double* ucpu_usage, double* scpu_usage);
void pstat_calc_cpu_usage(const pstat_data* cur_usage,
const pstat_data* last_usage,
long unsigned int* ucpu_usage,
long unsigned int* scpu_usage);
long unsigned int getRss();
#endif