From: gfx Date: Sun, 30 Aug 2009 05:48:27 +0000 (+0900) Subject: Improve bench/profile.pl X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c6bdbe978bf0109afdb6f1d81cfb8baab85a8cdd;p=gitmo%2FClass-MOP.git Improve bench/profile.pl --- diff --git a/bench/foo.pl b/bench/foo.pl deleted file mode 100644 index e99365b..0000000 --- a/bench/foo.pl +++ /dev/null @@ -1,5 +0,0 @@ -#!perl -wd:NYTProf -# a moose using script for profiling -# Usage: perl bench/profile.pl - -require KiokuDB; diff --git a/bench/profile.pl b/bench/profile.pl index c4ffc6f..556e70b 100644 --- a/bench/profile.pl +++ b/bench/profile.pl @@ -1,10 +1,7 @@ #!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>; @@ -14,11 +11,15 @@ my $branch = do{ $s; }; -print "Profiling $branch ...\n"; +my $extra = shift || 'KiokuDB'; + +print "Profiling $branch (require $extra) ...\n"; -my @cmd = ($^X, '-Iblib/lib', '-Iblib/arch', $script); +my @cmd = ($^X, '-Iblib/lib', '-Iblib/arch', '-e', "require Moose; require $extra"); 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";