mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
0ba4ceb2cd
* Added CProcessStatisticsReader to avoid having to parse /proc/all * Took @awesomekling's feedbacks into account * Fixed indentation and replaced tabs by spaces
29 lines
579 B
C++
29 lines
579 B
C++
#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;
|
|
};
|