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 39fe706b0bc734262f5b82cf55cfe881660d14d7..094836a679d80c37acbcd09d5d30f1f744a7bd55 100644 |
--- a/build/android/pylib/device/adb_wrapper.py |
+++ b/build/android/pylib/device/adb_wrapper.py |
@@ -58,8 +58,12 @@ class AdbWrapper(object): |
@classmethod |
@decorators.WithTimeoutAndRetries |
def _RunAdbCmd(cls, args, timeout=None, retries=None, device_serial=None, |
- check_error=True): |
- cmd = [constants.GetAdbPath()] |
+ check_error=True, cpu_affinity=None): |
jbudorick
2014/12/11 01:43:13
Probably doesn't surprise you to hear that I'm not
perezju
2014/12/11 11:38:00
Yeah, I don't like this too much either. But could
jbudorick
2014/12/11 16:27:17
Agreed.
|
+ if cpu_affinity is not None: |
+ cmd = ['taskset', '-c', str(cpu_affinity)] |
jbudorick
2014/12/11 01:43:13
How is this going to interact with _BuildAdbCmd in
perezju
2014/12/11 11:38:00
I think cpu_affinity (or something like that) woul
|
+ else: |
+ cmd = [] |
+ cmd.append(constants.GetAdbPath()) |
if device_serial is not None: |
cmd.extend(['-s', device_serial]) |
cmd.extend(args) |
@@ -115,6 +119,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): |