Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(951)

Unified Diff: build/android/pylib/device/adb_wrapper.py

Issue 724413003: Migrate device_utils.RestartServer to adb_wrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased against master Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/pylib/device/device_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/device/adb_wrapper.py
diff --git a/build/android/pylib/device/adb_wrapper.py b/build/android/pylib/device/adb_wrapper.py
index 4006a21d5540611c5e23aa72f2b838293b5efadc..7d761f16a53f1fecfd07badef849ef364853cf12 100644
--- a/build/android/pylib/device/adb_wrapper.py
+++ b/build/android/pylib/device/adb_wrapper.py
@@ -56,8 +56,12 @@ class AdbWrapper(object):
# pylint: disable=unused-argument
@classmethod
- def _BuildAdbCmd(cls, args, device_serial):
- cmd = [constants.GetAdbPath()]
+ def _BuildAdbCmd(cls, args, device_serial, cpu_affinity=None):
+ if cpu_affinity is not None:
+ cmd = ['taskset', '-c', str(cpu_affinity)]
+ else:
+ cmd = []
+ cmd.append(constants.GetAdbPath())
if device_serial is not None:
cmd.extend(['-s', device_serial])
cmd.extend(args)
@@ -68,9 +72,9 @@ class AdbWrapper(object):
@classmethod
@decorators.WithTimeoutAndRetries
def _RunAdbCmd(cls, args, timeout=None, retries=None, device_serial=None,
- check_error=True):
+ check_error=True, cpu_affinity=None):
status, output = cmd_helper.GetCmdStatusAndOutputWithTimeout(
- cls._BuildAdbCmd(args, device_serial),
+ cls._BuildAdbCmd(args, device_serial, cpu_affinity=cpu_affinity),
timeout_retry.CurrentTimeoutThread().GetRemainingTime())
if status != 0:
raise device_errors.AdbCommandFailedError(
@@ -135,6 +139,16 @@ class AdbWrapper(object):
def __repr__(self):
return '%s(\'%s\')' % (self.__class__.__name__, self)
+ @classmethod
+ def KillServer(cls, timeout=_DEFAULT_TIMEOUT, retries=_DEFAULT_RETRIES):
+ cls._RunAdbCmd(['kill-server'], timeout=timeout, retries=retries)
+
+ @classmethod
+ def StartServer(cls, timeout=_DEFAULT_TIMEOUT, retries=_DEFAULT_RETRIES):
+ # CPU affinity is used to reduce adb instability http://crbug.com/268450
+ cls._RunAdbCmd(['start-server'], timeout=timeout, retries=retries,
+ cpu_affinity=0)
+
# TODO(craigdh): Determine the filter criteria that should be supported.
@classmethod
def GetDevices(cls, timeout=_DEFAULT_TIMEOUT, retries=_DEFAULT_RETRIES):
« no previous file with comments | « no previous file | build/android/pylib/device/device_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698