mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 07:44:57 +00:00

This is memory that's loaded from an inode (file) but not modified in memory, so still identical to what's on disk. This kind of memory can be freed and reloaded transparently from disk if needed.
61 lines
1.3 KiB
C++
61 lines
1.3 KiB
C++
#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_dirty_private;
|
|
size_t amount_clean_inode;
|
|
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;
|
|
};
|