Skip to content

Commit

Permalink
Slightly update arc_summary.py for modern ZFS.
Browse files Browse the repository at this point in the history
  • Loading branch information
amotin committed Mar 18, 2016
1 parent 3076c91 commit 3901f73
Showing 1 changed file with 2 additions and 129 deletions.
131 changes: 2 additions & 129 deletions gui/tools/arc_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,10 @@ def get_arc_summary(Kstat):
deleted = Kstat["kstat.zfs.misc.arcstats.deleted"]
# evict_skip = Kstat["kstat.zfs.misc.arcstats.evict_skip"]
mutex_miss = Kstat["kstat.zfs.misc.arcstats.mutex_miss"]
recycle_miss = Kstat["kstat.zfs.misc.arcstats.recycle_miss"]

# ## ARC Misc. ###
output["arc_misc"] = {}
output["arc_misc"]["deleted"] = fHits(deleted)
output["arc_misc"]['recycle_miss'] = fHits(recycle_miss)
output["arc_misc"]['mutex_miss'] = fHits(mutex_miss)
output["arc_misc"]['evict_skips'] = fHits(mutex_miss)

Expand Down Expand Up @@ -513,7 +511,6 @@ def _arc_summary(Kstat):
# ## ARC Misc. ###
sys.stdout.write("ARC Misc:\n")
sys.stdout.write("\tDeleted:\t\t\t\t%s\n" % arc['arc_misc']['deleted'])
sys.stdout.write("\tRecycle Misses:\t\t\t\t%s\n" % arc['arc_misc']['recycle_miss'])
sys.stdout.write("\tMutex Misses:\t\t\t\t%s\n" % arc['arc_misc']['mutex_miss'])
sys.stdout.write("\tEvict Skips:\t\t\t\t%s\n" % arc['arc_misc']['mutex_miss'])
sys.stdout.write("\n")
Expand Down Expand Up @@ -979,34 +976,14 @@ def get_dmu_summary(Kstat):
if "vfs.zfs.version.spa" not in Kstat:
return output

zfetch_bogus_streams = Kstat["kstat.zfs.misc.zfetchstats.bogus_streams"]
zfetch_colinear_hits = Kstat["kstat.zfs.misc.zfetchstats.colinear_hits"]
zfetch_colinear_misses = Kstat["kstat.zfs.misc.zfetchstats.colinear_misses"]
zfetch_max_streams = Kstat["kstat.zfs.misc.zfetchstats.max_streams"]
zfetch_hits = Kstat["kstat.zfs.misc.zfetchstats.hits"]
zfetch_misses = Kstat["kstat.zfs.misc.zfetchstats.misses"]
zfetch_reclaim_failures = Kstat["kstat.zfs.misc.zfetchstats.reclaim_failures"]
zfetch_reclaim_successes = Kstat["kstat.zfs.misc.zfetchstats.reclaim_successes"]
zfetch_streams_noresets = Kstat["kstat.zfs.misc.zfetchstats.streams_noresets"]
zfetch_streams_resets = Kstat["kstat.zfs.misc.zfetchstats.streams_resets"]
zfetch_stride_hits = Kstat["kstat.zfs.misc.zfetchstats.stride_hits"]
zfetch_stride_misses = Kstat["kstat.zfs.misc.zfetchstats.stride_misses"]

zfetch_access_total = (zfetch_hits + zfetch_misses)
zfetch_colinear_total = (zfetch_colinear_hits + zfetch_colinear_misses)
zfetch_health_count = (zfetch_bogus_streams)
zfetch_reclaim_total = (zfetch_reclaim_successes + zfetch_reclaim_failures)
zfetch_streams_total = (zfetch_streams_resets + zfetch_streams_noresets + zfetch_bogus_streams)
zfetch_stride_total = (zfetch_stride_hits + zfetch_stride_misses)
output['zfetch_access_total'] = zfetch_access_total

if zfetch_access_total > 0:

output['file_level_prefetch'] = {}
if zfetch_health_count > 0:
output['file_level_prefetch']['health'] = 'DEGRADED'
else:
output['file_level_prefetch']['health'] = 'HEALTHY'

output['dmu'] = {}
output['dmu']['efficiency'] = {}
output['dmu']['efficiency']['value'] = fHits(zfetch_access_total)
Expand All @@ -1019,57 +996,6 @@ def get_dmu_summary(Kstat):
'num': fHits(zfetch_misses),
}

output['dmu']['colinear'] = {}
output['dmu']['colinear']['value'] = fHits(zfetch_colinear_total)
output['dmu']['colinear']['hit_ratio'] = {
'per': fPerc(zfetch_colinear_hits, zfetch_colinear_total),
'num': fHits(zfetch_colinear_hits),
}
output['dmu']['colinear']['miss_ratio'] = {
'per': fPerc(zfetch_colinear_misses, zfetch_colinear_total),
'num': fHits(zfetch_colinear_misses),
}

