Title: [179931] trunk/Tools
Revision
179931
Author
[email protected]
Date
2015-02-11 09:11:22 -0800 (Wed, 11 Feb 2015)

Log Message

run-jsc-stress tests should detect the number of processors on the remote machine too
https://bugs.webkit.org/show_bug.cgi?id=141196

Reviewed by Darin Adler.

* Scripts/run-_javascript_core-tests:
(runJSCStressTests): Pass through the --child-processes argument.
* Scripts/run-jsc-stress-tests: Added determineNumberOfProcessors function
to detect the number of local and remote processors with the same algorithm.
Additionally introduced $numChildProcesses to emphasize it isn't necessarily
same as $numProcessors.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (179930 => 179931)


--- trunk/Tools/ChangeLog	2015-02-11 17:10:01 UTC (rev 179930)
+++ trunk/Tools/ChangeLog	2015-02-11 17:11:22 UTC (rev 179931)
@@ -1,5 +1,19 @@
 2015-02-11  Csaba Osztrogonác  <[email protected]>
 
+        run-jsc-stress tests should detect the number of processors on the remote machine too
+        https://bugs.webkit.org/show_bug.cgi?id=141196
+
+        Reviewed by Darin Adler.
+
+        * Scripts/run-_javascript_core-tests:
+        (runJSCStressTests): Pass through the --child-processes argument.
+        * Scripts/run-jsc-stress-tests: Added determineNumberOfProcessors function
+        to detect the number of local and remote processors with the same algorithm.
+        Additionally introduced $numChildProcesses to emphasize it isn't necessarily
+        same as $numProcessors.
+
+2015-02-11  Csaba Osztrogonác  <[email protected]>
+
         run-jsc-stress-tests should pass JSC_timeout to remote hosts
         https://bugs.webkit.org/show_bug.cgi?id=141164
 

Modified: trunk/Tools/Scripts/run-_javascript_core-tests (179930 => 179931)


--- trunk/Tools/Scripts/run-_javascript_core-tests	2015-02-11 17:10:01 UTC (rev 179930)
+++ trunk/Tools/Scripts/run-_javascript_core-tests	2015-02-11 17:11:22 UTC (rev 179931)
@@ -47,6 +47,7 @@
 my $showHelp;
 my $extraTests;
 my $jsDriverArgs;
+my $childProcesses;
 
 my $buildJSC = 1;
 
@@ -80,6 +81,7 @@
   --tarball                     Create a tarball of the bundle produced by running the JSC stress tests.
   --remote=                     Run the JSC stress tests on the specified remote host. Implies --tarball.
   --extra-tests=                Path to a file containing extra tests
+  --child-processes=            Specify the number of child processes.
 
 EOF
 
@@ -93,6 +95,7 @@
     'jsc-stress!' => \$runJSCStress,
     'tarball!' => \$createTarball,
     'remote=s' => \$remoteHost,
+    'child-processes=s' => \$childProcesses,
     'help' => \$showHelp
 );
 
@@ -278,6 +281,11 @@
         push(@jscStressDriverCmd, $remoteHost);
     }
 
+    if ($childProcesses) {
+        push(@jscStressDriverCmd, "--child-processes");
+        push(@jscStressDriverCmd, $childProcesses);
+    }
+
     # End option processing, the rest of the arguments are tests
     push(@jscStressDriverCmd, "--");
 

Modified: trunk/Tools/Scripts/run-jsc-stress-tests (179930 => 179931)


--- trunk/Tools/Scripts/run-jsc-stress-tests	2015-02-11 17:10:01 UTC (rev 179930)
+++ trunk/Tools/Scripts/run-jsc-stress-tests	2015-02-11 17:11:22 UTC (rev 179931)
@@ -87,23 +87,7 @@
     }.join(' ')
 end
 
-begin
-    $numProcessors = `sysctl -n hw.activecpu 2>/dev/null`.to_i
-rescue
-    $numProcessors = 0
-end
 
