Fixes and cleanups for ZFS Meters and metrics

This commit is contained in:
Nathan Scott 2021-02-22 16:54:33 +11:00
parent 0e7ae9a592
commit c6f20fbcc6

View File

@ -737,39 +737,35 @@ 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;
pmAtomValue value;
memset(&this->zfs, 0, sizeof(ZfsArcStats));
if (Metric_values(PCP_ZFS_ARC_ANON_SIZE, &value, 1, PM_TYPE_U64))
this->zfs.anon = value.ull / 1024;
this->zfs.anon = value.ull / ONE_K;
if (Metric_values(PCP_ZFS_ARC_C_MAX, &value, 1, PM_TYPE_U64))
this->zfs.max = value.ull / 1024;
this->zfs.max = value.ull / ONE_K;
if (Metric_values(PCP_ZFS_ARC_BONUS_SIZE, &value, 1, PM_TYPE_U64))
bonusSize = value.ull / 1024;
bonusSize = value.ull / ONE_K;
if (Metric_values(PCP_ZFS_ARC_DBUF_SIZE, &value, 1, PM_TYPE_U64))
dbufSize = value.ull / 1024;
dbufSize = value.ull / ONE_K;
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))
dnodeSize = value.ull / ONE_K;
if (Metric_values(PCP_ZFS_ARC_COMPRESSED_SIZE, &value, 1, PM_TYPE_U64))
this->zfs.compressed = value.ull / ONE_K;
if (Metric_values(PCP_ZFS_ARC_UNCOMPRESSED_SIZE, &value, 1, PM_TYPE_U64))
this->zfs.uncompressed = value.ull / ONE_K;
if (Metric_values(PCP_ZFS_ARC_HDR_SIZE, &value, 1, PM_TYPE_U64))
this->zfs.header = value.ull / 1024;
this->zfs.header = value.ull / ONE_K;
if (Metric_values(PCP_ZFS_ARC_MFU_SIZE, &value, 1, PM_TYPE_U64))
this->zfs.MFU = value.ull / 1024;
this->zfs.MFU = value.ull / ONE_K;
if (Metric_values(PCP_ZFS_ARC_MRU_SIZE, &value, 1, PM_TYPE_U64))
this->zfs.MRU = value.ull / 1024;
this->zfs.MRU = value.ull / ONE_K;
if (Metric_values(PCP_ZFS_ARC_SIZE, &value, 1, PM_TYPE_U64))
this->zfs.size = value.ull / 1024;
this->zfs.size = value.ull / ONE_K;
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;
}
this->zfs.other = (dbufSize + dnodeSize + bonusSize) / ONE_K;
this->zfs.enabled = (this->zfs.size > 0);
this->zfs.isCompressed = (this->zfs.compressed > 0);
}
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {