diff options
author | Sohaib Mohamed <sohaib.amhmd@gmail.com> | 2021-07-11 03:11:29 +0200 |
---|---|---|
committer | Nathan Scott <nathans@redhat.com> | 2021-08-13 07:32:57 +0200 |
commit | 6f2021f3d95e02fc54e59fdeeb006e34c209b9c3 (patch) | |
tree | a31ea1264b871e5a7e7785398a382a7813eb1749 /pcp/Platform.h | |
parent | ed82ce6456f0f904a0ab2b346b85d7cf46df109c (diff) |
PCP: support for 'dynamic columns' added at runtime
Implements support for arbitrary Performance Co-Pilot
metrics with per-process instance domains to form new
htop columns. The column-to-metric mappings are setup
using configuration files which will be documented via
man pages as part of a follow-up commit.
We provide an initial set of column configurations so
as to provide new capabilities to pcp-htop: including
configs for containers, open fd counts, scheduler run
queue time, tcp/udp bytes/calls sent/recv, delay acct,
virtual machine guests, detailed virtual memory, swap.
Note there is a change to the configuration file path
resolution algorithm introduced for 'dynamic meters'.
First, look in any custom PCP_HTOP_DIR location. Then
iterate, in priority order, users home directory, then
local sysadmins files in /etc/pcp/htop, then readonly
configuration files below /usr/share/pcp/htop. This
final location becomes the preferred place for our own
shipped meter and column files.
The Settings file (htoprc) writing code is updated to
not using the numeric identifier for dynamic columns.
The same strategy used for dynamic meters is used here
where we write Dynamic(name) so the name can be setup
once more at start. Regular (static) columns writing
to htoprc - i.e. numerically indexed - is unchanged.
Diffstat (limited to 'pcp/Platform.h')
-rw-r--r-- | pcp/Platform.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pcp/Platform.h b/pcp/Platform.h index 6b0215c8..76594b9b 100644 --- a/pcp/Platform.h +++ b/pcp/Platform.h @@ -11,6 +11,8 @@ in the source distribution for its full text. #include <ctype.h> #include <stdbool.h> +#include <stddef.h> +#include <stdint.h> #include <pcp/pmapi.h> /* use htop config.h values for these macros, not pcp values */ @@ -29,6 +31,7 @@ in the source distribution for its full text. #include "NetworkIOMeter.h" #include "Process.h" #include "ProcessLocksScreen.h" +#include "RichString.h" #include "SignalsPanel.h" #include "SysArchMeter.h" @@ -250,13 +253,15 @@ pmAtomValue* Metric_values(Metric metric, pmAtomValue* atom, int count, int type const pmDesc* Metric_desc(Metric metric); +int Metric_type(Metric metric); + int Metric_instanceCount(Metric metric); int Metric_instanceOffset(Metric metric, int inst); pmAtomValue* Metric_instance(Metric metric, int inst, int offset, pmAtomValue* atom, int type); -int Platform_addMetric(Metric id, const char* name); +size_t Platform_addMetric(Metric id, const char* name); void Platform_gettime_realtime(struct timeval* tv, uint64_t* msec); @@ -270,4 +275,10 @@ void Platform_dynamicMeterUpdateValues(Meter* meter); void Platform_dynamicMeterDisplay(const Meter* meter, RichString* out); +Hashtable* Platform_dynamicColumns(void); + +const char* Platform_dynamicColumnInit(unsigned int key); + +bool Platform_dynamicColumnWriteField(const Process* proc, RichString* str, unsigned int key); + #endif |