-
Notifications
You must be signed in to change notification settings - Fork 3
/
system_information.h
71 lines (58 loc) · 1.46 KB
/
system_information.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef SYSTEM_INFORMATION_H
#define SYSTEM_INFORMATION_H
#include <stdbool.h>
#include <stdint.h>
#define CPU_MAX_NAME 128
/* RX/TX statistics */
struct linkdef {
unsigned long tot_bytes;
unsigned long prev_bytes;
unsigned long num_packets;
unsigned long prev_packets;
unsigned long errs;
unsigned long drop;
unsigned long fifo;
unsigned long frame_cols;
unsigned long compressed;
unsigned long mc_carrier;
double kbps; /* kilobytes per second */
unsigned int pps; /* packets per second */
};
struct memstat {
unsigned long total_ram;
unsigned long free_ram;
unsigned long buffers;
unsigned long cached;
struct process {
unsigned long vm_rss;
unsigned long vm_size;
int pid;
} proc;
};
struct hwstat {
int num_cpu;
char cpu_name[CPU_MAX_NAME];
};
struct cputime {
unsigned long user;
unsigned long nice;
unsigned long system;
unsigned long idle;
};
struct wireless {
uint8_t qual;
uint8_t max_qual;
uint8_t level;
uint8_t noise;
};
/* get network device status information */
bool get_netstat(char *dev, struct linkdef *rx, struct linkdef *tx);
/* get memory usage information */
bool get_memstat(struct memstat *mem);
/* get cpu and hardware information */
bool get_hwstat(struct hwstat *hw);
/* get cpu statistics */
bool get_cpustat(struct cputime *cpu);
/* get wireless statistics */
bool get_iwstat(char *dev, struct wireless *stat);
#endif