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