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

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

Issue 414663002: Revert 284832 because it broke Android Tests with the following error: (Closed) Base URL: svn://svn.chromium.org/chrome/
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: trunk/src/tools/telemetry/telemetry/core/backends/chrome/android_browser_finder.py
===================================================================
--- trunk/src/tools/telemetry/telemetry/core/backends/chrome/android_browser_finder.py (revision 284847)
+++ trunk/src/tools/telemetry/telemetry/core/backends/chrome/android_browser_finder.py (working copy)
@@ -19,12 +19,7 @@
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 = {
'android-content-shell':
['org.chromium.content_shell_apk',
@@ -212,18 +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:
- if hasattr(proc, 'cpu_affinity'):
- proc.cpu_affinity([0]) # New versions of psutil.
- else:
- proc.set_cpu_affinity([0]) # Older versions.
- 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