Title: [290298] trunk/Tools
Revision
290298
Author
[email protected]
Date
2022-02-22 02:25:37 -0800 (Tue, 22 Feb 2022)

Log Message

[JSC] Guard against dead remotes in numberOfProcessors
https://bugs.webkit.org/show_bug.cgi?id=236643

Reviewed by Adrian Perez de Castro.

Instead of using only the first remote (and then defaulting to 1 when
it happens to not respond), try all the remotes in sequence.

Also, instead of trying the sysctl version on all hosts first and
only try nproc after sysctl has failed on all hosts, combine
sysctl and nproc in one command to speed things along.

This change also removes the numProcessors == 0 typo in the rescue
path.

* Scripts/run-jsc-stress-tests:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (290297 => 290298)


--- trunk/Tools/ChangeLog	2022-02-22 10:14:20 UTC (rev 290297)
+++ trunk/Tools/ChangeLog	2022-02-22 10:25:37 UTC (rev 290298)
@@ -1,3 +1,22 @@
+2022-02-22  Angelos Oikonomopoulos  <[email protected]>
+
+        [JSC] Guard against dead remotes in numberOfProcessors
+        https://bugs.webkit.org/show_bug.cgi?id=236643
+
+        Reviewed by Adrian Perez de Castro.
+
+        Instead of using only the first remote (and then defaulting to 1 when
+        it happens to not respond), try all the remotes in sequence.
+
+        Also, instead of trying the sysctl version on all hosts first and
+        only try nproc after sysctl has failed on all hosts, combine
+        sysctl and nproc in one command to speed things along.
+
+        This change also removes the numProcessors == 0 typo in the rescue
+        path.
+
+        * Scripts/run-jsc-stress-tests:
+
 2022-02-22  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Can't run performance tests due to a11y errors

Modified: trunk/Tools/Scripts/run-jsc-stress-tests (290297 => 290298)


--- trunk/Tools/Scripts/run-jsc-stress-tests	2022-02-22 10:14:20 UTC (rev 290297)
+++ trunk/Tools/Scripts/run-jsc-stress-tests	2022-02-22 10:25:37 UTC (rev 290298)
@@ -2563,10 +2563,18 @@
 
 def runCommandOnTester(cmd)
     if $remote
-        result = sshRead(cmd, $remoteHosts[0])
-    else
-        result = `#{cmd}`
+        $remoteHosts.each { |remoteHost|
+            begin
+                # Return first successful value. Obviously, this
+                # assumes the remotes are homogeneous.
+                return sshRead(cmd, remoteHost)
+            rescue Exception => e
+                $stderr.puts("Error running `#{cmd}` on #{remoteHost.host}: #{e}")
+            end
+        }
+        return "0"
     end
+    `#{cmd}`
 end
 
 def numberOfProcessors
@@ -2574,21 +2582,14 @@
         numProcessors = runCommandOnTester("cmd /c echo %NUMBER_OF_PROCESSORS%").to_i
     else
         begin
-            numProcessors = runCommandOnTester("sysctl -n hw.activecpu 2>/dev/null").to_i
+            numProcessors = runCommandOnTester("sysctl -n hw.activecpu 2>/dev/null || nproc --all 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
     end
 
     if numProcessors == 0
+        $stderr.puts("Warning: could not determine the number of remote CPUs, defaulting to 1")
         numProcessors = 1
     end
     return numProcessors
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to