CProcessStatisticsReader.h 755 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include <AK/AKString.h>
  3. #include <AK/HashMap.h>
  4. struct CProcessStatistics {
  5. // Keep this in sync with /proc/all.
  6. // From the kernel side:
  7. pid_t pid;
  8. unsigned times_scheduled;
  9. unsigned pgid;
  10. unsigned sid;
  11. uid_t uid;
  12. gid_t gid;
  13. String state;
  14. pid_t ppid;
  15. unsigned nfds;
  16. String name;
  17. String tty;
  18. size_t amount_virtual;
  19. size_t amount_resident;
  20. size_t amount_shared;
  21. unsigned ticks;
  22. String priority;
  23. unsigned syscall_count;
  24. // synthetic
  25. String username;
  26. };
  27. class CProcessStatisticsReader {
  28. public:
  29. static HashMap<pid_t, CProcessStatistics> get_all();
  30. private:
  31. static String username_from_uid(uid_t);
  32. static HashMap<uid_t, String> s_usernames;
  33. };