Skip to content

Commit

Permalink
Merge pull request #128 from milianw/loop-files
Browse files Browse the repository at this point in the history
Recurse into all paths passed to files.pl
  • Loading branch information
brendangregg authored Apr 7, 2017
2 parents e5d63f9 + 41d639f commit 1b9c13a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions files.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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($_);
Expand Down

0 comments on commit 1b9c13a

Please sign in to comment.