summaryrefslogtreecommitdiffstats
path: root/Machine.h
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2023-08-22 16:11:05 +1000
committerNathan Scott <nathans@redhat.com>2023-08-30 13:11:57 +1000
commit0f751e991d399769fb8d7800f7c4bccec2ca7f60 (patch)
tree34cd7838f7ebf51049816f9acb6a63cea175af06 /Machine.h
parent68f4f10f012d11bd57bb725fe4113b2af937fc1d (diff)
Introduce Row and Table classes for screens beyond top-processes
This commit refactors the Process and ProcessList structures such they each have a new parent - Row and Table, respectively. These new classes handle screen updates relating to anything that could be represented in tabular format, e.g. cgroups, filesystems, etc, without us having to reimplement the display logic repeatedly for each new entity.
Diffstat (limited to 'Machine.h')
-rw-r--r--Machine.h22
1 files changed, 14 insertions, 8 deletions
diff --git a/Machine.h b/Machine.h
index 64d6f6c2..a1c49e24 100644
--- a/Machine.h
+++ b/Machine.h
@@ -18,6 +18,7 @@ in the source distribution for its full text.
#include "Hashtable.h"
#include "Settings.h"
+#include "Table.h"
#include "UsersTable.h"
#include "Vector.h"
@@ -37,10 +38,10 @@ in the source distribution for its full text.
typedef unsigned long long int memory_t;
#define MEMORY_MAX ULLONG_MAX
-struct ProcessList_;
+struct Settings_;
typedef struct Machine_ {
- Settings* settings;
+ struct Settings_* settings;
struct timeval realtime; /* time of the current sample */
uint64_t realtimeMs; /* current time in milliseconds */
@@ -68,11 +69,14 @@ typedef struct Machine_ {
unsigned int existingCPUs;
UsersTable* usersTable;
- uid_t userId;
-
- /* To become an array of lists - processes, cgroups, filesystems,... etc */
- /* for now though, just point back to the one list we have at the moment */
- struct ProcessList_ *pl;
+ uid_t htopUserId;
+ uid_t maxUserId; /* recently observed */
+ uid_t userId; /* selected row user ID */
+
+ size_t tableCount;
+ Table **tables;
+ Table *activeTable;
+ Table *processTable;
} Machine;
@@ -86,8 +90,10 @@ void Machine_done(Machine* this);
bool Machine_isCPUonline(const Machine* this, unsigned int id);
-void Machine_addList(Machine* this, struct ProcessList_ *pl);
+void Machine_addTable(Machine* this, Table *table, bool processes);
void Machine_scan(Machine* this);
+void Machine_scanTables(Machine* this);
+
#endif

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