summaryrefslogtreecommitdiffstats
path: root/DynamicColumn.h
diff options
context:
space:
mode:
authorSohaib Mohamed <sohaib.amhmd@gmail.com>2023-08-22 16:46:59 +1000
committerNathan Scott <nathans@redhat.com>2023-08-30 13:11:57 +1000
commit53bdcab942298e0e452d62237bc18e3a4cd551cf (patch)
treee7a62910b9f4a1a58560a4ded2e6f7e83d0b631e /DynamicColumn.h
parent0f751e991d399769fb8d7800f7c4bccec2ca7f60 (diff)
Support dynamic screens with 'top-most' entities beyond processes
This implements our concept of 'dynamic screens' in htop, with a first use-case of pcp-htop displaying things like top-filesystem and top-cgroups under new screen tabs. However the idea is more general than use in pcp-htop and we've paved the way here for us to collectively build mroe general tabular screens in core htop, as well. From the pcp-htop side of things, dynamic screens are configured using text-based configuration files that define the mapping for PCP metrics to columns (and metric instances to rows). Metrics are defined either directly (via metric names) or indirectly via PCP derived metric specifications. Value scaling and the units displayed is automatic based on PCP metric units and data types. This commit represents a collaborative effort of several months, primarily between myself, Nathan and BenBE. Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com> Signed-off-by: Nathan Scott <nathans@redhat.com>
Diffstat (limited to 'DynamicColumn.h')
-rw-r--r--DynamicColumn.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/DynamicColumn.h b/DynamicColumn.h
index 4760e6ea..3b0336a9 100644
--- a/DynamicColumn.h
+++ b/DynamicColumn.h
@@ -1,29 +1,40 @@
#ifndef HEADER_DynamicColumn
#define HEADER_DynamicColumn
+/*
+htop - DynamicColumn.h
+(C) 2023 htop dev team
+Released under the GNU GPLv2+, see the COPYING file
+in the source distribution for its full text.
+*/
#include <stdbool.h>
#include "Hashtable.h"
#include "Process.h"
#include "RichString.h"
+#include "Table.h"
-#define DYNAMIC_MAX_COLUMN_WIDTH 28
+#define DYNAMIC_MAX_COLUMN_WIDTH 64
#define DYNAMIC_DEFAULT_COLUMN_WIDTH -5
typedef struct DynamicColumn_ {
- char name[32]; /* unique, internal-only name */
- char* heading; /* displayed in main screen */
- char* caption; /* displayed in setup menu (short name) */
- char* description; /* displayed in setup menu (detail) */
- int width; /* display width +/- for value alignment */
+ char name[32]; /* unique, internal-only name */
+ char* heading; /* displayed in main screen */
+ char* caption; /* displayed in setup menu (short name) */
+ 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 */
} DynamicColumn;
Hashtable* DynamicColumns_new(void);
void DynamicColumns_delete(Hashtable* dynamics);
-const char* DynamicColumn_init(unsigned int key);
+const char* DynamicColumn_name(unsigned int key);
+
+void DynamicColumn_done(DynamicColumn* this);
const DynamicColumn* DynamicColumn_lookup(Hashtable* dynamics, unsigned int key);

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