* resources/sunspider-analyze-results.js: Tweak the output format a little.
Change so that when there's only one run we don't write out confidence
intervals at all rather than writing "NaN" over and over again.
* sunspider: Use the time and date as a suffix on the results file, that way
all the results are left behind in the tmp directory. This will make it easy
for us to add features that compare past results in the future. Also rename
the .mshark files using the same scheme.
* sunspider-compare-results: Relax the parsing rules so we can parse the
results file exactly as it's emitted from sunspider.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27194
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-10-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Adam.
+
+ * resources/sunspider-analyze-results.js: Tweak the output format a little.
+ Change so that when there's only one run we don't write out confidence
+ intervals at all rather than writing "NaN" over and over again.
+
+ * sunspider: Use the time and date as a suffix on the results file, that way
+ all the results are left behind in the tmp directory. This will make it easy
+ for us to add features that compare past results in the future. Also rename
+ the .mshark files using the same scheme.
+
+ * sunspider-compare-results: Relax the parsing rules so we can parse the
+ results file exactly as it's emitted from sunspider.
+
2007-10-25 Adam Roben <aroben@apple.com>
Strip carriage returns from results
meanString = " " + meanString;
}
+ if (n == 1)
+ return meanString + "ms";
+
return meanString + "ms +/- " + ((tDist(n) * stdErr / mean) * 100).toFixed(1) + "%";
}
var meanWidth = computeMeanWidth();
print("\n");
- print("========================================");
- print("RESULTS (means and 95% confidence intervals)");
- print("----------------------------------------");
+ print("============================================");
+ if (count == 1)
+ print("RESULTS");
+ else
+ print("RESULTS (means and 95% confidence intervals)");
+ print("--------------------------------------------");
print(resultLine(labelWidth, 0, "Total", meanWidth, mean, stdErr));
- print("----------------------------------------");
+ print("--------------------------------------------");
for (var category in categoryMeans) {
print("");
print(resultLine(labelWidth, 2, category, meanWidth, categoryMeans[category], categoryStdErrs[category]));
use Getopt::Long;
use File::Basename;
use Cwd;
+use POSIX qw(strftime);
my $showHelp = 0;
my $runShark = 0;
'tests=s' => \$testsPattern,
'help' => \$showHelp);
-$testRuns = 1 if $runShark;
+$testRuns = 1 if $runShark;
if (!$jsShellPath || $showHelp) {
print STDERR $usage;
close FILE;
}
-# FIXME: these globals are rather poor abstraction
my @tests = ();
my @categories = ();
my %uniqueCategories = ();
close TESTLIST;
}
+my $timeString = strftime "%Y-%m-%d-%H:%M:%S", localtime $^T;
+my $prefixFile = "tmp/sunspider-test-prefix.js";
+my $resultsFile = "tmp/sunspider-results-$timeString.js";
+
sub writePrefixFile()
{
my $prefix = "var tests = [ " . join(", ", map { '"' . $_ . '"' } @tests) . " ];\n";
$prefix .= "var categories = [ " . join(", ", map { '"' . $_ . '"' } @categories) . " ];\n";
mkdir "tmp";
- dumpToFile($prefix, "tmp/sunspider-test-prefix.js");
+ dumpToFile($prefix, $prefixFile);
}
sub runTestsOnce($)
{
my ($useShark) = @_;
- my $shellArgs = "-f tmp/sunspider-test-prefix.js -f resources/sunspider-standalone-driver.js 2> /dev/null";
+ my $shellArgs = "-f $prefixFile -f resources/sunspider-standalone-driver.js 2> /dev/null";
my $output;
if ($useShark) {
$output = `shark -i -1 -q "$jsShellPath" $shellArgs`;
print STDERR "Found " . scalar(@tests) . " tests\n";
}
die "No tests to run" unless scalar(@tests);
-print STDERR "Running SunSpider once for warmup, then $testRuns time" . ($testRuns == 1 ? "" : "s") . ($runShark ? " under Shark" : "") . "\n";
+print STDERR "Running SunSpider once for warmup, then " . ($runShark ? "under Shark" : "$testRuns time" . ($testRuns == 1 ? "" : "s")) . "\n";
writePrefixFile();
runTestsOnce(0);
print "]\n";
my $output = "var output = [\n" . join(",\n", @results) . "\n];\n";
-dumpToFile($output, "tmp/sunspider-results.js");
+dumpToFile($output, $resultsFile);
-system("$jsShellPath", "-f", "tmp/sunspider-test-prefix.js", "-f", "tmp/sunspider-results.js", "-f", "resources/sunspider-analyze-results.js");
+system("$jsShellPath", "-f", $prefixFile, "-f", $resultsFile, "-f", "resources/sunspider-analyze-results.js");
if ($runShark) {
my $newestAge = 0;
}
}
closedir DIR;
- exec "/usr/bin/open", $newestMShark if $newestMShark;
+ if ($newestMShark) {
+ my $profileFile = "tmp/sunspider-profile-$timeString.mshark";
+ rename $newestMShark, $profileFile or die;
+ exec "/usr/bin/open", $profileFile;
+ }
}
#!/usr/bin/perl -w
-# Copyright (C) 2007 Apple Inc. All rights reserved.
+# Copyright (C) 2007 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
my ($filename) = @_;
open FILE, "<", $filename or die;
my $foundStart = 0;
+ my $foundOutput = 0;
my $foundEnd = 0;
my $result = "";
while (<FILE>) {
if (!$foundStart) {
- if (/^[[][{]$/) {
- $foundStart = 1;
- $result .= $_;
- }
- } else {
- if (/^[}][]]$/) {
- $foundEnd = 1;
- chomp;
- $result .= $_;
- last;
- } else {
- $result .= $_;
- }
- }
+ if (/^\[\{$/) {
+ $foundStart = 1;
+ $result .= $_;
+ } elsif (/^var \w+ = \[$/) {
+ $foundOutput = 1;
+ } elsif ($foundOutput && /^\{$/) {
+ $foundOutput = 0;
+ $foundStart = 1;
+ $result = "[{\n";
+ }
+ } else {
+ if (/\];?$/) {
+ $foundEnd = 1;
+ chomp;
+ s/;$//;
+ $result .= $_;
+ last;
+ } else {
+ $result .= $_;
+ }
+ }
}
close FILE;
dumpToFile($output, "tmp/sunspider-comparison-data.js");
-system("$jsShellPath", "-f", "tmp/sunspider-test-prefix.js", "-f", "tmp/sunspider-comparison-data.js", "-f", "resources/sunspider-compare-results.js");
+system($jsShellPath, "-f", "tmp/sunspider-test-prefix.js", "-f", "tmp/sunspider-comparison-data.js", "-f", "resources/sunspider-compare-results.js");