don't wrap df output
[sysadmin-cookbook] / recepies / acct / lastcomm-duration.pl
index f0d1dc0..ed83a04 100755 (executable)
@@ -5,7 +5,7 @@ use strict;
 
 use YAML;
 
-my $too_long = 0.5; # s
+my $too_long = shift @ARGV || 0.5; # s
 my $stats;
 
 open(my $lastcomm, '-|', 'lastcomm');
@@ -26,6 +26,7 @@ foreach my $stat ( keys %$stats ) {
        print "\n$stat:\n";
        my $counter = $stats->{$stat};
        foreach my $name ( sort { $counter->{$b} <=> $counter->{$a} } keys %$counter ) {
-               printf "%8.2f %s\n", $counter->{$name}, $name;
+               my $d = $counter->{$name};
+               printf "%8.2f %s\n", $d, $name if $d > $too_long;
        }
 }