summaryrefslogtreecommitdiff
path: root/LibCore/CProcessStatisticsReader.h
blob: df9b788ea22900ec5aadcc674756dd5e7b5d30dd (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
#pragma once

#include <AK/AKString.h>
#include <AK/HashMap.h>

struct CProcessStatistics {
    pid_t pid;
    unsigned nsched;
    String name;
    String state;
    String username;
    uid_t uid;
    String priority;
    size_t linear;
    size_t physical;
    unsigned syscalls;
};

class CProcessStatisticsReader {
public:
    CProcessStatisticsReader();
    HashMap<pid_t, CProcessStatistics> get_map();

private:
    void update_map(HashMap<pid_t, CProcessStatistics>& map);
    String get_username_from_uid(const uid_t uid);

    HashMap<uid_t, String> m_usernames;
};