diff options
author | Sohaib Mohamed <sohaib.amhmd@gmail.com> | 2022-05-04 09:55:43 +0200 |
---|---|---|
committer | cgzones <cgzones@googlemail.com> | 2023-02-19 17:56:50 +0100 |
commit | bdb63a497beeb4b317296ca123c507233a2af889 (patch) | |
tree | bffc8cc1105326e719aa21fccbe3bb3efdfe1aea /pcp/Platform.c | |
parent | 62f4628efef67280c7c480dcd5df65867bd4d960 (diff) |
Implement File Descriptor Meter support for PCP
Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
Diffstat (limited to 'pcp/Platform.c')
-rw-r--r-- | pcp/Platform.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pcp/Platform.c b/pcp/Platform.c index d9f75ebc..a76c0288 100644 --- a/pcp/Platform.c +++ b/pcp/Platform.c @@ -25,6 +25,7 @@ in the source distribution for its full text. #include "DiskIOMeter.h" #include "DynamicColumn.h" #include "DynamicMeter.h" +#include "FileDescriptorMeter.h" #include "HostnameMeter.h" #include "LoadAverageMeter.h" #include "Macros.h" @@ -115,6 +116,7 @@ const MeterClass* const Platform_meterTypes[] = { &DiskIOMeter_class, &NetworkIOMeter_class, &SysArchMeter_class, + &FileDescriptorMeter_class, NULL }; @@ -192,6 +194,8 @@ 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_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", @@ -727,6 +731,17 @@ bool Platform_getNetworkIO(NetworkIOData* data) { return true; } +void Platform_getFileDescriptors(double* used, double* max) { + *used = NAN; + *max = 65536; + + pmAtomValue value; + if (PCPMetric_values(PCP_VFS_FILES_COUNT, &value, 1, PM_TYPE_32) != NULL) + *used = value.l; + if (PCPMetric_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; |