Title: [110389] trunk
Revision
110389
Author
[email protected]
Date
2012-03-11 01:11:58 -0800 (Sun, 11 Mar 2012)

Log Message

Add --instruments option to sunspider to profile with Instruments
https://bugs.webkit.org/show_bug.cgi?id=80783

Reviewed by Filip Pizlo.

PerformanceTests/SunSpider: 

* resources/TimeProfile20us.tracetemplate: Added.
* sunspider:
(runTestsOnce):

Tools: 

* Scripts/run-sunspider:

Modified Paths

Added Paths

Diff

Modified: trunk/PerformanceTests/SunSpider/ChangeLog (110388 => 110389)


--- trunk/PerformanceTests/SunSpider/ChangeLog	2012-03-11 08:26:07 UTC (rev 110388)
+++ trunk/PerformanceTests/SunSpider/ChangeLog	2012-03-11 09:11:58 UTC (rev 110389)
@@ -1,3 +1,14 @@
+2012-03-11  Maciej Stachowiak  <[email protected]>
+
+        Add --instruments option to sunspider to profile with Instruments
+        https://bugs.webkit.org/show_bug.cgi?id=80783
+
+        Reviewed by Filip Pizlo.
+
+        * resources/TimeProfile20us.tracetemplate: Added.
+        * sunspider:
+        (runTestsOnce):
+
 2011-11-15  Andy Wingo  <[email protected]>
 
         Extend sunspider driver to be able to run kraken

Added: trunk/PerformanceTests/SunSpider/resources/TimeProfile20us.tracetemplate


(Binary files differ)
Property changes on: trunk/PerformanceTests/SunSpider/resources/TimeProfile20us.tracetemplate ___________________________________________________________________

Added: svn:mime-type

Modified: trunk/PerformanceTests/SunSpider/sunspider (110388 => 110389)


--- trunk/PerformanceTests/SunSpider/sunspider	2012-03-11 08:26:07 UTC (rev 110388)
+++ trunk/PerformanceTests/SunSpider/sunspider	2012-03-11 09:11:58 UTC (rev 110389)
@@ -36,6 +36,7 @@
 my $runShark = 0;
 my $runShark20 = 0;
 my $runSharkCache = 0;
+my $runInstruments = 0;
 my $ubench = 0;
 my $v8suite = 0;
 my $suite = "";
@@ -58,6 +59,7 @@
   --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
+  --instruments     Sample execution time with the Mac OS X "Instruments" tool (Time Profile) (implies --runs=1)
   --suite           Select a specific benchmark suite. The default is sunspider-1.0
   --ubench          Use microbenchmark suite instead of regular tests. Same as --suite=ubench
   --v8-suite        Use the V8 benchmark suite. Same as --suite=v8-v4
@@ -71,6 +73,7 @@
            'shark' => \$runShark,
            'shark20' => \$runShark20,
            'shark-cache' => \$runSharkCache,
+           'instruments' => \$runInstruments,
            'suite=s' => \$suite,
            'ubench' => \$ubench,
            'v8-suite' => \$v8suite,
@@ -91,7 +94,7 @@
 
 $runShark = 1 if $runSharkCache;
 $runShark = 20 if $runShark20;
-$testRuns = 1 if $runShark;
+$testRuns = 1 if $runShark || $runInstruments;
 if ($runShark && ! -x "/usr/bin/shark") {
     die "Please install CHUD tools from http://developer.apple.com/tools/download/\n";
 }
@@ -162,15 +165,17 @@
     dumpToFile($prefix, $prefixFile);
 }
 
-sub runTestsOnce($)
+sub runTestsOnce($$)
 {
-    my ($useShark) = @_;
+    my ($useShark, $useInstruments) = @_;
     my $shellArgs = $jsShellArgs . " -f $prefixFile -f resources/sunspider-standalone-driver.js 2> " . File::Spec->devnull();
     my $output;
     if ($useShark) {
         my $intervalArg = $useShark == 20 ? "-I 20u" : "";
         my $cacheArg = $runSharkCache ? "-c $sharkCacheProfileIndex" : "";
         $output = `shark $intervalArg $cacheArg -i -1-q "$jsShellPath" $shellArgs`;
+    } elsif ($useInstruments) {
+        $output = `instruments -t "resources/TimeProfile20us.tracetemplate" "$jsShellPath" $shellArgs`;
     } else {
         $output = `"$jsShellPath" $shellArgs | grep -v break`;
     }
@@ -205,10 +210,10 @@
     print STDERR "Found " . scalar(@tests) . " tests\n";
 }
 die "No tests to run"  unless scalar(@tests);
