ProcessTable.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef HEADER_ProcessTable
  2. #define HEADER_ProcessTable
  3. /*
  4. htop - ProcessTable.h
  5. (C) 2004,2005 Hisham H. Muhammad
  6. Released under the GNU GPLv2+, see the COPYING file
  7. in the source distribution for its full text.
  8. */
  9. #include <stdbool.h>
  10. #include <sys/types.h>
  11. #include "Hashtable.h"
  12. #include "Machine.h"
  13. #include "Object.h"
  14. #include "Process.h"
  15. #include "Table.h"
  16. typedef struct ProcessTable_ {
  17. Table super;
  18. Hashtable* pidMatchList;
  19. unsigned int totalTasks;
  20. unsigned int runningTasks;
  21. unsigned int userlandThreads;
  22. unsigned int kernelThreads;
  23. } ProcessTable;
  24. /* Implemented by platforms */
  25. ProcessTable* ProcessTable_new(Machine* host, Hashtable* pidMatchList);
  26. void ProcessTable_delete(Object* cast);
  27. void ProcessTable_goThroughEntries(ProcessTable* this);
  28. void ProcessTable_init(ProcessTable* this, const ObjectClass* klass, Machine* host, Hashtable* pidMatchList);
  29. void ProcessTable_done(ProcessTable* this);
  30. extern const TableClass ProcessTable_class;
  31. static inline void ProcessTable_add(ProcessTable* this, Process* process) {
  32. Table_add(&this->super, &process->super);
  33. }
  34. Process* ProcessTable_getProcess(ProcessTable* this, pid_t pid, bool* preExisting, Process_New constructor);
  35. static inline Process* ProcessTable_findProcess(ProcessTable* this, pid_t pid) {
  36. return (Process*) Table_findRow(&this->super, pid);
  37. }
  38. #endif