aboutsummaryrefslogtreecommitdiffstats
path: root/pcp/PCPDynamicColumn.h
blob: ade782b7fb7d624f319e383f266fc6bca7b5e315 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef HEADER_PCPDynamicColumn
#define HEADER_PCPDynamicColumn
/*
htop - PCPDynamicColumn.h
(C) 2023 htop dev team
Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
*/

#include <stddef.h>

#include "DynamicColumn.h"
#include "Hashtable.h"
#include "Process.h"
#include "RichString.h"

#include "pcp/PCPProcess.h"


struct pmDesc;

typedef struct PCPDynamicColumn_ {
   DynamicColumn super;
   char* metricName;
   char* format;
   size_t id;  /* identifier for metric array lookups */
   int width;  /* optional width from configuration file */
   bool defaultEnabled;  /* default enabled in dynamic screen */
   bool percent;
   bool instances;  /* an instance *names* column, not values */
} PCPDynamicColumn;

typedef struct PCPDynamicColumns_ {
   Hashtable* table;
   size_t count;  /* count of dynamic columns discovered by scan */
   size_t offset; /* start offset into the Platform metric array */
   size_t cursor; /* identifier allocator for each new metric used */
} PCPDynamicColumns;

void PCPDynamicColumns_init(PCPDynamicColumns* columns);

void PCPDynamicColumns_done(Hashtable* table);

void PCPDynamicColumns_setupWidths(PCPDynamicColumns* columns);

void PCPDynamicColumn_writeField(PCPDynamicColumn* this, const Process* proc, RichString* str);

void PCPDynamicColumn_writeAtomValue(PCPDynamicColumn* column, RichString* str, const struct Settings_* settings, int metric, int instance, const struct pmDesc* desc, const void* atomvalue);

int PCPDynamicColumn_compareByKey(const PCPProcess* p1, const PCPProcess* p2, ProcessField key);

void PCPDynamicColumn_done(PCPDynamicColumn* this);

#endif

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