Merge pull request #695 from smalinux/zfs-orgniz

PCP: cleanup: put ZFS in its rightful place
This commit is contained in:
Nathan Scott 2021-07-15 12:11:09 +10:00 committed by GitHub
commit f21f81b2de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 36 additions and 35 deletions

View File

@ -555,6 +555,41 @@ static void PCPProcessList_updatePerCPUReal(PCPProcessList* this, Metric metric,
this->percpu[i][cpumetric].d = this->values[i].d; this->percpu[i][cpumetric].d = this->values[i].d;
} }
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;
memset(&this->zfs, 0, sizeof(ZfsArcStats));
if (Metric_values(PCP_ZFS_ARC_ANON_SIZE, &value, 1, PM_TYPE_U64))
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 / ONE_K;
if (Metric_values(PCP_ZFS_ARC_BONUS_SIZE, &value, 1, PM_TYPE_U64))
bonusSize = value.ull / ONE_K;
if (Metric_values(PCP_ZFS_ARC_DBUF_SIZE, &value, 1, PM_TYPE_U64))
dbufSize = value.ull / ONE_K;
if (Metric_values(PCP_ZFS_ARC_DNODE_SIZE, &value, 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 / ONE_K;
if (Metric_values(PCP_ZFS_ARC_MFU_SIZE, &value, 1, PM_TYPE_U64))
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 / ONE_K;
if (Metric_values(PCP_ZFS_ARC_SIZE, &value, 1, PM_TYPE_U64))
this->zfs.size = value.ull / ONE_K;
this->zfs.other = (dbufSize + dnodeSize + bonusSize) / ONE_K;
this->zfs.enabled = (this->zfs.size > 0);
this->zfs.isCompressed = (this->zfs.compressed > 0);
}
static void PCPProcessList_updateHeader(ProcessList* super, const Settings* settings) { static void PCPProcessList_updateHeader(ProcessList* super, const Settings* settings) {
PCPProcessList_updateMemoryInfo(super); PCPProcessList_updateMemoryInfo(super);
@ -589,41 +624,8 @@ static void PCPProcessList_updateHeader(ProcessList* super, const Settings* sett
if (settings->showCPUFrequency) if (settings->showCPUFrequency)
PCPProcessList_updatePerCPUReal(this, PCP_HINV_CPUCLOCK, CPU_FREQUENCY); PCPProcessList_updatePerCPUReal(this, PCP_HINV_CPUCLOCK, CPU_FREQUENCY);
}
static inline void PCPProcessList_scanZfsArcstats(PCPProcessList* this) { PCPProcessList_scanZfsArcstats(this);
unsigned long long int dbufSize = 0;
unsigned long long int dnodeSize = 0;
unsigned long long int bonusSize = 0;
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 / ONE_K;
if (Metric_values(PCP_ZFS_ARC_C_MAX, &value, 1, PM_TYPE_U64))
this->zfs.max = value.ull / ONE_K;
if (Metric_values(PCP_ZFS_ARC_BONUS_SIZE, &value, 1, PM_TYPE_U64))
bonusSize = value.ull / ONE_K;
if (Metric_values(PCP_ZFS_ARC_DBUF_SIZE, &value, 1, PM_TYPE_U64))
dbufSize = value.ull / ONE_K;
if (Metric_values(PCP_ZFS_ARC_DNODE_SIZE, &value, 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 / ONE_K;
if (Metric_values(PCP_ZFS_ARC_MFU_SIZE, &value, 1, PM_TYPE_U64))
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 / ONE_K;
if (Metric_values(PCP_ZFS_ARC_SIZE, &value, 1, PM_TYPE_U64))
this->zfs.size = value.ull / ONE_K;
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) { void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
@ -662,7 +664,6 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
this->timestamp = pmtimevalToReal(&timestamp); this->timestamp = pmtimevalToReal(&timestamp);
PCPProcessList_updateHeader(super, settings); PCPProcessList_updateHeader(super, settings);
PCPProcessList_scanZfsArcstats(this);
/* In pause mode only update global data for meters (CPU, memory, etc) */ /* In pause mode only update global data for meters (CPU, memory, etc) */
if (pauseProcessUpdate) if (pauseProcessUpdate)