summaryrefslogtreecommitdiffstats
path: root/cmd/arc_summary
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/arc_summary')
-rwxr-xr-xcmd/arc_summary/arc_summary.py40
1 files changed, 17 insertions, 23 deletions
diff --git a/cmd/arc_summary/arc_summary.py b/cmd/arc_summary/arc_summary.py
index 25db1a941..1456e58f3 100755
--- a/cmd/arc_summary/arc_summary.py
+++ b/cmd/arc_summary/arc_summary.py
@@ -97,7 +97,6 @@ def div1():
def div2():
- div1()
sys.stdout.write("\n")
@@ -1049,7 +1048,6 @@ def _sysctl_summary(Kstat):
sys.stdout.write("\t\# %s\n" % sysctl_descriptions[name])
sys.stdout.write(format % (name, value))
-
unSub = [
_arc_summary,
_arc_efficiency,
@@ -1058,17 +1056,6 @@ unSub = [
_vdev_summary,
]
-
-def _call_all():
- page = 1
- Kstat = get_Kstat()
- for unsub in unSub:
- unsub(Kstat)
- sys.stdout.write("\t\t\t\t\t\t\t\tPage: %2d" % page)
- div2()
- page += 1
-
-
def zfs_header():
daydate = time.strftime("%a %b %d %H:%M:%S %Y")
@@ -1094,20 +1081,27 @@ def main():
if opt == '-p':
args['p'] = arg
- if args:
- alternate_sysctl_layout = True if 'a' in args else False
- show_sysctl_descriptions = True if 'd' in args else False
- try:
- zfs_header()
- unSub[int(args['p']) - 1]()
- div2()
+ Kstat = get_Kstat()
- except:
- _call_all()
+ alternate_sysctl_layout = 'a' in args
+ show_sysctl_descriptions = 'd' in args
+ pages = []
+
+ if 'p' in args:
+ try:
+ pages.append(unSub[int(args['p']) - 1])
+ except IndexError , e:
+ sys.stderr.write('the argument to -p must be between 1 and ' +
+ str(len(unSub)) + '\n')
+ sys.exit()
else:
- _call_all()
+ pages = unSub
+ zfs_header()
+ for page in pages:
+ page(Kstat)
+ div2()
if __name__ == '__main__':
main()