summaryrefslogtreecommitdiffstats
path: root/pcp/PCPDynamicMeter.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:00:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:00:29 +0000
commit52e25213825024b8bb446eb26b03bedc9d5c2103 (patch)
treeda70bf44b2423f6f8e9a070c063fed79d190b489 /pcp/PCPDynamicMeter.h
parentInitial commit. (diff)
downloadhtop-52e25213825024b8bb446eb26b03bedc9d5c2103.tar.xz
htop-52e25213825024b8bb446eb26b03bedc9d5c2103.zip
Adding upstream version 3.2.2.upstream/3.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pcp/PCPDynamicMeter.h')
-rw-r--r--pcp/PCPDynamicMeter.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/pcp/PCPDynamicMeter.h b/pcp/PCPDynamicMeter.h
new file mode 100644
index 0000000..0e5ddd2
--- /dev/null
+++ b/pcp/PCPDynamicMeter.h
@@ -0,0 +1,44 @@
+#ifndef HEADER_PCPDynamicMeter
+#define HEADER_PCPDynamicMeter
+
+#include <stddef.h>
+
+#include "CRT.h"
+#include "DynamicMeter.h"
+#include "Hashtable.h"
+#include "Meter.h"
+#include "RichString.h"
+
+
+typedef struct PCPDynamicMetric_ {
+ size_t id; /* index into metric array */
+ ColorElements color;
+ char* name; /* derived metric name */
+ char* label;
+ char* suffix;
+} PCPDynamicMetric;
+
+typedef struct PCPDynamicMeter_ {
+ DynamicMeter super;
+ PCPDynamicMetric* metrics;
+ size_t totalMetrics;
+} PCPDynamicMeter;
+
+typedef struct PCPDynamicMeters_ {
+ Hashtable* table;
+ size_t count; /* count of dynamic meters discovered by scan */
+ size_t offset; /* start offset into the Platform metric array */
+ size_t cursor; /* identifier allocator for each new metric used */
+} PCPDynamicMeters;
+
+void PCPDynamicMeters_init(PCPDynamicMeters* meters);
+
+void PCPDynamicMeters_done(Hashtable* table);
+
+void PCPDynamicMeter_enable(PCPDynamicMeter* this);
+
+void PCPDynamicMeter_updateValues(PCPDynamicMeter* this, Meter* meter);
+
+void PCPDynamicMeter_display(PCPDynamicMeter* this, const Meter* meter, RichString* out);
+
+#endif