Commit | Line | Data |
834fbe12 |
1 | #!perl -w |
2 | # Usage: perl author/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', '-d:NYTProf', '-e', |
20 | 'require HTTP::Engine; require HTTP::Engine::Interface::CGI'); |
21 | |
22 | print "> @cmd\n"; |
23 | system(@cmd) == 0 or die "Cannot profile"; |
24 | system(@cmd) == 0 or die "Cannot profile"; |
25 | system(@cmd) == 0 or die "Cannot profile"; |
26 | |
27 | @cmd = ($^X, '-S', 'nytprofhtml', '--out', "nytprof-$branch"); |
28 | print "> @cmd\n"; |
29 | system(@cmd) == 0 or die "Cannot profile"; |