blob: 4fa38067827b52d6c3f66918eb7de7faaf7bc419 (
plain)
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
|
#pragma once
#include <AK/HashMap.h>
#include <AK/String.h>
#include <unistd.h>
struct CThreadStatistics {
int tid;
unsigned times_scheduled;
unsigned ticks;
unsigned syscall_count;
unsigned inode_faults;
unsigned zero_faults;
unsigned cow_faults;
unsigned unix_socket_read_bytes;
unsigned unix_socket_write_bytes;
unsigned ipv4_socket_read_bytes;
unsigned ipv4_socket_write_bytes;
unsigned file_read_bytes;
unsigned file_write_bytes;
String state;
String priority;
String name;
};
struct CProcessStatistics {
// Keep this in sync with /proc/all.
// From the kernel side:
pid_t pid;
unsigned pgid;
unsigned pgp;
unsigned sid;
uid_t uid;
gid_t gid;
pid_t ppid;
unsigned nfds;
String name;
String tty;
size_t amount_virtual;
size_t amount_resident;
size_t amount_shared;
size_t amount_purgeable_volatile;
size_t amount_purgeable_nonvolatile;
int icon_id;
Vector<CThreadStatistics> threads;
// synthetic
String username;
};
class CProcessStatisticsReader {
public:
static HashMap<pid_t, CProcessStatistics> get_all();
private:
static String username_from_uid(uid_t);
static HashMap<uid_t, String> s_usernames;
};
|