output['dmu']['stride'] = {}
output['dmu']['stride']['value'] = fHits(zfetch_stride_total)
output['dmu']['stride']['hit_ratio'] = {
'per': fPerc(zfetch_stride_hits, zfetch_stride_total),
'num': fHits(zfetch_stride_hits),
}
output['dmu']['stride']['miss_ratio'] = {
'per': fPerc(zfetch_stride_misses, zfetch_stride_total),
'num': fHits(zfetch_stride_misses),
}

output['dmu_misc'] = {}
if zfetch_health_count > 0:
output['dmu_misc']['status'] = "FAULTED"
else:
output['dmu_misc']['status'] = ""

output['dmu_misc']['reclaim'] = {}
output['dmu_misc']['reclaim']['value'] = fHits(zfetch_reclaim_total)
output['dmu_misc']['reclaim']['successes'] = {
'per': fPerc(zfetch_reclaim_successes, zfetch_reclaim_total),
'num': fHits(zfetch_reclaim_successes),
}
output['dmu_misc']['reclaim']['failure'] = {
'per': fPerc(zfetch_reclaim_failures, zfetch_reclaim_total),
'num': fHits(zfetch_reclaim_failures),
}

output['dmu_misc']['streams'] = {}
output['dmu_misc']['streams']['value'] = fHits(zfetch_streams_total)
output['dmu_misc']['streams']['plus_resets'] = {
'per': fPerc(zfetch_streams_resets, zfetch_streams_total),
'num': fHits(zfetch_streams_resets),
}
output['dmu_misc']['streams']['neg_resets'] = {
'per': fPerc(zfetch_streams_noresets, zfetch_streams_total),
'num': fHits(zfetch_streams_noresets),
}
output['dmu_misc']['streams']['bogus'] = fHits(zfetch_bogus_streams)

return output


Expand All @@ -1078,9 +1004,7 @@ def _dmu_summary(Kstat):
arc = get_dmu_summary(Kstat)

if arc['zfetch_access_total'] > 0:
sys.stdout.write("File-Level Prefetch: (%s)\n" % arc['file_level_prefetch']['health'])

sys.stdout.write("DMU Efficiency:\t\t\t\t\t%s\n" % arc['dmu']['efficiency']['value'])
sys.stdout.write("DMU Prefetch Efficiency:\t\t\t%s\n" % arc['dmu']['efficiency']['value'])
sys.stdout.write("\tHit Ratio:\t\t\t%s\t%s\n" % (
arc['dmu']['efficiency']['hit_ratio']['per'],
arc['dmu']['efficiency']['hit_ratio']['num'],
Expand All @@ -1092,57 +1016,6 @@ def _dmu_summary(Kstat):

sys.stdout.write("\n")

sys.stdout.write("\tColinear:\t\t\t\t%s\n" % arc['dmu']['colinear']['value'])
sys.stdout.write("\t Hit Ratio:\t\t\t%s\t%s\n" % (
arc['dmu']['colinear']['hit_ratio']['per'],
arc['dmu']['colinear']['hit_ratio']['num'],
))

sys.stdout.write("\t Miss Ratio:\t\t\t%s\t%s\n" % (
arc['dmu']['colinear']['miss_ratio']['per'],
arc['dmu']['colinear']['miss_ratio']['num'],
))

sys.stdout.write("\n")

sys.stdout.write("\tStride:\t\t\t\t\t%s\n" % arc['dmu']['stride']['value'])
sys.stdout.write("\t Hit Ratio:\t\t\t%s\t%s\n" % (
arc['dmu']['stride']['hit_ratio']['per'],
arc['dmu']['stride']['hit_ratio']['num'],
))

sys.stdout.write("\t Miss Ratio:\t\t\t%s\t%s\n" % (
arc['dmu']['stride']['miss_ratio']['per'],
arc['dmu']['stride']['miss_ratio']['num'],
))

sys.stdout.write("\n")
sys.stdout.write("DMU Misc: %s\n" % arc['dmu_misc']['status'])

sys.stdout.write("\tReclaim:\t\t\t\t%s\n" % arc['dmu_misc']['reclaim']['value'])
sys.stdout.write("\t Successes:\t\t\t%s\t%s\n" % (
arc['dmu_misc']['reclaim']['successes']['per'],
arc['dmu_misc']['reclaim']['successes']['num'],
))

sys.stdout.write("\t Failures:\t\t\t%s\t%s\n" % (
arc['dmu_misc']['reclaim']['failure']['per'],
arc['dmu_misc']['reclaim']['failure']['num'],
))

sys.stdout.write("\n\tStreams:\t\t\t\t%s\n" % arc['dmu_misc']['streams']['value'])
sys.stdout.write("\t +Resets:\t\t\t%s\t%s\n" % (
arc['dmu_misc']['streams']['plus_resets']['per'],
arc['dmu_misc']['streams']['plus_resets']['num'],
))

sys.stdout.write("\t -Resets:\t\t\t%s\t%s\n" % (
arc['dmu_misc']['streams']['neg_resets']['per'],
arc['dmu_misc']['streams']['neg_resets']['num'],
))

sys.stdout.write("\t Bogus:\t\t\t\t%s\n" % arc['dmu_misc']['streams']['bogus'])


def get_vdev_summary(Kstat):
output = {}
Expand Down

0 comments on commit 3901f73

Please sign in to comment.