summaryrefslogtreecommitdiff
path: root/benchmarks/cmop/profile.pl
blob: 4ea5b014d2eee53d5e7ea2a61a1d368f405fa1aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!perl -w
# Usage: perl bench/profile.pl (no other options including -Mblib are reqired)

use strict;

my $script = 'bench/foo.pl';

my $branch = do {
    open my $in, '.git/HEAD' or die "Cannot open .git/HEAD: $!";
    my $s = scalar <$in>;
    chomp $s;
    $s =~ s{^ref: \s+ refs/heads/}{}xms;
    $s =~ s{/}{_}xmsg;
    $s;
};

print "Profiling $branch ...\n";

my @cmd = ( $^X, '-Iblib/lib', '-Iblib/arch', $script );
print "> @cmd\n";
system(@cmd) == 0 or die "Cannot profile";

@cmd = ( $^X, '-S', 'nytprofhtml', '--out', "nytprof-$branch" );
print "> @cmd\n";
system(@cmd) == 0 or die "Cannot profile";