Ensure arc_size_break is filled in arc_summary.py

Use mfu_size and mru_size pulled from the arcstats
kstat file to calculate the mfu and mru percentages
for arc size breakdown.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed-by: AndCycle <andcycle@andcycle.idv.tw>
Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Closes #5526 
Closes #6770
This commit is contained in:
Giuseppe Di Natale 2017-10-23 14:18:12 -07:00 committed by Tony Hutter
parent c45254b0ec
commit 029a1b0c20
1 changed files with 10 additions and 22 deletions

View File

@ -185,7 +185,8 @@ def get_arc_summary(Kstat):
# ARC Sizing # ARC Sizing
arc_size = Kstat["kstat.zfs.misc.arcstats.size"] arc_size = Kstat["kstat.zfs.misc.arcstats.size"]
mru_size = Kstat["kstat.zfs.misc.arcstats.p"] mru_size = Kstat["kstat.zfs.misc.arcstats.mru_size"]
mfu_size = Kstat["kstat.zfs.misc.arcstats.mfu_size"]
target_max_size = Kstat["kstat.zfs.misc.arcstats.c_max"] target_max_size = Kstat["kstat.zfs.misc.arcstats.c_max"]
target_min_size = Kstat["kstat.zfs.misc.arcstats.c_min"] target_min_size = Kstat["kstat.zfs.misc.arcstats.c_min"]
target_size = Kstat["kstat.zfs.misc.arcstats.c"] target_size = Kstat["kstat.zfs.misc.arcstats.c"]
@ -230,25 +231,12 @@ def get_arc_summary(Kstat):
] ]
output['arc_size_break'] = {} output['arc_size_break'] = {}
if arc_size > target_size:
mfu_size = (arc_size - mru_size)
output['arc_size_break']['recently_used_cache_size'] = { output['arc_size_break']['recently_used_cache_size'] = {
'per': fPerc(mru_size, arc_size), 'per': fPerc(mru_size, mru_size + mfu_size),
'num': fBytes(mru_size), 'num': fBytes(mru_size),
} }
output['arc_size_break']['frequently_used_cache_size'] = { output['arc_size_break']['frequently_used_cache_size'] = {
'per': fPerc(mfu_size, arc_size), 'per': fPerc(mfu_size, mru_size + mfu_size),
'num': fBytes(mfu_size),
}
elif arc_size < target_size:
mfu_size = (target_size - mru_size)
output['arc_size_break']['recently_used_cache_size'] = {
'per': fPerc(mru_size, target_size),
'num': fBytes(mru_size),
}
output['arc_size_break']['frequently_used_cache_size'] = {
'per': fPerc(mfu_size, target_size),
'num': fBytes(mfu_size), 'num': fBytes(mfu_size),
} }