-print STDERR "Running SunSpider once for warmup, then " . ($runShark ? "under Shark" : "$testRuns time" . ($testRuns == 1 ? "" : "s")) . "\n";
+print STDERR "Running SunSpider once for warmup, then " . ($runShark ? "under Shark" : ($runInstruments ? "under Instruments" : "$testRuns time" . ($testRuns == 1 ? "" : "s"))) . "\n";
 writePrefixFile();
 
-runTestsOnce(0);
+runTestsOnce(0, 0);
 print "Discarded first run.\n";
 
 my $result;
@@ -217,7 +222,7 @@
 my $total = 0;
 print "[";
 while ($count++ < $testRuns) {
-    $result = runTestsOnce($runShark);
+    $result = runTestsOnce($runShark, $runInstruments);
     $result =~ s/\r\n/\n/g;
     chomp $result;
     push @results, $result;
@@ -242,3 +247,12 @@
         exec "/usr/bin/open", $profileFile;
     }
 }
+
+if ($runInstruments) {
+    my $newestTrace = newestFile(".", qr/\.trace$/);
+    if ($newestTrace) {
+        my $profileFile = "$resultDirectory/sunspider-profile-$timeString.trace";
+        rename $newestTrace, $profileFile or die;
+        exec "/usr/bin/open", $profileFile;
+    }
+}

Modified: trunk/Tools/ChangeLog (110388 => 110389)


--- trunk/Tools/ChangeLog	2012-03-11 08:26:07 UTC (rev 110388)
+++ trunk/Tools/ChangeLog	2012-03-11 09:11:58 UTC (rev 110389)
@@ -1,3 +1,12 @@
+2012-03-11  Maciej Stachowiak  <[email protected]>
+
+        Add --instruments option to sunspider to profile with Instruments
+        https://bugs.webkit.org/show_bug.cgi?id=80783
+
+        Reviewed by Filip Pizlo.
+
+        * Scripts/run-sunspider:
+
 2012-03-11  Viatcheslav Ostapenko  <[email protected]>
 
         [Qt] [WK2] Support threaded renderer in WK2

Modified: trunk/Tools/Scripts/run-sunspider (110388 => 110389)


--- trunk/Tools/Scripts/run-sunspider	2012-03-11 08:26:07 UTC (rev 110388)
+++ trunk/Tools/Scripts/run-sunspider	2012-03-11 09:11:58 UTC (rev 110389)
@@ -41,6 +41,7 @@
 my $runShark = 0;
 my $runShark20 = 0;
 my $runSharkCache = 0;
+my $runInstruments = 0;
 my $suite = "";
 my $ubench = 0;
 my $v8suite = 0;
@@ -61,6 +62,7 @@
   --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
+  --instruments     Sample with the Mac OS X "Instruments" tool (Time Profile) (implies --runs=1)
   --suite           Select a specific benchmark suite. The default is sunspider-0.9.1
   --ubench          Use microbenchmark suite instead of regular tests. Same as --suite=ubench
   --v8-suite        Use the V8 benchmark suite. Same as --suite=v8-v4
@@ -74,6 +76,7 @@
            'shark' => \$runShark,
            'shark20' => \$runShark20,
            'shark-cache' => \$runSharkCache,
+           'instruments' => \$runInstruments,
            'suite=s' => \$suite,
            'ubench' => \$ubench,
            'v8-suite' => \$v8suite,
@@ -125,6 +128,7 @@
 push @args, "--shark" if $runShark;
 push @args, "--shark20" if $runShark20;
 push @args, "--shark-cache" if $runSharkCache;
+push @args, "--instruments" if $runInstruments;
 push @args, "--suite=${suite}" if $suite;
 push @args, "--ubench" if $ubench;
 push @args, "--v8-suite" if $v8suite;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to