commit 1b9c13a8909f6844dffe98f3f31c80c243b3dbf9
parent e5d63f998099408b247540fab1149ba2fbb50b19
Author: Brendan Gregg <brendan.d.gregg@gmail.com>
Date: Fri, 7 Apr 2017 15:17:19 -0700
Merge pull request #128 from milianw/loop-files
Recurse into all paths passed to files.pl
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/files.pl b/files.pl
@@ -21,14 +21,16 @@ sub usage {
print STDERR "Intended to be piped to flamegraph.pl. Full example:\n";
print STDERR " $0 /Users | flamegraph.pl " .
"--hash --countname=bytes > files.svg\n";
+ print STDERR " $0 /usr /home /root /etc | flamegraph.pl " .
+ "--hash --countname=bytes > files.svg\n";
exit 1;
}
usage() if @ARGV == 0 or $ARGV[0] eq "--help" or $ARGV[0] eq "-h";
-my $dir = $ARGV[0];
-
-find(\&wanted, $dir);
+foreach my $dir (@ARGV) {
+ find(\&wanted, $dir);
+}
sub wanted {
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size) = lstat($_);