-if $numProcessors == 0
-    $numProcessors = `nproc --all 2>/dev/null`.to_i
-end
-if $numProcessors == 0
-    $numProcessors = 1
-end
-
-if ENV["WEBKIT_TEST_CHILD_PROCESSES"]
-    $numProcessors = ENV["WEBKIT_TEST_CHILD_PROCESSES"].to_i
-end
-
 $jscPath = nil
 $doNotMessWithVMPath = false
 $enableFTL = false
@@ -199,7 +183,7 @@
         uri = URI("ssh://" + arg)
         $remoteUser, $remoteHost, $remotePort = uri.user, uri.host, uri.port
     when '--child-processes'
-        $numProcessors = arg.to_i
+        $numChildProcesses = arg.to_i
     when '--arch'
         $architecture = arg
     when '--os'
@@ -542,7 +526,7 @@
 def addRunCommand(kind, command, outputHandler, errorHandler)
     $didAddRunCommand = true
     plan = Plan.new($benchmarkDirectory, command, baseOutputName(kind), outputHandler, errorHandler)
-    if $numProcessors > 1 and $runCommandOptions[:isSlow]
+    if $numChildProcesses > 1 and $runCommandOptions[:isSlow]
         $runlist.unshift plan
     else
         $runlist << plan
@@ -1249,17 +1233,6 @@
     }
 end
 
-if $enableFTL and ENV["JSC_timeout"]
-    # Currently, using the FTL is a performance regression particularly in real
-    # (i.e. non-loopy) benchmarks. Account for this in the timeout.
-    ENV["JSC_timeout"] = (ENV["JSC_timeout"].to_i * 2).to_s
-end
-
-if ENV["JSC_timeout"]
-    # In the worst case, the processors just interfere with each other.
-    # Increase the timeout proportionally to the number of processors.
-    ENV["JSC_timeout"] = (ENV["JSC_timeout"].to_i.to_f * Math.sqrt($numProcessors)).to_i.to_s
-end
     
 puts
 
@@ -1298,6 +1271,35 @@
     result
 end
 
+def runCommandOnTester(cmd)
+    if $remote
+        result = sshRead(cmd)
+    else
+        result = `#{cmd}`
+    end
+end
+
+def numberOfProcessors
+    begin
+        numProcessors = runCommandOnTester("sysctl -n hw.activecpu 2>/dev/null").to_i
+    rescue
+        numProcessors = 0
+    end
+
+    if numProcessors == 0
+        begin
+            numProcessors = runCommandOnTester("nproc --all 2>/dev/null").to_i
+        rescue
+            numProcessors == 0
+        end
+    end
+
+    if numProcessors == 0
+        numProcessors = 1
+    end
+    return numProcessors
+end
+
 def runAndMonitorTestRunnerCommand(*cmd)
     numberOfTests = 0
     Dir.chdir($runnerDir) {
@@ -1389,7 +1391,7 @@
 def runMakeTestRunner
     raise if $remote
     Dir.chdir($runnerDir) {
-        runAndMonitorTestRunnerCommand("make", "-j", $numProcessors.to_s, "-s", "-f", "Makefile")
+        runAndMonitorTestRunnerCommand("make", "-j", $numChildProcesses.to_s, "-s", "-f", "Makefile")
     }
 end
 
@@ -1434,6 +1436,26 @@
 $outputDir = $outputDir.realpath
 $runnerDir = $outputDir + ".runner"
 
+if !$numChildProcesses
+    if ENV["WEBKIT_TEST_CHILD_PROCESSES"]
+        $numChildProcesses = ENV["WEBKIT_TEST_CHILD_PROCESSES"].to_i
+    else
+        $numChildProcesses = numberOfProcessors
+    end
+end
+
+if $enableFTL and ENV["JSC_timeout"]
+    # Currently, using the FTL is a performance regression particularly in real
+    # (i.e. non-loopy) benchmarks. Account for this in the timeout.
+    ENV["JSC_timeout"] = (ENV["JSC_timeout"].to_i * 2).to_s
+end
+
+if ENV["JSC_timeout"]
+    # In the worst case, the processors just interfere with each other.
+    # Increase the timeout proportionally to the number of processors.
+    ENV["JSC_timeout"] = (ENV["JSC_timeout"].to_i.to_f * Math.sqrt($numChildProcesses)).to_i.to_s
+end
+
 def runBundle
     raise unless $bundle
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to