diff options
author | Sohaib <sohaib.amhmd@gmail.com> | 2021-08-14 17:30:19 -0400 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2021-08-16 17:23:07 +0200 |
commit | fefff80631e86f0296a2621a3699b16de60b86c6 (patch) | |
tree | d63400fea86d63c7075aa828faadae39cdca75b4 /pcp/PCPDynamicMeter.c | |
parent | edafa26f9e6298bcd935a2eaf9dfcec8868eff8d (diff) |
PCP: PCPMetric.[ch] Mdoule
Split the PCP Metric API (functions `Metric_*`) into their own module.
as @BenBE suggested.
Diffstat (limited to 'pcp/PCPDynamicMeter.c')
-rw-r--r-- | pcp/PCPDynamicMeter.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/pcp/PCPDynamicMeter.c b/pcp/PCPDynamicMeter.c index b90511ec..430f41c9 100644 --- a/pcp/PCPDynamicMeter.c +++ b/pcp/PCPDynamicMeter.c @@ -9,15 +9,22 @@ in the source distribution for its full text. #include "pcp/PCPDynamicMeter.h" -#include <math.h> - -#include "Object.h" +#include <ctype.h> +#include <dirent.h> +#include <errno.h> +#include <pcp/pmapi.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "Macros.h" #include "Platform.h" -#include "ProcessList.h" #include "RichString.h" -#include "Settings.h" #include "XUtils.h" +#include "pcp/PCPMetric.h" + static PCPDynamicMetric* PCPDynamicMeter_lookupMetric(PCPDynamicMeters* meters, PCPDynamicMeter* meter, const char* name) { size_t bytes = 16 + strlen(meter->super.name) + strlen(name); @@ -278,7 +285,7 @@ void PCPDynamicMeters_init(PCPDynamicMeters* meters) { void PCPDynamicMeter_enable(PCPDynamicMeter* this) { for (size_t i = 0; i < this->totalMetrics; i++) - Metric_enable(this->metrics[i].id, true); + PCPMetric_enable(this->metrics[i].id, true); } void PCPDynamicMeter_updateValues(PCPDynamicMeter* this, Meter* meter) { @@ -291,10 +298,10 @@ void PCPDynamicMeter_updateValues(PCPDynamicMeter* this, Meter* meter) { buffer[bytes++] = '/'; /* separator */ PCPDynamicMetric* metric = &this->metrics[i]; - const pmDesc* desc = Metric_desc(metric->id); + const pmDesc* desc = PCPMetric_desc(metric->id); pmAtomValue atom, raw; - if (!Metric_values(metric->id, &raw, 1, desc->type)) { + if (!PCPMetric_values(metric->id, &raw, 1, desc->type)) { bytes--; /* clear the separator */ continue; } @@ -362,11 +369,11 @@ void PCPDynamicMeter_display(PCPDynamicMeter* this, ATTR_UNUSED const Meter* met for (size_t i = 0; i < this->totalMetrics; i++) { PCPDynamicMetric* metric = &this->metrics[i]; - const pmDesc* desc = Metric_desc(metric->id); + const pmDesc* desc = PCPMetric_desc(metric->id); pmAtomValue atom, raw; char buffer[64]; - if (!Metric_values(metric->id, &raw, 1, desc->type)) + if (!PCPMetric_values(metric->id, &raw, 1, desc->type)) continue; pmUnits conv = desc->units; /* convert to canonical units */ |