Add ZFS ARC statistics and meters to the PCP platform

This commit is contained in:
Sohaib
2021-02-22 16:45:44 +11:00
committed by Nathan Scott
parent 6bb59f8881
commit e1d1a5cec6
5 changed files with 99 additions and 3 deletions

View File

@ -733,6 +733,45 @@ static void PCPProcessList_updateHeader(ProcessList* super, const Settings* sett
PCPProcessList_updatePerCPUReal(this, PCP_HINV_CPUCLOCK, CPU_FREQUENCY);
}
static inline void PCPProcessList_scanZfsArcstats(PCPProcessList* this) {
unsigned long long int dbufSize = 0;
unsigned long long int dnodeSize = 0;
unsigned long long int bonusSize = 0;
pmAtomValue value,
comp,
uncomp;
if (Metric_values(PCP_ZFS_ARC_ANON_SIZE, &value, 1, PM_TYPE_U64))
this->zfs.anon = value.ull / 1024;
if (Metric_values(PCP_ZFS_ARC_C_MAX, &value, 1, PM_TYPE_U64))
this->zfs.max = value.ull / 1024;
if (Metric_values(PCP_ZFS_ARC_BONUS_SIZE, &value, 1, PM_TYPE_U64))
bonusSize = value.ull / 1024;
if (Metric_values(PCP_ZFS_ARC_DBUF_SIZE, &value, 1, PM_TYPE_U64))
dbufSize = value.ull / 1024;
if (Metric_values(PCP_ZFS_ARC_DNODE_SIZE, &value, 1, PM_TYPE_U64))
dnodeSize = value.ull / 1024;
if (Metric_values(PCP_ZFS_ARC_COMPRESSED_SIZE, &comp, 1, PM_TYPE_U64)) {
this->zfs.isCompressed = 1;
}
if (Metric_values(PCP_ZFS_ARC_UNCOMPRESSED_SIZE, &uncomp, 1, PM_TYPE_U64))
if (Metric_values(PCP_ZFS_ARC_HDR_SIZE, &value, 1, PM_TYPE_U64))
this->zfs.header = value.ull / 1024;
if (Metric_values(PCP_ZFS_ARC_MFU_SIZE, &value, 1, PM_TYPE_U64))
this->zfs.MFU = value.ull / 1024;
if (Metric_values(PCP_ZFS_ARC_MRU_SIZE, &value, 1, PM_TYPE_U64))
this->zfs.MRU = value.ull / 1024;
if (Metric_values(PCP_ZFS_ARC_SIZE, &value, 1, PM_TYPE_U64))
this->zfs.size = value.ull / 1024;
this->zfs.enabled = (this->zfs.size > 0 ? 1 : 0);
this->zfs.other = (dbufSize + dnodeSize + bonusSize) / 1024;
if ( this->zfs.isCompressed ) {
this->zfs.compressed = comp.ull /1024;
this->zfs.uncompressed = uncomp.ull /1024;
}
}
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
PCPProcessList* this = (PCPProcessList*) super;
const Settings* settings = super->settings;
@ -769,6 +808,7 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
this->timestamp = pmtimevalToReal(&timestamp);
PCPProcessList_updateHeader(super, settings);
PCPProcessList_scanZfsArcstats(this);
/* In pause mode only update global data for meters (CPU, memory, etc) */
if (pauseProcessUpdate)