Index: build/android/bb_run_sharded_steps.py |
diff --git a/build/android/bb_run_sharded_steps.py b/build/android/bb_run_sharded_steps.py |
index 9b768a9f7e6214934b46483b365583efadef4101..9b369570687b7b69baf5be133da2c901a6f2f969 100755 |
--- a/build/android/bb_run_sharded_steps.py |
+++ b/build/android/bb_run_sharded_steps.py |
@@ -54,6 +54,7 @@ import os |
import signal |
import shutil |
import sys |
+import time |
from pylib import android_commands |
from pylib import cmd_helper |
@@ -174,6 +175,16 @@ def _KillPendingServers(): |
os.kill(int(pid), signal.SIGQUIT) |
except Exception as e: |
logging.warning('Failed killing %s %s %s', server, pid, e) |
+ # Restart the adb server with taskset to set a single CPU affinity. |
+ cmd_helper.RunCmd(['adb', 'kill-server']) |
+ cmd_helper.RunCmd(['taskset', '-c', '0', 'adb', 'start-server']) |
+ cmd_helper.RunCmd(['taskset', '-c', '0', 'adb', 'root']) |
+ i = 1 |
+ while not android_commands.GetAttachedDevices(): |
+ time.sleep(i) |
+ i *= 2 |
+ if i > 10: |
+ break |
def main(argv): |