# HG changeset patch # User Fabian Keil # Date 1309792948 -7200 # Node ID 0b5fed9677f1e5e10293ba104a1cc7812d6555db # Parent 22fa5083fbb4835bf9ca84aa8c179a0b33b1e14a Add an -a flag to align the sysctl values when the -d flag is used diff -r 22fa5083fbb4 -r 0b5fed9677f1 base/head/scripts/zfs/arc_summary/arc_summary.pl --- a/base/head/scripts/zfs/arc_summary/arc_summary.pl Sun Jul 03 23:17:11 2011 -0400 +++ b/base/head/scripts/zfs/arc_summary/arc_summary.pl Mon Jul 04 17:22:28 2011 +0200 @@ -48,6 +48,7 @@ my $usetunable = 1; # Change to 0 to disable sysctl MIB spill. my $show_sysctl_descriptions = 0; # Change to 1 (or use the -d flag) to show sysctl descriptions. +my $align_sysctl_values = 0; # Change to 1 (or use the -a flag) to align the -d output sub hline { print "\n------------------------------------------------------------------------\n\n"; @@ -596,7 +597,10 @@ chomp($tunable); my ($name, $value) = split(/=/, $tunable, 2); if ($show_sysctl_descriptions) { - printf("\t\# %s\n\t%s=%d\n", $sysctl_descriptions{$name}, $name, $value); + my $format = $align_sysctl_values ? + "\t\# %s\n\t%-32s = %15d\n" : + "\t\# %s\n\t%s=%d\n"; + printf($format, $sysctl_descriptions{$name}, $name, $value); } else { print "\t$tunable\n"; } @@ -625,8 +629,9 @@ } my %opt; -getopts("dp:", \%opt); +getopts("adp:", \%opt); if (%opt) { + $align_sysctl_values = 1 if $opt{a}; $show_sysctl_descriptions = 1 if $opt{d}; switch($opt{p}) { case 1 { eval $unSub[0]; hline; }