From 69f439eff387a6ecb52734e400b297a3c85f2285 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Tue, 21 Sep 2021 08:35:19 +0200 Subject: New upstream version 3.1.0 --- ProcessList.h | 61 +++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 21 deletions(-) (limited to 'ProcessList.h') diff --git a/ProcessList.h b/ProcessList.h index b7ae400..7cd2fab 100644 --- a/ProcessList.h +++ b/ProcessList.h @@ -9,7 +9,10 @@ in the source distribution for its full text. #include "config.h" // IWYU pragma: keep +#include #include +#include +#include #include #include "Hashtable.h" @@ -34,6 +37,9 @@ in the source distribution for its full text. #define MAX_READ 2048 #endif +typedef unsigned long long int memory_t; +#define MEMORY_MAX ULLONG_MAX + typedef struct ProcessList_ { const Settings* settings; @@ -45,6 +51,13 @@ typedef struct ProcessList_ { Hashtable* displayTreeSet; Hashtable* draftingTreeSet; + Hashtable* dynamicMeters; /* runtime-discovered meters */ + Hashtable* dynamicColumns; /* runtime-discovered Columns */ + + struct timeval realtime; /* time of the current sample */ + uint64_t realtimeMs; /* current time in milliseconds */ + uint64_t monotonicMs; /* same, but from monotonic clock */ + Panel* panel; int following; uid_t userId; @@ -56,44 +69,44 @@ typedef struct ProcessList_ { bool topologyOk; #endif - int totalTasks; - int runningTasks; - int userlandThreads; - int kernelThreads; + unsigned int totalTasks; + unsigned int runningTasks; + unsigned int userlandThreads; + unsigned int kernelThreads; - unsigned long long int totalMem; - unsigned long long int usedMem; - unsigned long long int buffersMem; - unsigned long long int cachedMem; - unsigned long long int totalSwap; - unsigned long long int usedSwap; - unsigned long long int freeSwap; + memory_t totalMem; + memory_t usedMem; + memory_t buffersMem; + memory_t cachedMem; + memory_t sharedMem; + memory_t availableMem; - int cpuCount; + memory_t totalSwap; + memory_t usedSwap; + memory_t cachedSwap; - time_t scanTs; + unsigned int activeCPUs; + unsigned int existingCPUs; } ProcessList; -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId); +/* Implemented by platforms */ +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId); void ProcessList_delete(ProcessList* pl); void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate); +bool ProcessList_isCPUonline(const ProcessList* super, unsigned int id); -ProcessList* ProcessList_init(ProcessList* this, const ObjectClass* klass, UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId); +ProcessList* ProcessList_init(ProcessList* this, const ObjectClass* klass, UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId); void ProcessList_done(ProcessList* this); void ProcessList_setPanel(ProcessList* this, Panel* panel); -void ProcessList_printHeader(ProcessList* this, RichString* header); +void ProcessList_printHeader(const ProcessList* this, RichString* header); void ProcessList_add(ProcessList* this, Process* p); -void ProcessList_remove(ProcessList* this, Process* p); - -Process* ProcessList_get(ProcessList* this, int idx); - -int ProcessList_size(ProcessList* this); +void ProcessList_remove(ProcessList* this, const Process* p); void ProcessList_sort(ProcessList* this); @@ -101,10 +114,16 @@ ProcessField ProcessList_keyAt(const ProcessList* this, int at); void ProcessList_expandTree(ProcessList* this); +void ProcessList_collapseAllBranches(ProcessList* this); + void ProcessList_rebuildPanel(ProcessList* this); Process* ProcessList_getProcess(ProcessList* this, pid_t pid, bool* preExisting, Process_New constructor); void ProcessList_scan(ProcessList* this, bool pauseProcessUpdate); +static inline Process* ProcessList_findProcess(ProcessList* this, pid_t pid) { + return (Process*) Hashtable_get(this->processTable, pid); +} + #endif -- cgit v1.2.3