summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2023-04-04 16:24:37 +1000
committerBenBE <BenBE@geshi.org>2023-04-06 00:19:54 +0200
commite7f447b6a3473a572d3e6c191128f1796477860d (patch)
tree1e8a90d216055dfe77b688fc48c0a42f18637d71
parentc8a61850dd31ab64eb8ad83929ce86d2adbeb96c (diff)
Refactor and consolidate dynamic meters/columns pointers
This removes the duplication of dynamic meter/column hashtable pointers that has come in between the Settings and ProcessList structures - only one copy of these is needed. With the future planned dynamic screens feature adding another pointer, let us first clean this up before any further duplication happens.
-rw-r--r--AvailableMetersPanel.c9
-rw-r--r--CommandLine.c6
-rw-r--r--DynamicMeter.c8
-rw-r--r--Header.c9
-rw-r--r--ProcessList.c47
-rw-r--r--ProcessList.h7
-rw-r--r--Settings.c3
-rw-r--r--Settings.h5
-rw-r--r--darwin/DarwinProcessList.c4
-rw-r--r--darwin/DarwinProcessList.h2
-rw-r--r--dragonflybsd/DragonFlyBSDProcessList.c4
-rw-r--r--dragonflybsd/DragonFlyBSDProcessList.h2
-rw-r--r--freebsd/FreeBSDProcessList.c4
-rw-r--r--freebsd/FreeBSDProcessList.h2
-rw-r--r--linux/LinuxProcessList.c4
-rw-r--r--linux/LinuxProcessList.h2
-rw-r--r--netbsd/NetBSDProcessList.c4
-rw-r--r--netbsd/NetBSDProcessList.h2
-rw-r--r--openbsd/OpenBSDProcessList.c4
-rw-r--r--openbsd/OpenBSDProcessList.h2
-rw-r--r--pcp/PCPDynamicColumn.c2
-rw-r--r--pcp/PCPProcessList.c4
-rw-r--r--pcp/PCPProcessList.h2
-rw-r--r--solaris/SolarisProcessList.c4
-rw-r--r--solaris/SolarisProcessList.h2
-rw-r--r--unsupported/UnsupportedProcessList.c4
-rw-r--r--unsupported/UnsupportedProcessList.h2
27 files changed, 78 insertions, 72 deletions
diff --git a/AvailableMetersPanel.c b/AvailableMetersPanel.c
index c7ab89be..aa6d7795 100644
--- a/AvailableMetersPanel.c
+++ b/AvailableMetersPanel.c
@@ -128,10 +128,11 @@ static void AvailableMetersPanel_addDynamicMeter(ATTR_UNUSED ht_key_t key, void*
}
// Handle (&DynamicMeter_class) entries in the AvailableMetersPanel
-static void AvailableMetersPanel_addDynamicMeters(Panel* super, const ProcessList* pl, unsigned int offset) {
+static void AvailableMetersPanel_addDynamicMeters(Panel* super, const Settings* settings, unsigned int offset) {
DynamicIterator iter = { .super = super, .id = 1, .offset = offset };
- assert(pl->dynamicMeters != NULL);
- Hashtable_foreach(pl->dynamicMeters, AvailableMetersPanel_addDynamicMeter, &iter);
+ Hashtable* dynamicMeters = settings->dynamicColumns;
+ assert(dynamicMeters != NULL);
+ Hashtable_foreach(dynamicMeters, AvailableMetersPanel_addDynamicMeter, &iter);
}
// Handle remaining Platform Meter entries in the AvailableMetersPanel
@@ -161,7 +162,7 @@ AvailableMetersPanel* AvailableMetersPanel_new(Settings* settings, Header* heade
const MeterClass* type = Platform_meterTypes[i];
assert(type != &CPUMeter_class);
if (type == &DynamicMeter_class)
- AvailableMetersPanel_addDynamicMeters(super, pl, i);
+ AvailableMetersPanel_addDynamicMeters(super, settings, i);
else
AvailableMetersPanel_addPlatformMeter(super, type, i);
}
diff --git a/CommandLine.c b/CommandLine.c
index 682e0542..83359206 100644
--- a/CommandLine.c
+++ b/CommandLine.c
@@ -322,14 +322,14 @@ int CommandLine_run(const char* name, int argc, char** argv) {
Process_setupColumnWidths();
UsersTable* ut = UsersTable_new();
- Hashtable* dc = DynamicColumns_new();
Hashtable* dm = DynamicMeters_new();
+ Hashtable* dc = DynamicColumns_new();
if (!dc)
dc = Hashtable_new(0, true);
- ProcessList* pl = ProcessList_new(ut, dm, dc, flags.pidMatchList, flags.userId);
+ ProcessList* pl = ProcessList_new(ut, flags.pidMatchList, flags.userId);
- Settings* settings = Settings_new(pl->activeCPUs, dc);
+ Settings* settings = Settings_new(pl->activeCPUs, dm, dc);
pl->settings = settings;
Header* header = Header_new(pl, settings, 2);
diff --git a/DynamicMeter.c b/DynamicMeter.c
index a8cd76cc..40c06bb6 100644
--- a/DynamicMeter.c
+++ b/DynamicMeter.c
@@ -88,16 +88,16 @@ static void DynamicMeter_display(const Object* cast, RichString* out) {
}
static const char* DynamicMeter_getCaption(const Meter* this) {
- const ProcessList* pl = this->pl;
- const DynamicMeter* meter = Hashtable_get(pl->dynamicMeters, this->param);
+ const Settings* settings = this->pl->settings;
+ const DynamicMeter* meter = Hashtable_get(settings->dynamicMeters, this->param);
if (meter)
return meter->caption ? meter->caption : meter->name;
return this->caption;
}
static void DynamicMeter_getUiName(const Meter* this, char* name, size_t length) {
- const ProcessList* pl = this->pl;
- const DynamicMeter* meter = Hashtable_get(pl->dynamicMeters, this->param);
+ const Settings* settings = this->pl->settings;
+ const DynamicMeter* meter = Hashtable_get(settings->dynamicMeters, this->param);
if (meter) {
const char* uiName = meter->caption;
if (uiName) {
diff --git a/Header.c b/Header.c
index 1953c020..b2fc56cc 100644
--- a/Header.c
+++ b/Header.c
@@ -92,7 +92,7 @@ static void Header_addMeterByName(Header* this, const char* name, MeterModeId mo
if ((end = strrchr(dynamic, ')')) == NULL)
return; // htoprc parse failure
*end = '\0';
- if (!DynamicMeter_search(this->pl->dynamicMeters, dynamic, &param))
+ if (!DynamicMeter_search(this->settings->dynamicMeters, dynamic, &param))
return; // name lookup failure
} else {
param = 0;
@@ -130,10 +130,11 @@ void Header_populateFromSettings(Header* this) {
}
void Header_writeBackToSettings(const Header* this) {
- Settings_setHeaderLayout(this->settings, this->headerLayout);
+ Settings* settings = this->settings;
+ Settings_setHeaderLayout(settings, this->headerLayout);
Header_forEachColumn(this, col) {
- MeterColumnSetting* colSettings = &this->settings->hColumns[col];
+ MeterColumnSetting* colSettings = &settings->hColumns[col];
if (colSettings->names) {
for (size_t j = 0; j < colSettings->len; j++)
@@ -153,7 +154,7 @@ void Header_writeBackToSettings(const Header* this) {
const Meter* meter = (Meter*) Vector_get(vec, i);
char* name;
if (meter->param && As_Meter(meter) == &DynamicMeter_class) {
- const char* dynamic = DynamicMeter_lookup(this->pl->dynamicMeters, meter->param);
+ const char* dynamic = DynamicMeter_lookup(settings->dynamicMeters, meter->param);
xAsprintf(&name, "%s(%s)", As_Meter(meter)->name, dynamic);
} else if (meter->param && As_Meter(meter) == &CPUMeter_class) {
xAsprintf(&name, "%s(%u)", As_Meter(meter)->name, meter->param);
diff --git a/ProcessList.c b/ProcessList.c
index d1156789..9d213d1d 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -20,7 +20,7 @@ in the source distribution for its full text.
#include "XUtils.h"
-ProcessList* ProcessList_init(ProcessList* this, const ObjectClass* klass, UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId) {
+ProcessList* ProcessList_init(ProcessList* this, const ObjectClass* klass, UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
this->processes = Vector_new(klass, true, DEFAULT_SIZE);
this->displayList = Vector_new(klass, false, DEFAULT_SIZE);
@@ -29,8 +29,6 @@ ProcessList* ProcessList_init(ProcessList* this, const ObjectClass* klass, Users
this->usersTable = usersTable;
this->pidMatchList = pidMatchList;
- this->dynamicMeters = dynamicMeters;
- this->dynamicColumns = dynamicColumns;
this->userId = userId;
@@ -82,8 +80,9 @@ void ProcessList_setPanel(ProcessList* this, Panel* panel) {
this->panel = panel;
}
-static const char* alignedDynamicColumnTitle(const ProcessList* this, int key, char* titleBuffer, size_t titleBufferSize) {
- const DynamicColumn* column = Hashtable_get(this->dynamicColumns, key);
+// helper function to fill an aligned title string for a dynamic column
+static const char* alignedTitleDynamicColumn(const Settings* settings, int key, char* titleBuffer, size_t titleBufferSize) {
+ const DynamicColumn* column = Hashtable_get(settings->dynamicColumns, key);
if (column == NULL)
return "- ";
int width = column->width;
@@ -93,40 +92,45 @@ static const char* alignedDynamicColumnTitle(const ProcessList* this, int key, c
return titleBuffer;
}
-static const char* alignedProcessFieldTitle(const ProcessList* this, ProcessField field) {
- static char titleBuffer[UINT8_MAX + sizeof(" ")];
- assert(sizeof(titleBuffer) >= DYNAMIC_MAX_COLUMN_WIDTH + sizeof(" "));
- assert(sizeof(titleBuffer) >= PROCESS_MAX_PID_DIGITS + sizeof(" "));
- assert(sizeof(titleBuffer) >= PROCESS_MAX_UID_DIGITS + sizeof(" "));
-
- if (field >= LAST_PROCESSFIELD)
- return alignedDynamicColumnTitle(this, field, titleBuffer, sizeof(titleBuffer));
-
+// helper function to fill an aligned title string for a process field
+static const char* alignedTitleProcessField(ProcessField field, char* titleBuffer, size_t titleBufferSize) {
const char* title = Process_fields[field].title;
if (!title)
return "- ";
if (Process_fields[field].pidColumn) {
- xSnprintf(titleBuffer, sizeof(titleBuffer), "%*s ", Process_pidDigits, title);
+ xSnprintf(titleBuffer, titleBufferSize, "%*s ", Process_pidDigits, title);
return titleBuffer;
}
if (field == ST_UID) {
- xSnprintf(titleBuffer, sizeof(titleBuffer), "%*s ", Process_uidDigits, title);
+ xSnprintf(titleBuffer, titleBufferSize, "%*s ", Process_uidDigits, title);
return titleBuffer;
}
if (Process_fields[field].autoWidth) {
if (field == PERCENT_CPU)
- xSnprintf(titleBuffer, sizeof(titleBuffer), "%*s ", Process_fieldWidths[field], title);
+ xSnprintf(titleBuffer, titleBufferSize, "%*s ", Process_fieldWidths[field], title);
else
- xSnprintf(titleBuffer, sizeof(titleBuffer), "%-*.*s ", Process_fieldWidths[field], Process_fieldWidths[field], title);
+ xSnprintf(titleBuffer, titleBufferSize, "%-*.*s ", Process_fieldWidths[field], Process_fieldWidths[field], title);
return titleBuffer;
}
return title;
}
+// helper function to create an aligned title string for a given field
+static const char* ProcessField_alignedTitle(const Settings* settings, ProcessField field) {
+ static char titleBuffer[UINT8_MAX + sizeof(" ")];
+ assert(sizeof(titleBuffer) >= DYNAMIC_MAX_COLUMN_WIDTH + sizeof(" "));
+ assert(sizeof(titleBuffer) >= PROCESS_MAX_PID_DIGITS + sizeof(" "));
+ assert(sizeof(titleBuffer) >= PROCESS_MAX_UID_DIGITS + sizeof(" "));
+
+ if (field < LAST_PROCESSFIELD)
+ return alignedTitleProcessField(field, titleBuffer, sizeof(titleBuffer));
+ return alignedTitleDynamicColumn(settings, field, titleBuffer, sizeof(titleBuffer));
+}
+
void ProcessList_printHeader(const ProcessList* this, RichString* header) {
RichString_rewind(header, RichString_size(header));
@@ -146,7 +150,7 @@ void ProcessList_printHeader(const ProcessList* this, RichString* header) {
color = CRT_colors[PANEL_HEADER_FOCUS];
}
- RichString_appendWide(header, color, alignedProcessFieldTitle(this, fields[i]));
+ RichString_appendWide(header, color, ProcessField_alignedTitle(settings, fields[i]));
if (key == fields[i] && RichString_getCharVal(*header, RichString_size(header) - 1) == ' ') {
bool ascending = ScreenSettings_getActiveDirection(ss) == 1;
RichString_rewind(header, 1); // rewind to override space
@@ -337,10 +341,11 @@ void ProcessList_updateDisplayList(ProcessList* this) {
ProcessField ProcessList_keyAt(const ProcessList* this, int at) {
int x = 0;
- const ProcessField* fields = this->settings->ss->fields;
+ const Settings* settings = this->settings;
+ const ProcessField* fields = settings->ss->fields;
ProcessField field;
for (int i = 0; (field = fields[i]); i++) {
- int len = strlen(alignedProcessFieldTitle(this, field));
+ int len = strlen(ProcessField_alignedTitle(settings, field));
if (at >= x && at <= x + len) {
return field;
}
diff --git a/ProcessList.h b/ProcessList.h
index 419dea89..eab122a3 100644
--- a/ProcessList.h
+++ b/ProcessList.h
@@ -51,9 +51,6 @@ typedef struct ProcessList_ {
bool needsSort;
- 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 */
@@ -90,13 +87,13 @@ typedef struct ProcessList_ {
} ProcessList;
/* Implemented by platforms */
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId);
+ProcessList* ProcessList_new(UsersTable* usersTable, 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* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId);
+ProcessList* ProcessList_init(ProcessList* this, const ObjectClass* klass, UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
void ProcessList_done(ProcessList* this);
diff --git a/Settings.c b/Settings.c
index 8543b9e4..c712966e 100644
--- a/Settings.c
+++ b/Settings.c
@@ -667,10 +667,11 @@ int Settings_write(const Settings* this, bool onCrash) {
return r;
}
-Settings* Settings_new(unsigned int initialCpuCount, Hashtable* dynamicColumns) {
+Settings* Settings_new(unsigned int initialCpuCount, Hashtable* dynamicMeters, Hashtable* dynamicColumns) {
Settings* this = xCalloc(1, sizeof(Settings));
this->dynamicColumns = dynamicColumns;
+ this->dynamicMeters = dynamicMeters;
this->hLayout = HF_TWO_50_50;
this->hColumns = xCalloc(HeaderLayout_getColumns(this->hLayout), sizeof(MeterColumnSetting));
diff --git a/Settings.h b/Settings.h
index baf05da3..48c62590 100644
--- a/Settings.h
+++ b/Settings.h
@@ -51,7 +51,8 @@ typedef struct Settings_ {
int config_version;
HeaderLayout hLayout;
MeterColumnSetting* hColumns;
- Hashtable* dynamicColumns;
+ Hashtable* dynamicColumns; /* runtime-discovered columns */
+ Hashtable* dynamicMeters; /* runtime-discovered meters */
ScreenSettings** screens;
unsigned int nScreens;
@@ -117,7 +118,7 @@ void Settings_delete(Settings* this);
int Settings_write(const Settings* this, bool onCrash);
-Settings* Settings_new(unsigned int initialCpuCount, Hashtable* dynamicColumns);
+Settings* Settings_new(unsigned int initialCpuCount, Hashtable* dynamicMeters, Hashtable* dynamicColumns);
ScreenSettings* Settings_newScreen(Settings* this, const ScreenDefaults* defaults);
diff --git a/darwin/DarwinProcessList.c b/darwin/DarwinProcessList.c
index dae588ba..f7f1e592 100644
--- a/darwin/DarwinProcessList.c
+++ b/darwin/DarwinProcessList.c
@@ -89,10 +89,10 @@ static struct kinfo_proc* ProcessList_getKInfoProcs(size_t* count) {
CRT_fatalError("Unable to get kinfo_procs");
}
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId) {
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
DarwinProcessList* this = xCalloc(1, sizeof(DarwinProcessList));
- ProcessList_init(&this->super, Class(DarwinProcess), usersTable, dynamicMeters, dynamicColumns, pidMatchList, userId);
+ ProcessList_init(&this->super, Class(DarwinProcess), usersTable, pidMatchList, userId);
/* Initialize the CPU information */
this->super.activeCPUs = ProcessList_allocateCPULoadInfo(&this->prev_load);
diff --git a/darwin/DarwinProcessList.h b/darwin/DarwinProcessList.h
index 393e6567..ec504bcf 100644
--- a/darwin/DarwinProcessList.h
+++ b/darwin/DarwinProcessList.h
@@ -28,7 +28,7 @@ typedef struct DarwinProcessList_ {
ZfsArcStats zfs;
} DarwinProcessList;
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId);
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
void ProcessList_delete(ProcessList* this);
diff --git a/dragonflybsd/DragonFlyBSDProcessList.c b/dragonflybsd/DragonFlyBSDProcessList.c
index f46d6cec..39b05250 100644
--- a/dragonflybsd/DragonFlyBSDProcessList.c
+++ b/dragonflybsd/DragonFlyBSDProcessList.c
@@ -42,12 +42,12 @@ static int MIB_kern_cp_time[2];
static int MIB_kern_cp_times[2];
static int kernelFScale;
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId) {
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
size_t len;
char errbuf[_POSIX2_LINE_MAX];
DragonFlyBSDProcessList* dfpl = xCalloc(1, sizeof(DragonFlyBSDProcessList));
ProcessList* pl = (ProcessList*) dfpl;
- ProcessList_init(pl, Class(DragonFlyBSDProcess), usersTable, dynamicMeters, dynamicColumns, pidMatchList, userId);
+ ProcessList_init(pl, Class(DragonFlyBSDProcess), usersTable, pidMatchList, userId);
// physical memory in system: hw.physmem
// physical page size: hw.pagesize
diff --git a/dragonflybsd/DragonFlyBSDProcessList.h b/dragonflybsd/DragonFlyBSDProcessList.h
index c1bf2d19..2cc40054 100644
--- a/dragonflybsd/DragonFlyBSDProcessList.h
+++ b/dragonflybsd/DragonFlyBSDProcessList.h
@@ -53,7 +53,7 @@ typedef struct DragonFlyBSDProcessList_ {
Hashtable* jails;
} DragonFlyBSDProcessList;
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId);
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
void ProcessList_delete(ProcessList* this);
diff --git a/freebsd/FreeBSDProcessList.c b/freebsd/FreeBSDProcessList.c
index 331aac61..f545a3ee 100644
--- a/freebsd/FreeBSDProcessList.c
+++ b/freebsd/FreeBSDProcessList.c
@@ -59,12 +59,12 @@ static int MIB_kern_cp_time[2];
static int MIB_kern_cp_times[2];
static int kernelFScale;
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* DynamicColumns, Hashtable* pidMatchList, uid_t userId) {
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
size_t len;
char errbuf[_POSIX2_LINE_MAX];
FreeBSDProcessList* fpl = xCalloc(1, sizeof(FreeBSDProcessList));
ProcessList* pl = (ProcessList*) fpl;
- ProcessList_init(pl, Class(FreeBSDProcess), usersTable, dynamicMeters, DynamicColumns, pidMatchList, userId);
+ ProcessList_init(pl, Class(FreeBSDProcess), usersTable, pidMatchList, userId);
// physical memory in system: hw.physmem
// physical page size: hw.pagesize
diff --git a/freebsd/FreeBSDProcessList.h b/freebsd/FreeBSDProcessList.h
index adc70e4f..98510fad 100644
--- a/freebsd/FreeBSDProcessList.h
+++ b/freebsd/FreeBSDProcessList.h
@@ -47,7 +47,7 @@ typedef struct FreeBSDProcessList_ {
} FreeBSDProcessList;
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId);
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
void ProcessList_delete(ProcessList* this);
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
index 0dbabe5b..9d1f7933 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -297,11 +297,11 @@ static void LinuxProcessList_updateCPUcount(ProcessList* super) {
super->existingCPUs = currExisting;
}
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId) {
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
LinuxProcessList* this = xCalloc(1, sizeof(LinuxProcessList));
ProcessList* pl = &(this->super);
- ProcessList_init(pl, Class(LinuxProcess), usersTable, dynamicMeters, dynamicColumns, pidMatchList, userId);
+ ProcessList_init(pl, Class(LinuxProcess), usersTable, pidMatchList, userId);
LinuxProcessList_initTtyDrivers(this);
// Initialize page size
diff --git a/linux/LinuxProcessList.h b/linux/LinuxProcessList.h
index 6c2f7dbe..1b29b3bd 100644
--- a/linux/LinuxProcessList.h
+++ b/linux/LinuxProcessList.h
@@ -115,7 +115,7 @@ typedef struct LinuxProcessList_ {
#define PROC_LINE_LENGTH 4096
#endif
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId);
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
void ProcessList_delete(ProcessList* pl);
diff --git a/netbsd/NetBSDProcessList.c b/netbsd/NetBSDProcessList.c
index 197a150b..381672d6 100644
--- a/netbsd/NetBSDProcessList.c
+++ b/netbsd/NetBSDProcessList.c
@@ -106,14 +106,14 @@ static void NetBSDProcessList_updateCPUcount(ProcessList* super) {
}
}
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId) {
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
const int fmib[] = { CTL_KERN, KERN_FSCALE };
size_t size;
char errbuf[_POSIX2_LINE_MAX];
NetBSDProcessList* npl = xCalloc(1, sizeof(NetBSDProcessList));
ProcessList* pl = (ProcessList*) npl;
- ProcessList_init(pl, Class(NetBSDProcess), usersTable, dynamicMeters, dynamicColumns, pidMatchList, userId);
+ ProcessList_init(pl, Class(NetBSDProcess), usersTable, pidMatchList, userId);
NetBSDProcessList_updateCPUcount(pl);
diff --git a/netbsd/NetBSDProcessList.h b/netbsd/NetBSDProcessList.h
index d228f487..d5a757fe 100644
--- a/netbsd/NetBSDProcessList.h
+++ b/netbsd/NetBSDProcessList.h
@@ -49,7 +49,7 @@ typedef struct NetBSDProcessList_ {
} NetBSDProcessList;
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId);
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
void ProcessList_delete(ProcessList* this);
diff --git a/openbsd/OpenBSDProcessList.c b/openbsd/OpenBSDProcessList.c
index d070e5e9..6ad3a760 100644
--- a/openbsd/OpenBSDProcessList.c
+++ b/openbsd/OpenBSDProcessList.c
@@ -94,14 +94,14 @@ static void OpenBSDProcessList_updateCPUcount(ProcessList* super) {
}
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId) {
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
const int fmib[] = { CTL_KERN, KERN_FSCALE };
size_t size;
char errbuf[_POSIX2_LINE_MAX];
OpenBSDProcessList* opl = xCalloc(1, sizeof(OpenBSDProcessList));
ProcessList* pl = (ProcessList*) opl;
- ProcessList_init(pl, Class(OpenBSDProcess), usersTable, dynamicMeters, dynamicColumns, pidMatchList, userId);
+ ProcessList_init(pl, Class(OpenBSDProcess), usersTable, pidMatchList, userId);
OpenBSDProcessList_updateCPUcount(pl);
diff --git a/openbsd/OpenBSDProcessList.h b/openbsd/OpenBSDProcessList.h
index 89fdb099..99de96cd 100644
--- a/openbsd/OpenBSDProcessList.h
+++ b/openbsd/OpenBSDProcessList.h
@@ -49,7 +49,7 @@ typedef struct OpenBSDProcessList_ {
} OpenBSDProcessList;
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId);
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
void ProcessList_delete(ProcessList* this);
diff --git a/pcp/PCPDynamicColumn.c b/pcp/PCPDynamicColumn.c
index 33c6d72a..8c35fc10 100644
--- a/pcp/PCPDynamicColumn.c
+++ b/pcp/PCPDynamicColumn.c
@@ -304,7 +304,7 @@ void PCPDynamicColumn_writeField(PCPDynamicColumn* this, const Process* proc, Ri
}
int PCPDynamicColumn_compareByKey(const PCPProcess* p1, const PCPProcess* p2, ProcessField key) {
- const PCPDynamicColumn* column = Hashtable_get(p1->super.processList->dynamicColumns, key);
+ const PCPDynamicColumn* column = Hashtable_get(p1->super.settings->dynamicColumns, key);
if (!column)
return -1;
diff --git a/pcp/PCPProcessList.c b/pcp/PCPProcessList.c
index f893689a..8147beeb 100644
--- a/pcp/PCPProcessList.c
+++ b/pcp/PCPProcessList.c
@@ -63,11 +63,11 @@ static char* setUser(UsersTable* this, unsigned int uid, int pid, int offset) {
return name;
}
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId) {
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
PCPProcessList* this = xCalloc(1, sizeof(PCPProcessList));
ProcessList* super = &(this->super);
- ProcessList_init(super, Class(PCPProcess), usersTable, dynamicMeters, dynamicColumns, pidMatchList, userId);
+ ProcessList_init(super, Class(PCPProcess), usersTable, pidMatchList, userId);
struct timeval timestamp;
gettimeofday(&timestamp, NULL);
diff --git a/pcp/PCPProcessList.h b/pcp/PCPProcessList.h
index a3a7372a..90e9939c 100644
--- a/pcp/PCPProcessList.h
+++ b/pcp/PCPProcessList.h
@@ -63,7 +63,7 @@ typedef struct PCPProcessList_ {
ZfsArcStats zfs;
} PCPProcessList;
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId);
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
void ProcessList_delete(ProcessList* pl);
diff --git a/solaris/SolarisProcessList.c b/solaris/SolarisProcessList.c
index 905cfbd4..40907989 100644
--- a/solaris/SolarisProcessList.c
+++ b/solaris/SolarisProcessList.c
@@ -89,10 +89,10 @@ static void SolarisProcessList_updateCPUcount(ProcessList* super) {
}
}
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId) {
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
SolarisProcessList* spl = xCalloc(1, sizeof(SolarisProcessList));
ProcessList* pl = (ProcessList*) spl;
- ProcessList_init(pl, Class(SolarisProcess), usersTable, dynamicMeters, dynamicColumns, pidMatchList, userId);
+ ProcessList_init(pl, Class(SolarisProcess), usersTable, pidMatchList, userId);
spl->kd = kstat_open();
if (!spl->kd)
diff --git a/solaris/SolarisProcessList.h b/solaris/SolarisProcessList.h
index 91fd4f41..e2f4f683 100644
--- a/solaris/SolarisProcessList.h
+++ b/solaris/SolarisProcessList.h
@@ -54,7 +54,7 @@ typedef struct SolarisProcessList_ {
ZfsArcStats zfs;
} SolarisProcessList;
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId);
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
void ProcessList_delete(ProcessList* pl);
diff --git a/unsupported/UnsupportedProcessList.c b/unsupported/UnsupportedProcessList.c
index 5291797f..fc226f76 100644
--- a/unsupported/UnsupportedProcessList.c
+++ b/unsupported/UnsupportedProcessList.c
@@ -14,9 +14,9 @@ in the source distribution for its full text.
#include "UnsupportedProcess.h"
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId) {
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
ProcessList* this = xCalloc(1, sizeof(ProcessList));
- ProcessList_init(this, Class(Process), usersTable, dynamicMeters, dynamicColumns, pidMatchList, userId);
+ ProcessList_init(this, Class(Process), usersTable, pidMatchList, userId);
this->existingCPUs = 1;
this->activeCPUs = 1;
diff --git a/unsupported/UnsupportedProcessList.h b/unsupported/UnsupportedProcessList.h
index cbf25afa..9f4d23aa 100644
--- a/unsupported/UnsupportedProcessList.h
+++ b/unsupported/UnsupportedProcessList.h
@@ -10,7 +10,7 @@ in the source distribution for its full text.
#include "ProcessList.h"
-ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, Hashtable* dynamicColumns, Hashtable* pidMatchList, uid_t userId);
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
void ProcessList_delete(ProcessList* this);

© 2014-2024 Faster IT GmbH | imprint | privacy policy