diff options
author | Nathan Scott <nathans@redhat.com> | 2023-08-31 11:56:43 +1000 |
---|---|---|
committer | Nathan Scott <nathans@redhat.com> | 2023-08-31 14:13:16 +1000 |
commit | b74673fe37fd379fc350789e696470556776d815 (patch) | |
tree | cbe4f036962c439f9c07a9c96302f5908f6410b0 | |
parent | 214166a049c2a6ac454dbb37b85b04c039a6a17a (diff) |
Rename ProcessList to ProcessTable throughout
Following up with some discusson from a few months back,
where it was proposed that ProcessTable is a better name.
This data structure is definitely not a list ... if it
was one-dimensional it'd be a set, but in practice it has
much more in common with a two-dimensional table.
The Process table is a familiar operating system concept
for many people too so it resonates a little in that way
as well.
-rw-r--r-- | Action.c | 2 | ||||
-rw-r--r-- | CPUMeter.c | 2 | ||||
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | ClockMeter.c | 2 | ||||
-rw-r--r-- | CommandLine.c | 8 | ||||
-rw-r--r-- | DateMeter.c | 2 | ||||
-rw-r--r-- | DateTimeMeter.c | 2 | ||||
-rw-r--r-- | DiskIOMeter.c | 2 | ||||
-rw-r--r-- | DynamicColumn.h | 2 | ||||
-rw-r--r-- | DynamicMeter.c | 2 | ||||
-rw-r--r-- | LoadAverageMeter.c | 2 | ||||
-rw-r--r-- | Makefile.am | 40 | ||||
-rw-r--r-- | NetworkIOMeter.c | 2 | ||||
-rw-r--r-- | Process.c | 8 | ||||
-rw-r--r-- | ProcessList.h | 59 | ||||
-rw-r--r-- | ProcessTable.c (renamed from ProcessList.c) | 34 | ||||
-rw-r--r-- | ProcessTable.h | 59 | ||||
-rw-r--r-- | ScreenManager.c | 2 | ||||
-rw-r--r-- | TESTPLAN | 2 | ||||
-rw-r--r-- | Table.c | 2 | ||||
-rw-r--r-- | TasksMeter.c | 16 | ||||
-rw-r--r-- | darwin/DarwinProcess.c | 12 | ||||
-rw-r--r-- | darwin/DarwinProcess.h | 4 | ||||
-rw-r--r-- | darwin/DarwinProcessTable.c (renamed from darwin/DarwinProcessList.c) | 42 | ||||
-rw-r--r-- | darwin/DarwinProcessTable.h (renamed from darwin/DarwinProcessList.h) | 14 | ||||
-rw-r--r-- | dragonflybsd/DragonFlyBSDMachine.c | 8 | ||||
-rw-r--r-- | dragonflybsd/DragonFlyBSDMachine.h | 2 | ||||
-rw-r--r-- | dragonflybsd/DragonFlyBSDProcessList.h | 21 | ||||
-rw-r--r-- | dragonflybsd/DragonFlyBSDProcessTable.c (renamed from dragonflybsd/DragonFlyBSDProcessList.c) | 42 | ||||
-rw-r--r-- | dragonflybsd/DragonFlyBSDProcessTable.h | 21 | ||||
-rw-r--r-- | dragonflybsd/Platform.c | 4 | ||||
-rw-r--r-- | freebsd/FreeBSDProcessTable.c (renamed from freebsd/FreeBSDProcessList.c) | 48 | ||||
-rw-r--r-- | freebsd/FreeBSDProcessTable.h (renamed from freebsd/FreeBSDProcessList.h) | 14 | ||||
-rw-r--r-- | linux/HugePageMeter.c | 2 | ||||
-rw-r--r-- | linux/LinuxMachine.c | 4 | ||||
-rw-r--r-- | linux/LinuxProcessTable.c (renamed from linux/LinuxProcessList.c) | 148 | ||||
-rw-r--r-- | linux/LinuxProcessTable.h (renamed from linux/LinuxProcessList.h) | 14 | ||||
-rw-r--r-- | linux/ZramStats.h | 2 | ||||
-rw-r--r-- | linux/ZswapStats.h | 2 | ||||
-rw-r--r-- | netbsd/NetBSDMachine.c | 8 | ||||
-rw-r--r-- | netbsd/NetBSDMachine.h | 2 | ||||
-rw-r--r-- | netbsd/NetBSDProcessTable.c (renamed from netbsd/NetBSDProcessList.c) | 48 | ||||
-rw-r--r-- | netbsd/NetBSDProcessTable.h (renamed from netbsd/NetBSDProcessList.h) | 14 | ||||
-rw-r--r-- | openbsd/OpenBSDMachine.c | 2 | ||||
-rw-r--r-- | openbsd/OpenBSDProcessTable.c (renamed from openbsd/OpenBSDProcessList.c) | 46 | ||||
-rw-r--r-- | openbsd/OpenBSDProcessTable.h (renamed from openbsd/OpenBSDProcessList.h) | 14 | ||||
-rw-r--r-- | pcp/PCPDynamicColumn.c | 2 | ||||
-rw-r--r-- | pcp/PCPMachine.c | 2 | ||||
-rw-r--r-- | pcp/PCPProcessTable.c (renamed from pcp/PCPProcessList.c) | 120 | ||||
-rw-r--r-- | pcp/PCPProcessTable.h (renamed from pcp/PCPProcessList.h) | 14 | ||||
-rw-r--r-- | pcp/Platform.c | 4 | ||||
-rw-r--r-- | solaris/SolarisProcess.c | 2 | ||||
-rw-r--r-- | solaris/SolarisProcessTable.c (renamed from solaris/SolarisProcessList.c) | 66 | ||||
-rw-r--r-- | solaris/SolarisProcessTable.h (renamed from solaris/SolarisProcessList.h) | 14 | ||||
-rw-r--r-- | unsupported/UnsupportedProcessList.h | 17 | ||||
-rw-r--r-- | unsupported/UnsupportedProcessTable.c (renamed from unsupported/UnsupportedProcessList.c) | 28 | ||||
-rw-r--r-- | unsupported/UnsupportedProcessTable.h | 17 |
57 files changed, 538 insertions, 538 deletions
@@ -27,7 +27,7 @@ in the source distribution for its full text. #include "MainPanel.h" #include "OpenFilesScreen.h" #include "Process.h" -#include "ProcessList.h" +#include "ProcessTable.h" #include "ProcessLocksScreen.h" #include "ProvideCurses.h" #include "Scheduling.h" @@ -16,7 +16,7 @@ in the source distribution for its full text. #include "Macros.h" #include "Object.h" #include "Platform.h" -#include "ProcessList.h" +#include "ProcessTable.h" #include "RichString.h" #include "Settings.h" #include "XUtils.h" @@ -53,7 +53,7 @@ What's new in version 3.2.1 * On Solaris, fix the build * On NetBSD, OpenBSD and Solaris ensure env buffer size is sufficient * On Linux, resolve processes exiting interfering with sampling -* Fix ProcessList quadratic removal when scanning processes +* Fix ProcessTable quadratic removal when scanning processes * Under LXC, limit CPU count to that given by /proc/cpuinfo * Improve container detection for LXC * Some minor documentation fixes diff --git a/ClockMeter.c b/ClockMeter.c index ee712ae2..82c3968b 100644 --- a/ClockMeter.c +++ b/ClockMeter.c @@ -14,7 +14,7 @@ in the source distribution for its full text. #include "CRT.h" #include "Object.h" -#include "ProcessList.h" +#include "ProcessTable.h" static const int ClockMeter_attributes[] = { diff --git a/CommandLine.c b/CommandLine.c index 2cd90516..effaca48 100644 --- a/CommandLine.c +++ b/CommandLine.c @@ -34,7 +34,7 @@ in the source distribution for its full text. #include "Panel.h" #include "Platform.h" #include "Process.h" -#include "ProcessList.h" +#include "ProcessTable.h" #include "ProvideCurses.h" #include "ScreenManager.h" #include "Settings.h" @@ -341,9 +341,9 @@ int CommandLine_run(int argc, char** argv) { Hashtable* ds = DynamicScreens_new(); Machine* host = Machine_new(ut, flags.userId); - ProcessList* pl = ProcessList_new(host, flags.pidMatchList); + ProcessTable* pt = ProcessTable_new(host, flags.pidMatchList); Settings* settings = Settings_new(host->activeCPUs, dm, dc, ds); - Machine_populateTablesFromSettings(host, settings, &pl->super); + Machine_populateTablesFromSettings(host, settings, &pt->super); Header* header = Header_new(host, 2); Header_populateFromSettings(header); @@ -402,7 +402,7 @@ int CommandLine_run(int argc, char** argv) { Machine_scanTables(host); if (settings->ss->allBranchesCollapsed) - Table_collapseAllBranches(&pl->super); + Table_collapseAllBranches(&pt->super); ScreenManager_run(scr, NULL, NULL, NULL); diff --git a/DateMeter.c b/DateMeter.c index b38f43b0..224de306 100644 --- a/DateMeter.c +++ b/DateMeter.c @@ -14,7 +14,7 @@ in the source distribution for its full text. #include "CRT.h" #include "Object.h" -#include "ProcessList.h" +#include "ProcessTable.h" static const int DateMeter_attributes[] = { diff --git a/DateTimeMeter.c b/DateTimeMeter.c index d46f3cb2..ebe72288 100644 --- a/DateTimeMeter.c +++ b/DateTimeMeter.c @@ -14,7 +14,7 @@ in the source distribution for its full text. #include "CRT.h" #include "Object.h" -#include "ProcessList.h" +#include "ProcessTable.h" static const int DateTimeMeter_attributes[] = { diff --git a/DiskIOMeter.c b/DiskIOMeter.c index 545ec008..4227dfa9 100644 --- a/DiskIOMeter.c +++ b/DiskIOMeter.c @@ -15,7 +15,7 @@ in the source distribution for its full text. #include "Meter.h" #include "Object.h" #include "Platform.h" -#include "ProcessList.h" +#include "ProcessTable.h" #include "RichString.h" #include "XUtils.h" diff --git a/DynamicColumn.h b/DynamicColumn.h index 3b0336a9..bdce82d2 100644 --- a/DynamicColumn.h +++ b/DynamicColumn.h @@ -25,7 +25,7 @@ typedef struct DynamicColumn_ { char* description; /* displayed in setup menu (detail) */ int width; /* display width +/- for value alignment */ bool enabled; /* false == ignore this column (until enabled) */ - Table* table; /* pointer to DynamicScreen or ProcessList */ + Table* table; /* pointer to DynamicScreen or ProcessTable */ } DynamicColumn; Hashtable* DynamicColumns_new(void); diff --git a/DynamicMeter.c b/DynamicMeter.c index 82e73a92..96b169d5 100644 --- a/DynamicMeter.c +++ b/DynamicMeter.c @@ -17,7 +17,7 @@ in the source distribution for its full text. #include "CRT.h" #include "Object.h" #include "Platform.h" -#include "ProcessList.h" +#include "ProcessTable.h" #include "RichString.h" #include "XUtils.h" diff --git a/LoadAverageMeter.c b/LoadAverageMeter.c index 0beae04b..be6215db 100644 --- a/LoadAverageMeter.c +++ b/LoadAverageMeter.c @@ -10,7 +10,7 @@ in the source distribution for its full text. #include "CRT.h" #include "Object.h" #include "Platform.h" -#include "ProcessList.h" +#include "ProcessTable.h" #include "RichString.h" #include "XUtils.h" diff --git a/Makefile.am b/Makefile.am index 90bd30ef..080411f3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -73,8 +73,8 @@ myhtopsources = \ OptionItem.c \ Panel.c \ Process.c \ - ProcessList.c \ ProcessLocksScreen.c \ + ProcessTable.c \ Row.c \ RichString.c \ Scheduling.c \ @@ -141,8 +141,8 @@ myhtopheaders = \ OptionItem.h \ Panel.h \ Process.h \ - ProcessList.h \ ProcessLocksScreen.h \ + ProcessTable.h \ ProvideCurses.h \ ProvideTerm.h \ RichString.h \ @@ -178,7 +178,7 @@ linux_platform_headers = \ linux/LibSensors.h \ linux/LinuxMachine.h \ linux/LinuxProcess.h \ - linux/LinuxProcessList.h \ + linux/LinuxProcessTable.h \ linux/Platform.h \ linux/PressureStallMeter.h \ linux/ProcessField.h \ @@ -201,7 +201,7 @@ linux_platform_sources = \ linux/LibSensors.c \ linux/LinuxMachine.c \ linux/LinuxProcess.c \ - linux/LinuxProcessList.c \ + linux/LinuxProcessTable.c \ linux/Platform.c \ linux/PressureStallMeter.c \ linux/SELinuxMeter.c \ @@ -221,7 +221,7 @@ endif freebsd_platform_headers = \ freebsd/FreeBSDMachine.h \ - freebsd/FreeBSDProcessList.h \ + freebsd/FreeBSDProcessTable.h \ freebsd/FreeBSDProcess.h \ freebsd/Platform.h \ freebsd/ProcessField.h \ @@ -237,7 +237,7 @@ freebsd_platform_headers = \ freebsd_platform_sources = \ freebsd/Platform.c \ freebsd/FreeBSDMachine.c \ - freebsd/FreeBSDProcessList.c \ + freebsd/FreeBSDProcessTable.c \ freebsd/FreeBSDProcess.c \ generic/fdstat_sysctl.c \ generic/gettime.c \ @@ -257,7 +257,7 @@ endif dragonflybsd_platform_headers = \ dragonflybsd/DragonFlyBSDMachine.h \ - dragonflybsd/DragonFlyBSDProcessList.h \ + dragonflybsd/DragonFlyBSDProcessTable.h \ dragonflybsd/DragonFlyBSDProcess.h \ dragonflybsd/Platform.h \ dragonflybsd/ProcessField.h \ @@ -268,7 +268,7 @@ dragonflybsd_platform_headers = \ dragonflybsd_platform_sources = \ dragonflybsd/DragonFlyBSDMachine.c \ - dragonflybsd/DragonFlyBSDProcessList.c \ + dragonflybsd/DragonFlyBSDProcessTable.c \ dragonflybsd/DragonFlyBSDProcess.c \ dragonflybsd/Platform.c \ generic/fdstat_sysctl.c \ @@ -293,7 +293,7 @@ netbsd_platform_headers = \ netbsd/ProcessField.h \ netbsd/NetBSDMachine.h \ netbsd/NetBSDProcess.h \ - netbsd/NetBSDProcessList.h + netbsd/NetBSDProcessTable.h netbsd_platform_sources = \ generic/fdstat_sysctl.c \ @@ -303,7 +303,7 @@ netbsd_platform_sources = \ netbsd/Platform.c \ netbsd/NetBSDMachine.c \ netbsd/NetBSDProcess.c \ - netbsd/NetBSDProcessList.c + netbsd/NetBSDProcessTable.c if HTOP_NETBSD myhtopplatheaders = $(netbsd_platform_headers) @@ -318,7 +318,7 @@ openbsd_platform_headers = \ generic/hostname.h \ generic/uname.h \ openbsd/OpenBSDMachine.h \ - openbsd/OpenBSDProcessList.h \ + openbsd/OpenBSDProcessTable.h \ openbsd/OpenBSDProcess.h \ openbsd/Platform.h \ openbsd/ProcessField.h @@ -328,7 +328,7 @@ openbsd_platform_sources = \ generic/hostname.c \ generic/uname.c \ openbsd/OpenBSDMachine.c \ - openbsd/OpenBSDProcessList.c \ + openbsd/OpenBSDProcessTable.c \ openbsd/OpenBSDProcess.c \ openbsd/Platform.c @@ -343,7 +343,7 @@ endif darwin_platform_headers = \ darwin/DarwinMachine.h \ darwin/DarwinProcess.h \ - darwin/DarwinProcessList.h \ + darwin/DarwinProcessTable.h \ darwin/Platform.h \ darwin/PlatformHelpers.h \ darwin/ProcessField.h \ @@ -361,7 +361,7 @@ darwin_platform_sources = \ darwin/PlatformHelpers.c \ darwin/DarwinMachine.c \ darwin/DarwinProcess.c \ - darwin/DarwinProcessList.c \ + darwin/DarwinProcessTable.c \ generic/fdstat_sysctl.c \ generic/gettime.c \ generic/hostname.c \ @@ -387,7 +387,7 @@ solaris_platform_headers = \ solaris/Platform.h \ solaris/SolarisMachine.h \ solaris/SolarisProcess.h \ - solaris/SolarisProcessList.h \ + solaris/SolarisProcessTable.h \ zfs/ZfsArcMeter.h \ zfs/ZfsArcStats.h \ zfs/ZfsCompressedArcMeter.h @@ -399,7 +399,7 @@ solaris_platform_sources = \ solaris/Platform.c \ solaris/SolarisMachine.c \ solaris/SolarisProcess.c \ - solaris/SolarisProcessList.c \ + solaris/SolarisProcessTable.c \ zfs/ZfsArcMeter.c \ zfs/ZfsCompressedArcMeter.c @@ -426,7 +426,7 @@ pcp_platform_headers = \ pcp/PCPDynamicScreen.h \ pcp/PCPMachine.h \ pcp/PCPProcess.h \ - pcp/PCPProcessList.h \ + pcp/PCPProcessTable.h \ zfs/ZfsArcMeter.h \ zfs/ZfsArcStats.h \ zfs/ZfsCompressedArcMeter.h @@ -444,7 +444,7 @@ pcp_platform_sources = \ pcp/PCPDynamicScreen.c \ pcp/PCPMachine.c \ pcp/PCPProcess.c \ - pcp/PCPProcessList.c \ + pcp/PCPProcessTable.c \ zfs/ZfsArcMeter.c \ zfs/ZfsCompressedArcMeter.c @@ -463,14 +463,14 @@ unsupported_platform_headers = \ unsupported/ProcessField.h \ unsupported/UnsupportedMachine.h \ unsupported/UnsupportedProcess.h \ - unsupported/UnsupportedProcessList.h + unsupported/UnsupportedProcessTable.h unsupported_platform_sources = \ generic/gettime.c \ unsupported/Platform.c \ unsupported/UnsupportedMachine.c \ unsupported/UnsupportedProcess.c \ - unsupported/UnsupportedProcessList.c + unsupported/UnsupportedProcessTable.c if HTOP_UNSUPPORTED myhtopplatsources = $(unsupported_platform_sources) diff --git a/NetworkIOMeter.c b/NetworkIOMeter.c index 5945bae7..90991590 100644 --- a/NetworkIOMeter.c +++ b/NetworkIOMeter.c @@ -9,7 +9,7 @@ #include "Object.h" #include "Platform.h" #include "Process.h" -#include "ProcessList.h" +#include "ProcessTable.h" #include "RichString.h" #include "XUtils.h" @@ -25,7 +25,7 @@ in the source distribution for its full text. #include "CRT.h" #include "Macros.h" #include "Platform.h" -#include "ProcessList.h" +#include "ProcessTable.h" #include "DynamicColumn.h" #include "RichString.h" #include "Scheduling.h" @@ -826,9 +826,9 @@ static bool Process_matchesFilter(const Process* this, const Table* table) { if (incFilter && !String_contains_i(Process_getCommand(this), incFilter, true)) return true; - const ProcessList* pl = (const ProcessList*) host->activeTable; - assert(Object_isA((const Object*) pl, (const ObjectClass*) &ProcessList_class)); - if (pl->pidMatchList && !Hashtable_get(pl->pidMatchList, Process_getThreadGroup(this))) + const ProcessTable* pt = (const ProcessTable*) host->activeTable; + assert(Object_isA((const Object*) pt, (const ObjectClass*) &ProcessTable_class)); + if (pt->pidMatchList && !Hashtable_get(pt->pidMatchList, Process_getThreadGroup(this))) return true; return false; diff --git a/ProcessList.h b/ProcessList.h deleted file mode 100644 index 9710a0a5..00000000 --- a/ProcessList.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef HEADER_ProcessList -#define HEADER_ProcessList -/* -htop - ProcessList.h -(C) 2004,2005 Hisham H. Muhammad -Released under the GNU GPLv2+, see the COPYING file -in the source distribution for its full text. -*/ - -#include "config.h" // IWYU pragma: keep - -#include <limits.h> -#include <stdbool.h> -#include <stdint.h> -#include <sys/time.h> -#include <sys/types.h> - -#include "Hashtable.h" -#include "Machine.h" -#include "Object.h" -#include "Panel.h" -#include "Process.h" -#include "RichString.h" -#include "Table.h" - - -typedef struct ProcessList_ { - Table super; - - Hashtable* pidMatchList; - - unsigned int totalTasks; - unsigned int runningTasks; - unsigned int userlandThreads; - unsigned int kernelThreads; -} ProcessList; - -/* Implemented by platforms */ -ProcessList* ProcessList_new(Machine* host, Hashtable* pidMatchList); -void ProcessList_delete(Object* cast); -void ProcessList_goThroughEntries(ProcessList* this); - -void ProcessList_init(ProcessList* this, const ObjectClass* klass, Machine* host, Hashtable* pidMatchList); - -void ProcessList_done(ProcessList* this); - -extern const TableClass ProcessList_class; - -static inline void ProcessList_add(ProcessList* this, Process* process) { - Table_add(&this->super, &process->super); -} - -Process* ProcessList_getProcess(ProcessList* this, pid_t pid, bool* preExisting, Process_New constructor); - -static inline Process* ProcessList_findProcess(ProcessList* this, pid_t pid) { - return (Process*) Table_findRow(&this->super, pid); -} - -#endif diff --git a/ProcessList.c b/ProcessTable.c index 516dcd7c..39e3eb87 100644 --- a/ProcessList.c +++ b/ProcessTable.c @@ -1,11 +1,11 @@ /* -htop - ProcessList.c +htop - ProcessTable.c (C) 2004,2005 Hisham H. Muhammad Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ -#include "ProcessList.h" +#include "ProcessTable.h" #include <assert.h> #include <stdlib.h> @@ -20,17 +20,17 @@ in the source distribution for its full text. #include "XUtils.h" -void ProcessList_init(ProcessList* this, const ObjectClass* klass, Machine* host, Hashtable* pidMatchList) { +void ProcessTable_init(ProcessTable* this, const ObjectClass* klass, Machine* host, Hashtable* pidMatchList) { Table_init(&this->super, klass, host); this->pidMatchList = pidMatchList; } -void ProcessList_done(ProcessList* this) { +void ProcessTable_done(ProcessTable* this) { Table_done(&this->super); } -Process* ProcessList_getProcess(ProcessList* this, pid_t pid, bool* preExisting, Process_New constructor) { +Process* ProcessTable_getProcess(ProcessTable* this, pid_t pid, bool* preExisting, Process_New constructor) { const Table* table = &this->super; Process* proc = (Process*) Hashtable_get(table->table, pid); *preExisting = proc != NULL; @@ -45,8 +45,8 @@ Process* ProcessList_getProcess(ProcessList* this, pid_t pid, bool* preExisting, return proc; } -static void ProcessList_prepareEntries(Table* super) { - ProcessList* this = (ProcessList*) super; +static void ProcessTable_prepareEntries(Table* super) { + ProcessTable* this = (ProcessTable*) super; this->totalTasks = 0; this->userlandThreads = 0; this->kernelThreads = 0; @@ -55,13 +55,13 @@ static void ProcessList_prepareEntries(Table* super) { Table_prepareEntries(super); } -static void ProcessList_iterateEntries(Table* super) { - ProcessList* this = (ProcessList*) super; +static void ProcessTable_iterateEntries(Table* super) { + ProcessTable* this = (ProcessTable*) super; // calling into platform-specific code - ProcessList_goThroughEntries(this); + ProcessTable_goThroughEntries(this); } -static void ProcessList_cleanupEntries(Table* super) { +static void ProcessTable_cleanupEntries(Table* super) { Machine* host = super->host; const Settings* settings = host->settings; @@ -69,7 +69,7 @@ static void ProcessList_cleanupEntries(Table* super) { for (int i = Vector_size(super->rows) - 1; i >= 0; i--) { Process* p = (Process*) Vector_get(super->rows, i); - // tidy up Process state after refreshing the ProcessList table + // tidy up Process state after refreshing the ProcessTable table Process_makeCommandStr(p, settings); // keep track of the highest UID for column scaling @@ -83,12 +83,12 @@ static void ProcessList_cleanupEntries(Table* super) { Table_compact(super); } -const TableClass ProcessList_class = { +const TableClass ProcessTable_class = { .super = { .extends = Class(Table), - .delete = ProcessList_delete, + .delete = ProcessTable_delete, }, - .prepare = ProcessList_prepareEntries, - .iterate = ProcessList_iterateEntries, - .cleanup = ProcessList_cleanupEntries, + .prepare = ProcessTable_prepareEntries, + .iterate = ProcessTable_iterateEntries, + .cleanup = ProcessTable_cleanupEntries, }; diff --git a/ProcessTable.h b/ProcessTable.h new file mode 100644 index 00000000..ceaabc79 --- /dev/null +++ b/ProcessTable.h @@ -0,0 +1,59 @@ +#ifndef HEADER_ProcessTable +#define HEADER_ProcessTable +/* +htop - ProcessTable.h +(C) 2004,2005 Hisham H. Muhammad +Released under the GNU GPLv2+, see the COPYING file +in the source distribution for its full text. +*/ + +#include "config.h" // IWYU pragma: keep + +#include <limits.h> +#include <stdbool.h> +#include <stdint.h> +#include <sys/time.h> +#include <sys/types.h> + +#include "Hashtable.h" +#include "Machine.h" +#include "Object.h" +#include "Panel.h" +#include "Process.h" +#include "RichString.h" +#include "Table.h" + + +typedef struct ProcessTable_ { + Table super; + + Hashtable* pidMatchList; + + unsigned int totalTasks; + unsigned int runningTasks; + unsigned int userlandThreads; + unsigned int kernelThreads; +} ProcessTable; + +/* Implemented by platforms */ +ProcessTable* ProcessTable_new(Machine* host, Hashtable* pidMatchList); +void ProcessTable_delete(Object* cast); +void ProcessTable_goThroughEntries(ProcessTable* this); + +void ProcessTable_init(ProcessTable* this, const ObjectClass* klass, Machine* host, Hashtable* pidMatchList); + +void ProcessTable_done(ProcessTable* this); + +extern const TableClass ProcessTable_class; + +static inline void ProcessTable_add(ProcessTable* this, Process* process) { + Table_add(&this->super, &process->super); +} + +Process* ProcessTable_getProcess(ProcessTable* this, pid_t pid, bool* preExisting, Process_New constructor); + +static inline Process* ProcessTable_findProcess(ProcessTable* this, pid_t pid) { + return (Process*) Table_findRow(&this->super, pid); +} + +#endif diff --git a/ScreenManager.c b/ScreenManager.c index 6c1dd12e..f4d59a42 100644 --- a/ScreenManager.c +++ b/ScreenManager.c @@ -20,7 +20,7 @@ in the source distribution for its full text. #include "Macros.h" #include "Object.h" #include "Platform.h" -#include "ProcessList.h" +#include "ProcessTable.h" #include "ProvideCurses.h" #include "XUtils.h" |