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

Unified Diff: tools/telemetry/telemetry/core/backends/chrome/android_browser_finder.py

Issue 407633002: Revert of [Telemetry] Fix a flake in android browser finder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/backends/chrome/android_browser_finder.py
diff --git a/tools/telemetry/telemetry/core/backends/chrome/android_browser_finder.py b/tools/telemetry/telemetry/core/backends/chrome/android_browser_finder.py
index ec76125286d74096a6c632265c191604c361855f..f0a5ae53e4fac7ee0ed366b63671f7474d5ecd84 100644
--- a/tools/telemetry/telemetry/core/backends/chrome/android_browser_finder.py
+++ b/tools/telemetry/telemetry/core/backends/chrome/android_browser_finder.py
@@ -18,11 +18,6 @@
from telemetry.core.backends import adb_commands
from telemetry.core.backends.chrome import android_browser_backend
from telemetry.core.platform import android_platform_backend
-
-try:
- import psutil # pylint: disable=F0401
-except ImportError:
- psutil = None
CHROME_PACKAGE_NAMES = {
@@ -212,15 +207,19 @@
# Ignore result.
adb.EnableAdbRoot()
- if psutil:
- # Host side workaround for crbug.com/268450 (adb instability).
+ if sys.platform.startswith('linux'):
+ # Host side workaround for crbug.com/268450 (adb instability)
# The adb server has a race which is mitigated by binding to a single core.
- for proc in psutil.process_iter():
- try:
- if 'adb' in proc.name:
- proc.set_cpu_affinity([0])
- except (psutil.NoSuchProcess, psutil.AccessDenied):
- logging.warn('Failed to set adb process CPU affinity')
+ import psutil # pylint: disable=F0401
+ pids = [p.pid for p in psutil.process_iter() if 'adb' in p.name]
+ with open(os.devnull, 'w') as devnull:
+ for pid in pids:
+ ret = subprocess.call(['taskset', '-p', '-c', '0', str(pid)],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ stdin=devnull)
+ if ret:
+ logging.warn('Failed to taskset %d (%s)', pid, ret)
if not os.environ.get('BUILDBOT_BUILDERNAME'):
# Killing adbd before running tests has proven to make them less likely to
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698