From 88b83efb2adbd0965f5f5acdb5468a808ca8771d Mon Sep 17 00:00:00 2001 From: "eric@webkit.org" Date: Wed, 14 Nov 2007 20:36:28 +0000 Subject: [PATCH] 2007-11-14 Eric Seidel Reviewed by Sam. * sunspider: add --shark-cache for L2 Cache Miss profiling git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27790 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- SunSpider/ChangeLog | 6 ++++++ SunSpider/sunspider | 26 ++++++++++++++++++++++++-- WebKitTools/ChangeLog | 6 ++++++ WebKitTools/Scripts/run-sunspider | 4 ++++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/SunSpider/ChangeLog b/SunSpider/ChangeLog index fdf9262..91c1c05 100644 --- a/SunSpider/ChangeLog +++ b/SunSpider/ChangeLog @@ -1,3 +1,9 @@ +2007-11-14 Eric Seidel + + Reviewed by Sam. + + * sunspider: add --shark-cache for L2 Cache Miss profiling + 2007-11-09 Alexey Proskuryakov Reviewed by Darin. diff --git a/SunSpider/sunspider b/SunSpider/sunspider index bd6436e..39af5b9 100755 --- a/SunSpider/sunspider +++ b/SunSpider/sunspider @@ -34,6 +34,7 @@ use POSIX qw(strftime); my $showHelp = 0; my $runShark = 0; my $runShark20 = 0; +my $runSharkCache = 0; my $jsShellPath; my $setBaseline = 0; my $testsPattern; @@ -47,8 +48,9 @@ Usage: $programName --shell=[path] [options] --shell Path to JavaScript shell --runs Number of times to run tests (default: $testRuns) --tests Only run tests matching provided pattern - --shark Sample with the Mac OS X "Shark" performance testing tool (implies --runs=1) + --shark Sample execution time with the Mac OS X "Shark" performance testing tool (implies --runs=1) --shark20 Like --shark, but with a 20 microsecond sampling interval + --shark-cache Like --shark, but performs a L2 cache-miss sample instead of time sample EOF GetOptions('runs=i' => \$testRuns, @@ -56,15 +58,34 @@ GetOptions('runs=i' => \$testRuns, 'shell=s' => \$jsShellPath, 'shark' => \$runShark, 'shark20' => \$runShark20, + 'shark-cache' => \$runSharkCache, 'tests=s' => \$testsPattern, 'help' => \$showHelp); +$runShark = 1 if $runSharkCache; $runShark = 20 if $runShark20; $testRuns = 1 if $runShark; if ($runShark && ! -x "/usr/bin/shark") { die "Please install CHUD tools from http://developer.apple.com/tools/download/\n"; } +my $sharkCacheProfileIndex = 0; +if ($runSharkCache) { + my $sharkProfileList = `shark -l 2>&1`; + for my $profile (split(/\n/, $sharkProfileList)) { + $profile =~ /(\d+) - (.+)/; + next unless (defined $1); + my $profileIndex = $1; + my $profileName = $2; + if ($profileName =~ /L2 Cache/) { + $sharkCacheProfileIndex = $profileIndex; + print "Using Shark L2 Cache Miss Profile: " . $profile . "\n"; + last; + } + } + die "Failed to find L2 Cache Miss Profile for --shark-cache\n" unless ($sharkCacheProfileIndex); +} + if (!$jsShellPath || $showHelp) { print STDERR $usage; exit 1; @@ -120,7 +141,8 @@ sub runTestsOnce($) my $output; if ($useShark) { my $intervalArg = $useShark == 20 ? "-I 20u" : ""; - $output = `shark $intervalArg -i -1-q "$jsShellPath" $shellArgs`; + my $cacheArg = $runSharkCache ? "-c $sharkCacheProfileIndex" : ""; + $output = `shark $intervalArg $cacheArg -i -1-q "$jsShellPath" $shellArgs`; } else { $output = `"$jsShellPath" $shellArgs | grep -v break`; } diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog index ce42efd..2e61228d 100644 --- a/WebKitTools/ChangeLog +++ b/WebKitTools/ChangeLog @@ -1,3 +1,9 @@ +2007-11-14 Eric Seidel + + Reviewed by Sam. + + * Scripts/run-sunspider: add --shark-cache for L2 Cache Miss profiling + 2007-11-14 Anders Carlsson Reviewed by Adam. diff --git a/WebKitTools/Scripts/run-sunspider b/WebKitTools/Scripts/run-sunspider index 70878e9..23c0433 100755 --- a/WebKitTools/Scripts/run-sunspider +++ b/WebKitTools/Scripts/run-sunspider @@ -40,6 +40,7 @@ my $root; my $testRuns = 5; # This number may be different from what sunspider defaults to (that's OK) my $runShark = 0; my $runShark20 = 0; +my $runSharkCache = 0; my $setBaseline = 0; my $showHelp = 0; my $testsPattern; @@ -54,6 +55,7 @@ Usage: $programName [options] [options to pass to build system] --tests Only run tests matching provided pattern --shark Sample with the Mac OS X "Shark" performance testing tool (implies --runs=1) --shark20 Like --shark, but with a 20 microsecond sampling interval + --shark-cache Like --shark, but performs a L2 cache-miss sample instead of time sample EOF GetOptions('root=s' => sub { my ($argName, $value); setConfigurationProductDir(Cwd::abs_path($value)); }, @@ -61,6 +63,7 @@ GetOptions('root=s' => sub { my ($argName, $value); setConfigurationProductDir(C 'set-baseline' => \$setBaseline, 'shark' => \$runShark, 'shark20' => \$runShark20, + 'shark-cache' => \$runSharkCache, 'tests=s' => \$testsPattern, 'help' => \$showHelp); @@ -114,6 +117,7 @@ my @args = ("--shell", testKJSPath($productDir), "--runs", $testRuns); push @args, "--set-baseline" if $setBaseline; push @args, "--shark" if $runShark; push @args, "--shark20" if $runShark20; +push @args, "--shark-cache" if $runSharkCache; push @args, "--tests", $testsPattern if $testsPattern; exec "./sunspider", @args; -- 1.8.3.1