mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:08:11 +00:00
Added CProcessStatisticsReader to avoid having to parse /proc/all (#35)
* Added CProcessStatisticsReader to avoid having to parse /proc/all * Took @awesomekling's feedbacks into account * Fixed indentation and replaced tabs by spaces
This commit is contained in:
parent
174639b7f0
commit
0ba4ceb2cd
5 changed files with 164 additions and 81 deletions
29
LibCore/CProcessStatisticsReader.h
Normal file
29
LibCore/CProcessStatisticsReader.h
Normal file
|
@ -0,0 +1,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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue