aboutsummaryrefslogtreecommitdiffstats
path: root/pcp/Platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'pcp/Platform.c')
-rw-r--r--pcp/Platform.c264
1 files changed, 173 insertions, 91 deletions
diff --git a/pcp/Platform.c b/pcp/Platform.c
index 994cef3..0b5f334 100644
--- a/pcp/Platform.c
+++ b/pcp/Platform.c
@@ -25,6 +25,8 @@ in the source distribution for its full text.
#include "DiskIOMeter.h"
#include "DynamicColumn.h"
#include "DynamicMeter.h"
+#include "DynamicScreen.h"
+#include "FileDescriptorMeter.h"
#include "HostnameMeter.h"
#include "LoadAverageMeter.h"
#include "Macros.h"
@@ -32,7 +34,7 @@ in the source distribution for its full text.
#include "MemorySwapMeter.h"
#include "Meter.h"
#include "NetworkIOMeter.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "Settings.h"
#include "SwapMeter.h"
#include "SysArchMeter.h"
@@ -43,10 +45,12 @@ in the source distribution for its full text.
#include "linux/PressureStallMeter.h"
#include "linux/ZramMeter.h"
#include "linux/ZramStats.h"
+#include "pcp/Metric.h"
#include "pcp/PCPDynamicColumn.h"
#include "pcp/PCPDynamicMeter.h"
-#include "pcp/PCPMetric.h"
-#include "pcp/PCPProcessList.h"
+#include "pcp/PCPDynamicScreen.h"
+#include "pcp/PCPMachine.h"
+#include "pcp/PCPProcessTable.h"
#include "zfs/ZfsArcMeter.h"
#include "zfs/ZfsArcStats.h"
#include "zfs/ZfsCompressedArcMeter.h"
@@ -106,6 +110,7 @@ const MeterClass* const Platform_meterTypes[] = {
&PressureStallCPUSomeMeter_class,
&PressureStallIOSomeMeter_class,
&PressureStallIOFullMeter_class,
+ &PressureStallIRQFullMeter_class,
&PressureStallMemorySomeMeter_class,
&PressureStallMemoryFullMeter_class,
&ZfsArcMeter_class,
@@ -114,6 +119,7 @@ const MeterClass* const Platform_meterTypes[] = {
&DiskIOMeter_class,
&NetworkIOMeter_class,
&SysArchMeter_class,
+ &FileDescriptorMeter_class,
NULL
};
@@ -171,6 +177,7 @@ static const char* Platform_metricNames[] = {
[PCP_PSI_CPUSOME] = "kernel.all.pressure.cpu.some.avg",
[PCP_PSI_IOSOME] = "kernel.all.pressure.io.some.avg",
[PCP_PSI_IOFULL] = "kernel.all.pressure.io.full.avg",
+ [PCP_PSI_IRQFULL] = "kernel.all.pressure.irq.full.avg",
[PCP_PSI_MEMSOME] = "kernel.all.pressure.memory.some.avg",
[PCP_PSI_MEMFULL] = "kernel.all.pressure.memory.full.avg",
@@ -190,6 +197,10 @@ static const char* Platform_metricNames[] = {
[PCP_ZRAM_CAPACITY] = "zram.capacity",
[PCP_ZRAM_ORIGINAL] = "zram.mm_stat.data_size.original",
[PCP_ZRAM_COMPRESSED] = "zram.mm_stat.data_size.compressed",
+ [PCP_MEM_ZSWAP] = "mem.util.zswap",
+ [PCP_MEM_ZSWAPPED] = "mem.util.zswapped",
+ [PCP_VFS_FILES_COUNT] = "vfs.files.count",
+ [PCP_VFS_FILES_MAX] = "vfs.files.max",
[PCP_PROC_PID] = "proc.psinfo.pid",
[PCP_PROC_PPID] = "proc.psinfo.ppid",
@@ -279,7 +290,7 @@ int pmLookupDescs(int numpmid, pmID* pmids, pmDesc* descs) {
}
#endif
-size_t Platform_addMetric(PCPMetric id, const char* name) {
+size_t Platform_addMetric(Metric id, const char* name) {
unsigned int i = (unsigned int)id;
if (i >= PCP_METRIC_COUNT && i >= pcp->totalMetrics) {
@@ -348,6 +359,7 @@ bool Platform_init(void) {
pcp->columns.offset = PCP_METRIC_COUNT + pcp->meters.cursor;
PCPDynamicColumns_init(&pcp->columns);
+ PCPDynamicScreens_init(&pcp->screens, &pcp->columns);
sts = pmLookupName(pcp->totalMetrics, pcp->names, pcp->pmids);
if (sts < 0) {
@@ -367,31 +379,32 @@ bool Platform_init(void) {
}
/* set proc.control.perclient.threads to 1 for live contexts */
- PCPMetric_enableThreads();
+ Metric_enableThreads();
/* extract values needed for setup - e.g. cpu count, pid_max */
- PCPMetric_enable(PCP_PID_MAX, true);
- PCPMetric_enable(PCP_BOOTTIME, true);
- PCPMetric_enable(PCP_HINV_NCPU, true);
- PCPMetric_enable(PCP_PERCPU_SYSTEM, true);
- PCPMetric_enable(PCP_UNAME_SYSNAME, true);
- PCPMetric_enable(PCP_UNAME_RELEASE, true);
- PCPMetric_enable(PCP_UNAME_MACHINE, true);
- PCPMetric_enable(PCP_UNAME_DISTRO, true);
-
+ Metric_enable(PCP_PID_MAX, true);
+ Metric_enable(PCP_BOOTTIME, true);
+ Metric_enable(PCP_HINV_NCPU, true);
+ Metric_enable(PCP_PERCPU_SYSTEM, true);
+ Metric_enable(PCP_UNAME_SYSNAME, true);
+ Metric_enable(PCP_UNAME_RELEASE, true);
+ Metric_enable(PCP_UNAME_MACHINE, true);
+ Metric_enable(PCP_UNAME_DISTRO, true);
+
+ /* enable metrics for all dynamic columns (including those from dynamic screens) */
for (size_t i = pcp->columns.offset; i < pcp->columns.offset + pcp->columns.count; i++)
- PCPMetric_enable(i, true);
+ Metric_enable(i, true);
- PCPMetric_fetch(NULL);
+ Metric_fetch(NULL);
- for (PCPMetric metric = 0; metric < PCP_PROC_PID; metric++)
- PCPMetric_enable(metric, true);
- PCPMetric_enable(PCP_PID_MAX, false); /* needed one time only */
- PCPMetric_enable(PCP_BOOTTIME, false);
- PCPMetric_enable(PCP_UNAME_SYSNAME, false);
- PCPMetric_enable(PCP_UNAME_RELEASE, false);
- PCPMetric_enable(PCP_UNAME_MACHINE, false);
- PCPMetric_enable(PCP_UNAME_DISTRO, false);
+ for (Metric metric = 0; metric < PCP_PROC_PID; metric++)
+ Metric_enable(metric, true);
+ Metric_enable(PCP_PID_MAX, false); /* needed one time only */
+ Metric_enable(PCP_BOOTTIME, false);
+ Metric_enable(PCP_UNAME_SYSNAME, false);
+ Metric_enable(PCP_UNAME_RELEASE, false);
+ Metric_enable(PCP_UNAME_MACHINE, false);
+ Metric_enable(PCP_UNAME_DISTRO, false);
/* first sample (fetch) performed above, save constants */
Platform_getBootTime();
@@ -410,6 +423,10 @@ void Platform_dynamicMetersDone(Hashtable* meters) {
PCPDynamicMeters_done(meters);
}
+void Platform_dynamicScreensDone(Hashtable* screens) {
+ PCPDynamicScreens_done(screens);
+}
+
void Platform_done(void) {
pmDestroyContext(pcp->context);
if (pcp->result)
@@ -429,7 +446,7 @@ void Platform_setBindings(Htop_Action* keys) {
int Platform_getUptime(void) {
pmAtomValue value;
- if (PCPMetric_values(PCP_UPTIME, &value, 1, PM_TYPE_32) == NULL)
+ if (Metric_values(PCP_UPTIME, &value, 1, PM_TYPE_32) == NULL)
return 0;
return value.l;
}
@@ -438,7 +455,7 @@ void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
*one = *five = *fifteen = 0.0;
pmAtomValue values[3] = {0};
- if (PCPMetric_values(PCP_LOAD_AVERAGE, values, 3, PM_TYPE_DOUBLE) != NULL) {
+ if (Metric_values(PCP_LOAD_AVERAGE, values, 3, PM_TYPE_DOUBLE) != NULL) {
*one = values[0].d;
*five = values[1].d;
*fifteen = values[2].d;
@@ -450,20 +467,20 @@ unsigned int Platform_getMaxCPU(void) {
return pcp->ncpu;
pmAtomValue value;
- if (PCPMetric_values(PCP_HINV_NCPU, &value, 1, PM_TYPE_U32) != NULL)
+ if (Metric_values(PCP_HINV_NCPU, &value, 1, PM_TYPE_U32) != NULL)
pcp->ncpu = value.ul;
else
pcp->ncpu = 1;
return pcp->ncpu;
}
-int Platform_getMaxPid(void) {
+pid_t Platform_getMaxPid(void) {
if (pcp->pidmax)
return pcp->pidmax;
pmAtomValue value;
- if (PCPMetric_values(PCP_PID_MAX, &value, 1, PM_TYPE_32) == NULL)
- return -1;
+ if (Metric_values(PCP_PID_MAX, &value, 1, PM_TYPE_32) == NULL)
+ return UINT_MAX;
pcp->pidmax = value.l;
return pcp->pidmax;
}
@@ -473,13 +490,12 @@ long long Platform_getBootTime(void) {
return pcp->btime;
pmAtomValue value;
- if (PCPMetric_values(PCP_BOOTTIME, &value, 1, PM_TYPE_64) != NULL)
+ if (Metric_values(PCP_BOOTTIME, &value, 1, PM_TYPE_64) != NULL)
pcp->btime = value.ll;
return pcp->btime;
}
-static double Platform_setOneCPUValues(Meter* this, pmAtomValue* values) {
-
+static double Platform_setOneCPUValues(Meter* this, const Settings* settings, pmAtomValue* values) {
unsigned long long value = values[CPU_TOTAL_PERIOD].ull;
double total = (double) (value == 0 ? 1 : value);
double percent;
@@ -487,28 +503,32 @@ static double Platform_setOneCPUValues(Meter* this, pmAtomValue* values) {
double* v = this->values;
v[CPU_METER_NICE] = values[CPU_NICE_PERIOD].ull / total * 100.0;
v[CPU_METER_NORMAL] = values[CPU_USER_PERIOD].ull / total * 100.0;
- if (this->pl->settings->detailedCPUTime) {
+ if (settings->detailedCPUTime) {
v[CPU_METER_KERNEL] = values[CPU_SYSTEM_PERIOD].ull / total * 100.0;
v[CPU_METER_IRQ] = values[CPU_IRQ_PERIOD].ull / total * 100.0;
v[CPU_METER_SOFTIRQ] = values[CPU_SOFTIRQ_PERIOD].ull / total * 100.0;
+ this->curItems = 5;
+
v[CPU_METER_STEAL] = values[CPU_STEAL_PERIOD].ull / total * 100.0;
v[CPU_METER_GUEST] = values[CPU_GUEST_PERIOD].ull / total * 100.0;
+ if (settings->accountGuestInCPUMeter) {
+ this->curItems = 7;
+ }
+
v[CPU_METER_IOWAIT] = values[CPU_IOWAIT_PERIOD].ull / total * 100.0;
- this->curItems = 8;
- if (this->pl->settings->accountGuestInCPUMeter)
- percent = v[0] + v[1] + v[2] + v[3] + v[4] + v[5] + v[6];
- else
- percent = v[0] + v[1] + v[2] + v[3] + v[4];
} else {
- v[2] = values[CPU_SYSTEM_ALL_PERIOD].ull / total * 100.0;
+ v[CPU_METER_KERNEL] = values[CPU_SYSTEM_ALL_PERIOD].ull / total * 100.0;
value = values[CPU_STEAL_PERIOD].ull + values[CPU_GUEST_PERIOD].ull;
- v[3] = value / total * 100.0;
+ v[CPU_METER_IRQ] = value / total * 100.0;
this->curItems = 4;
- percent = v[0] + v[1] + v[2] + v[3];
}
- percent = CLAMP(percent, 0.0, 100.0);
- if (isnan(percent))
- percent = 0.0;
+
+ percent = sumPositiveValues(v, this->curItems);
+ percent = MINIMUM(percent, 100.0);
+
+ if (settings->detailedCPUTime) {
+ this->curItems = 8;
+ }
v[CPU_METER_FREQUENCY] = values[CPU_FREQUENCY].d;
v[CPU_METER_TEMPERATURE] = NAN;
@@ -517,43 +537,65 @@ static double Platform_setOneCPUValues(Meter* this, pmAtomValue* values) {
}
double Platform_setCPUValues(Meter* this, int cpu) {
- const PCPProcessList* pl = (const PCPProcessList*) this->pl;
+ const PCPMachine* phost = (const PCPMachine*) this->host;
+ const Settings* settings = this->host->settings;
+
if (cpu <= 0) /* use aggregate values */
- return Platform_setOneCPUValues(this, pl->cpu);
- return Platform_setOneCPUValues(this, pl->percpu[cpu - 1]);
+ return Platform_setOneCPUValues(this, settings, phost->cpu);
+ return Platform_setOneCPUValues(this, settings, phost->percpu[cpu - 1]);
}
void Platform_setMemoryValues(Meter* this) {
- const ProcessList* pl = this->pl;
- const PCPProcessList* ppl = (const PCPProcessList*) pl;
-
- this->total = pl->totalMem;
- this->values[MEMORY_METER_USED] = pl->usedMem;
- this->values[MEMORY_METER_BUFFERS] = pl->buffersMem;
- this->values[MEMORY_METER_SHARED] = pl->sharedMem;
- this->values[MEMORY_METER_CACHE] = pl->cachedMem;
- this->values[MEMORY_METER_AVAILABLE] = pl->availableMem;
-
- if (ppl->zfs.enabled != 0) {
+ const Machine* host = this->host;
+ const PCPMachine* phost = (const PCPMachine*) host;
+
+ this->total = host->totalMem;
+ this->values[MEMORY_METER_USED] = host->usedMem;
+ this->values[MEMORY_METER_SHARED] = host->sharedMem;
+ this->values[MEMORY_METER_COMPRESSED] = 0;
+ this->values[MEMORY_METER_BUFFERS] = host->buffersMem;
+ this->values[MEMORY_METER_CACHE] = host->cachedMem;
+ this->values[MEMORY_METER_AVAILABLE] = host->availableMem;
+
+ if (phost->zfs.enabled != 0) {
// ZFS does not shrink below the value of zfs_arc_min.
unsigned long long int shrinkableSize = 0;
- if (ppl->zfs.size > ppl->zfs.min)
- shrinkableSize = ppl->zfs.size - ppl->zfs.min;
+ if (phost->zfs.size > phost->zfs.min)
+ shrinkableSize = phost->zfs.size - phost->zfs.min;
this->values[MEMORY_METER_USED] -= shrinkableSize;
this->values[MEMORY_METER_CACHE] += shrinkableSize;
this->values[MEMORY_METER_AVAILABLE] += shrinkableSize;
}
+
+ if (phost->zswap.usedZswapOrig > 0 || phost->zswap.usedZswapComp > 0) {
+ this->values[MEMORY_METER_USED] -= phost->zswap.usedZswapComp;
+ this->values[MEMORY_METER_COMPRESSED] += phost->zswap.usedZswapComp;
+ }
}
void Platform_setSwapValues(Meter* this) {
- const ProcessList* pl = this->pl;
- this->total = pl->totalSwap;
- this->values[SWAP_METER_USED] = pl->usedSwap;
- this->values[SWAP_METER_CACHE] = pl->cachedSwap;
+ const Machine* host = this->host;
+ const PCPMachine* phost = (const PCPMachine*) host;
+
+ this->total = host->totalSwap;
+ this->values[SWAP_METER_USED] = host->usedSwap;
+ this->values[SWAP_METER_CACHE] = host->cachedSwap;
+ this->values[SWAP_METER_FRONTSWAP] = 0; /* frontswap -- memory that is accounted to swap but resides elsewhere */
+
+ if (phost->zswap.usedZswapOrig > 0 || phost->zswap.usedZswapComp > 0) {
+ /* refer to linux/Platform.c::Platform_setSwapValues for details */
+ this->values[SWAP_METER_USED] -= phost->zswap.usedZswapOrig;
+ if (this->values[SWAP_METER_USED] < 0) {
+ /* subtract the overflow from SwapCached */
+ this->values[SWAP_METER_CACHE] += this->values[SWAP_METER_USED];
+ this->values[SWAP_METER_USED] = 0;
+ }
+ this->values[SWAP_METER_FRONTSWAP] += phost->zswap.usedZswapOrig;
+ }
}
void Platform_setZramValues(Meter* this) {
- int i, count = PCPMetric_instanceCount(PCP_ZRAM_CAPACITY);
+ int i, count = Metric_instanceCount(PCP_ZRAM_CAPACITY);
if (!count) {
this->total = 0;
this->values[0] = 0;
@@ -564,36 +606,40 @@ void Platform_setZramValues(Meter* this) {
pmAtomValue* values = xCalloc(count, sizeof(pmAtomValue));
ZramStats stats = {0};
- if (PCPMetric_values(PCP_ZRAM_CAPACITY, values, count, PM_TYPE_U64)) {
+ if (Metric_values(PCP_ZRAM_CAPACITY, values, count, PM_TYPE_U64)) {
for (i = 0; i < count; i++)
stats.totalZram += values[i].ull;
}
- if (PCPMetric_values(PCP_ZRAM_ORIGINAL, values, count, PM_TYPE_U64)) {
+ if (Metric_values(PCP_ZRAM_ORIGINAL, values, count, PM_TYPE_U64)) {
for (i = 0; i < count; i++)
stats.usedZramOrig += values[i].ull;
}
- if (PCPMetric_values(PCP_ZRAM_COMPRESSED, values, count, PM_TYPE_U64)) {
+ if (Metric_values(PCP_ZRAM_COMPRESSED, values, count, PM_TYPE_U64)) {
for (i = 0; i < count; i++)
stats.usedZramComp += values[i].ull;
}
free(values);
+ if (stats.usedZramComp > stats.usedZramOrig) {
+ stats.usedZramComp = stats.usedZramOrig;
+ }
+
this->total = stats.totalZram;
this->values[0] = stats.usedZramComp;
- this->values[1] = stats.usedZramOrig;
+ this->values[1] = stats.usedZramOrig - stats.usedZramComp;
}
void Platform_setZfsArcValues(Meter* this) {
- const PCPProcessList* ppl = (const PCPProcessList*) this->pl;
+ const PCPMachine* phost = (const PCPMachine*) this->host;
- ZfsArcMeter_readStats(this, &(ppl->zfs));
+ ZfsArcMeter_readStats(this, &phost->zfs);
}
void Platform_setZfsCompressedArcValues(Meter* this) {
- const PCPProcessList* ppl = (const PCPProcessList*) this->pl;
+ const PCPMachine* phost = (const PCPMachine*) this->host;
- ZfsCompressedArcMeter_readStats(this, &(ppl->zfs));
+ ZfsCompressedArcMeter_readStats(this, &phost->zfs);
}
void Platform_getHostname(char* buffer, size_t size) {
@@ -610,13 +656,13 @@ void Platform_getRelease(char** string) {
/* first call, extract just-sampled values */
pmAtomValue sysname, release, machine, distro;
- if (!PCPMetric_values(PCP_UNAME_SYSNAME, &sysname, 1, PM_TYPE_STRING))
+ if (!Metric_values(PCP_UNAME_SYSNAME, &sysname, 1, PM_TYPE_STRING))
sysname.cp = NULL;
- if (!PCPMetric_values(PCP_UNAME_RELEASE, &release, 1, PM_TYPE_STRING))
+ if (!Metric_values(PCP_UNAME_RELEASE, &release, 1, PM_TYPE_STRING))
release.cp = NULL;
- if (!PCPMetric_values(PCP_UNAME_MACHINE, &machine, 1, PM_TYPE_STRING))
+ if (!Metric_values(PCP_UNAME_MACHINE, &machine, 1, PM_TYPE_STRING))
machine.cp = NULL;
- if (!PCPMetric_values(PCP_UNAME_DISTRO, &distro, 1, PM_TYPE_STRING))
+ if (!Metric_values(PCP_UNAME_DISTRO, &distro, 1, PM_TYPE_STRING))
distro.cp = NULL;
size_t length = 16; /* padded for formatting characters */
@@ -664,7 +710,7 @@ void Platform_getRelease(char** string) {
char* Platform_getProcessEnv(pid_t pid) {
pmAtomValue value;
- if (!PCPMetric_instance(PCP_PROC_ENVIRON, pid, 0, &value, PM_TYPE_STRING))
+ if (!Metric_instance(PCP_PROC_ENVIRON, pid, 0, &value, PM_TYPE_STRING))
return NULL;
return value.cp;
}
@@ -677,18 +723,20 @@ FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
void Platform_getPressureStall(const char* file, bool some, double* ten, double* sixty, double* threehundred) {
*ten = *sixty = *threehundred = 0;
- PCPMetric metric;
+ Metric metric;
if (String_eq(file, "cpu"))
metric = PCP_PSI_CPUSOME;
else if (String_eq(file, "io"))
metric = some ? PCP_PSI_IOSOME : PCP_PSI_IOFULL;
+ else if (String_eq(file, "irq"))
+ metric = PCP_PSI_IRQFULL;
else if (String_eq(file, "mem"))
metric = some ? PCP_PSI_MEMSOME : PCP_PSI_MEMFULL;
else
return;
pmAtomValue values[3] = {0};
- if (PCPMetric_values(metric, values, 3, PM_TYPE_DOUBLE) != NULL) {
+ if (Metric_values(metric, values, 3, PM_TYPE_DOUBLE) != NULL) {
*ten = values[0].d;
*sixty = values[1].d;
*threehundred = values[2].d;
@@ -699,11 +747,11 @@ bool Platform_getDiskIO(DiskIOData* data) {
memset(data, 0, sizeof(*data));
pmAtomValue value;
- if (PCPMetric_values(PCP_DISK_READB, &value, 1, PM_TYPE_U64) != NULL)
+ if (Metric_values(PCP_DISK_READB, &value, 1, PM_TYPE_U64) != NULL)
data->totalBytesRead = value.ull;
- if (PCPMetric_values(PCP_DISK_WRITEB, &value, 1, PM_TYPE_U64) != NULL)
+ if (Metric_values(PCP_DISK_WRITEB, &value, 1, PM_TYPE_U64) != NULL)
data->totalBytesWritten = value.ull;
- if (PCPMetric_values(PCP_DISK_ACTIVE, &value, 1, PM_TYPE_U64) != NULL)
+ if (Metric_values(PCP_DISK_ACTIVE, &value, 1, PM_TYPE_U64) != NULL)
data->totalMsTimeSpend = value.ull;
return true;
}
@@ -712,17 +760,28 @@ bool Platform_getNetworkIO(NetworkIOData* data) {
memset(data, 0, sizeof(*data));
pmAtomValue value;
- if (PCPMetric_values(PCP_NET_RECVB, &value, 1, PM_TYPE_U64) != NULL)
+ if (Metric_values(PCP_NET_RECVB, &value, 1, PM_TYPE_U64) != NULL)
data->bytesReceived = value.ull;
- if (PCPMetric_values(PCP_NET_SENDB, &value, 1, PM_TYPE_U64) != NULL)
+ if (Metric_values(PCP_NET_SENDB, &value, 1, PM_TYPE_U64) != NULL)
data->bytesTransmitted = value.ull;
- if (PCPMetric_values(PCP_NET_RECVP, &value, 1, PM_TYPE_U64) != NULL)
+ if (Metric_values(PCP_NET_RECVP, &value, 1, PM_TYPE_U64) != NULL)
data->packetsReceived = value.ull;
- if (PCPMetric_values(PCP_NET_SENDP, &value, 1, PM_TYPE_U64) != NULL)
+ if (Metric_values(PCP_NET_SENDP, &value, 1, PM_TYPE_U64) != NULL)
data->packetsTransmitted = value.ull;
return true;
}
+void Platform_getFileDescriptors(double* used, double* max) {
+ *used = NAN;
+ *max = 65536;
+
+ pmAtomValue value;
+ if (Metric_values(PCP_VFS_FILES_COUNT, &value, 1, PM_TYPE_32) != NULL)
+ *used = value.l;
+ if (Metric_values(PCP_VFS_FILES_MAX, &value, 1, PM_TYPE_32) != NULL)
+ *max = value.l;
+}
+
void Platform_getBattery(double* level, ACPresence* isOnAC) {
*level = NAN;
*isOnAC = AC_ERROR;
@@ -743,7 +802,7 @@ CommandLineStatus Platform_getLongOption(int opt, ATTR_UNUSED int argc, char** a
case PLATFORM_LONGOPT_HOST: /* --host=HOSTSPEC */
if (argv[optind][0] == '\0')
return STATUS_ERROR_EXIT;
- __pmAddOptHost(&opts, optarg);
+ __pmAddOptHost(&opts, optarg);
return STATUS_OK;
case PLATFORM_LONGOPT_HOSTZONE: /* --hostzone */
@@ -769,6 +828,7 @@ CommandLineStatus Platform_getLongOption(int opt, ATTR_UNUSED int argc, char** a
default:
break;
}
+
return STATUS_ERROR_EXIT;
}
@@ -819,10 +879,10 @@ Hashtable* Platform_dynamicColumns(void) {
return pcp->columns.table;
}
-const char* Platform_dynamicColumnInit(unsigned int key) {
+const char* Platform_dynamicColumnName(unsigned int key) {
PCPDynamicColumn* this = Hashtable_get(pcp->columns.table, key);
if (this) {
- PCPMetric_enable(this->id, true);
+ Metric_enable(this->id, true);
if (this->super.caption)
return this->super.caption;
if (this->super.heading)
@@ -840,3 +900,25 @@ bool Platform_dynamicColumnWriteField(const Process* proc, RichString* str, unsi
}
return false;
}
+
+Hashtable* Platform_dynamicScreens(void) {
+ return pcp->screens.table;
+}
+
+void Platform_defaultDynamicScreens(Settings* settings) {
+ PCPDynamicScreen_appendScreens(&pcp->screens, settings);
+}
+
+void Platform_addDynamicScreen(ScreenSettings* ss) {
+ PCPDynamicScreen_addDynamicScreen(&pcp->screens, ss);
+}
+
+void Platform_addDynamicScreenAvailableColumns(Panel* availableColumns, const char* screen) {
+ Hashtable* screens = pcp->screens.table;
+ PCPDynamicScreens_addAvailableColumns(availableColumns, screens, screen);
+}
+
+void Platform_updateTables(Machine* host) {
+ PCPDynamicScreen_appendTables(&pcp->screens, host);
+ PCPDynamicColumns_setupWidths(&pcp->columns);
+}

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