Commit | Line | Data |
38bf2a25 |
1 | #!perl -w |
2 | # Usage: perl bench/profile.pl (no other options including -Mblib are reqired) |
3 | |
4 | use strict; |
5 | |
6 | my $script = 'bench/foo.pl'; |
7 | |
8 | my $branch = do { |
9 | open my $in, '.git/HEAD' or die "Cannot open .git/HEAD: $!"; |
10 | my $s = scalar <$in>; |
11 | chomp $s; |
12 | $s =~ s{^ref: \s+ refs/heads/}{}xms; |
13 | $s =~ s{/}{_}xmsg; |
14 | $s; |
15 | }; |
16 | |
17 | print "Profiling $branch ...\n"; |
18 | |
19 | my @cmd = ( $^X, '-Iblib/lib', '-Iblib/arch', $script ); |
20 | print "> @cmd\n"; |
21 | system(@cmd) == 0 or die "Cannot profile"; |
22 | |
23 | @cmd = ( $^X, '-S', 'nytprofhtml', '--out', "nytprof-$branch" ); |
24 | print "> @cmd\n"; |
25 | system(@cmd) == 0 or die "Cannot profile"; |