From: gfx Date: Fri, 25 Sep 2009 12:57:27 +0000 (+0900) Subject: Add a profile script X-Git-Tag: 0.35~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=834fbe127a997bbce6487957fdeb55af71d0cae1;p=gitmo%2FMouse.git Add a profile script --- diff --git a/author/he-profile.pl b/author/he-profile.pl new file mode 100644 index 0000000..dbab673 --- /dev/null +++ b/author/he-profile.pl @@ -0,0 +1,29 @@ +#!perl -w +# Usage: perl author/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', '-d:NYTProf', '-e', + 'require HTTP::Engine; require HTTP::Engine::Interface::CGI'); + +print "> @cmd\n"; +system(@cmd) == 0 or die "Cannot profile"; +system(@cmd) == 0 or die "Cannot profile"; +system(@cmd) == 0 or die "Cannot profile"; + +@cmd = ($^X, '-S', 'nytprofhtml', '--out', "nytprof-$branch"); +print "> @cmd\n"; +system(@cmd) == 0 or die "Cannot profile";