summaryrefslogtreecommitdiffstats
path: root/pcp
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2021-07-09 12:42:36 +1000
committerNathan Scott <nathans@redhat.com>2021-07-09 12:42:36 +1000
commite7aaf79166c089dde2ffb34de7e0559c903aceae (patch)
treed0a0113d199df5b48e0aa91cb13b2c2de81a90eb /pcp
parent9f667f2c746c6e8b7cdb300dc36bc2f705d03884 (diff)
Remove unnecessary include files from PCPDynamicMeter.c
Also resolve a few unintended style guide transgressions in the PCP platform code.
Diffstat (limited to 'pcp')
-rw-r--r--pcp/PCPDynamicMeter.c13
-rw-r--r--pcp/PCPDynamicMeter.h2
-rw-r--r--pcp/Platform.c20
-rw-r--r--pcp/Platform.h12
4 files changed, 22 insertions, 25 deletions
diff --git a/pcp/PCPDynamicMeter.c b/pcp/PCPDynamicMeter.c
index 05b71d5c..a89c1328 100644
--- a/pcp/PCPDynamicMeter.c
+++ b/pcp/PCPDynamicMeter.c
@@ -10,9 +10,6 @@ in the source distribution for its full text.
#include "pcp/PCPDynamicMeter.h"
#include <math.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
#include "Object.h"
#include "Platform.h"
@@ -51,8 +48,8 @@ static PCPDynamicMetric* PCPDynamicMeter_lookupMetric(PCPDynamicMeters* meters,
return metric;
}
-static void PCPDynamicMeter_parseMetric(PCPDynamicMeters* meters, PCPDynamicMeter* meter, const char *path, unsigned int line, char* key, char* value) {
- PCPDynamicMetric *metric;
+static void PCPDynamicMeter_parseMetric(PCPDynamicMeters* meters, PCPDynamicMeter* meter, const char* path, unsigned int line, char* key, char* value) {
+ PCPDynamicMetric* metric;
char* p;
if ((p = strchr(key, '.')) == NULL)
@@ -109,7 +106,7 @@ static void PCPDynamicMeter_parseMetric(PCPDynamicMeters* meters, PCPDynamicMete
}
// Ensure a valid name for use in a PCP metric name and in htoprc
-static void PCPDynamicMeter_validateMeterName(char* key, const char *path, unsigned int line) {
+static void PCPDynamicMeter_validateMeterName(char* key, const char* path, unsigned int line) {
char* p = key;
char* end = strrchr(key, ']');
@@ -219,12 +216,12 @@ static void PCPDynamicMeter_scanDir(PCPDynamicMeters* meters, char* path) {
if (!dir)
return;
- struct dirent *dirent;
+ struct dirent* dirent;
while ((dirent = readdir(dir)) != NULL) {
if (dirent->d_name[0] == '.')
continue;
- char *file = String_cat(path, dirent->d_name);
+ char* file = String_cat(path, dirent->d_name);
PCPDynamicMeter_parseFile(meters, file);
free(file);
}
diff --git a/pcp/PCPDynamicMeter.h b/pcp/PCPDynamicMeter.h
index e73a1bca..a7390e61 100644
--- a/pcp/PCPDynamicMeter.h
+++ b/pcp/PCPDynamicMeter.h
@@ -14,7 +14,7 @@ typedef struct {
typedef struct {
DynamicMeter super;
- PCPDynamicMetric *metrics;
+ PCPDynamicMetric* metrics;
unsigned int totalMetrics;
} PCPDynamicMeter;
diff --git a/pcp/Platform.c b/pcp/Platform.c
index 215a3ee0..6512ed66 100644
--- a/pcp/Platform.c
+++ b/pcp/Platform.c
@@ -119,7 +119,7 @@ const MeterClass* const Platform_meterTypes[] = {
NULL
};
-static const char *Platform_metricNames[] = {
+static const char* Platform_metricNames[] = {
[PCP_CONTROL_THREADS] = "proc.control.perclient.threads",
[PCP_HINV_NCPU] = "hinv.ncpu",
@@ -251,7 +251,7 @@ const pmDesc* Metric_desc(Metric metric) {
return &pcp->descs[metric];
}
-pmAtomValue* Metric_values(Metric metric, pmAtomValue *atom, int count, int type) {
+pmAtomValue* Metric_values(Metric metric, pmAtomValue* atom, int count, int type) {
if (pcp->result == NULL)
return NULL;
@@ -264,7 +264,7 @@ pmAtomValue* Metric_values(Metric metric, pmAtomValue *atom, int count, int type
for (int i = 0; i < vset->numval; i++) {
if (i == count)
break;
- const pmValue *value = &vset->vlist[i];
+ const pmValue* value = &vset->vlist[i];
int sts = pmExtractValue(vset->valfmt, value, desc->type, &atom[i], type);
if (sts < 0) {
if (pmDebugOptions.appl0)
@@ -296,11 +296,11 @@ int Metric_instanceOffset(Metric metric, int inst) {
return 0;
}
-static pmAtomValue *Metric_extract(Metric metric, int inst, int offset, pmValueSet *vset, pmAtomValue *atom, int type) {
+static pmAtomValue* Metric_extract(Metric metric, int inst, int offset, pmValueSet* vset, pmAtomValue* atom, int type) {
/* extract value (using requested type) of given metric instance */
const pmDesc* desc = &pcp->descs[metric];
- const pmValue *value = &vset->vlist[offset];
+ const pmValue* value = &vset->vlist[offset];
int sts = pmExtractValue(vset->valfmt, value, desc->type, atom, type);
if (sts < 0) {
if (pmDebugOptions.appl0)
@@ -311,7 +311,7 @@ static pmAtomValue *Metric_extract(Metric metric, int inst, int offset, pmValueS
return atom;
}
-pmAtomValue *Metric_instance(Metric metric, int inst, int offset, pmAtomValue *atom, int type) {
+pmAtomValue* Metric_instance(Metric metric, int inst, int offset, pmAtomValue* atom, int type) {
pmValueSet* vset = pcp->result->vset[metric];
if (!vset || vset->numval <= 0)
@@ -381,7 +381,7 @@ void Metric_enableThreads(void) {
pmFreeResult(result);
}
-bool Metric_fetch(struct timeval *timestamp) {
+bool Metric_fetch(struct timeval* timestamp) {
if (pcp->result) {
pmFreeResult(pcp->result);
pcp->result = NULL;
@@ -398,7 +398,7 @@ bool Metric_fetch(struct timeval *timestamp) {
return true;
}
-int Platform_addMetric(Metric id, const char *name) {
+int Platform_addMetric(Metric id, const char* name) {
unsigned int i = (unsigned int)id;
if (i >= PCP_METRIC_COUNT && i >= pcp->totalMetrics) {
@@ -665,7 +665,7 @@ void Platform_setZramValues(Meter* this) {
return;
}
- pmAtomValue *values = xCalloc(count, sizeof(pmAtomValue));
+ pmAtomValue* values = xCalloc(count, sizeof(pmAtomValue));
ZramStats stats = {0};
if (Metric_values(PCP_ZRAM_CAPACITY, values, count, PM_TYPE_U64)) {
@@ -847,7 +847,7 @@ void Platform_longOptionsUsage(ATTR_UNUSED const char* name) {
bool Platform_getLongOption(int opt, ATTR_UNUSED int argc, char** argv) {
/* libpcp export without a header definition */
- extern void __pmAddOptHost(pmOptions *, char *);
+ extern void __pmAddOptHost(pmOptions*, char*);
switch (opt) {
case PLATFORM_LONGOPT_HOST: /* --host=HOSTSPEC */
diff --git a/pcp/Platform.h b/pcp/Platform.h
index 7cf3722b..6b0215c8 100644
--- a/pcp/Platform.h
+++ b/pcp/Platform.h
@@ -77,13 +77,13 @@ char* Platform_getInodeFilename(pid_t pid, ino_t inode);
FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid);
-void Platform_getPressureStall(const char *file, bool some, double* ten, double* sixty, double* threehundred);
+void Platform_getPressureStall(const char* file, bool some, double* ten, double* sixty, double* threehundred);
bool Platform_getDiskIO(DiskIOData* data);
bool Platform_getNetworkIO(NetworkIOData* data);
-void Platform_getBattery(double *percent, ACPresence *isOnAC);
+void Platform_getBattery(double* percent, ACPresence* isOnAC);
void Platform_getHostname(char* buffer, size_t size);
@@ -242,11 +242,11 @@ bool Metric_enabled(Metric metric);
void Metric_enableThreads(void);
-bool Metric_fetch(struct timeval *timestamp);
+bool Metric_fetch(struct timeval* timestamp);
bool Metric_iterate(Metric metric, int* instp, int* offsetp);
-pmAtomValue* Metric_values(Metric metric, pmAtomValue *atom, int count, int type);
+pmAtomValue* Metric_values(Metric metric, pmAtomValue* atom, int count, int type);
const pmDesc* Metric_desc(Metric metric);
@@ -254,9 +254,9 @@ 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);
+pmAtomValue* Metric_instance(Metric metric, int inst, int offset, pmAtomValue* atom, int type);
-int Platform_addMetric(Metric id, const char *name);
+int Platform_addMetric(Metric id, const char* name);
void Platform_gettime_realtime(struct timeval* tv, uint64_t* msec);

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