2019-05-16 18:47:47 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/AKString.h>
|
|
|
|
#include <AK/HashMap.h>
|
|
|
|
|
|
|
|
struct CProcessStatistics {
|
2019-07-17 22:22:22 +02:00
|
|
|
// Keep this in sync with /proc/all.
|
|
|
|
// From the kernel side:
|
2019-05-16 18:47:47 +02:00
|
|
|
pid_t pid;
|
2019-07-17 22:22:22 +02:00
|
|
|
unsigned times_scheduled;
|
|
|
|
unsigned pgid;
|
|
|
|
unsigned sid;
|
2019-05-16 18:47:47 +02:00
|
|
|
uid_t uid;
|
2019-07-17 22:22:22 +02:00
|
|
|
gid_t gid;
|
|
|
|
String state;
|
|
|
|
pid_t ppid;
|
|
|
|
unsigned nfds;
|
|
|
|
String name;
|
|
|
|
String tty;
|
|
|
|
size_t amount_virtual;
|
|
|
|
size_t amount_resident;
|
|
|
|
size_t amount_shared;
|
|
|
|
unsigned ticks;
|
2019-05-16 18:47:47 +02:00
|
|
|
String priority;
|
2019-07-17 22:22:22 +02:00
|
|
|
unsigned syscall_count;
|
|
|
|
|
|
|
|
// synthetic
|
|
|
|
String username;
|
2019-05-16 18:47:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class CProcessStatisticsReader {
|
|
|
|
public:
|
2019-07-10 13:56:28 +02:00
|
|
|
static HashMap<pid_t, CProcessStatistics> get_all();
|
2019-05-16 18:47:47 +02:00
|
|
|
|
|
|
|
private:
|
2019-07-10 13:56:28 +02:00
|
|
|
static String username_from_uid(uid_t);
|
|
|
|
static HashMap<uid_t, String> s_usernames;
|
2019-05-16 18:47:47 +02:00
|
|
|
};
|