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

Unified Diff: tools/telemetry/telemetry/core/platform/android_platform_backend.py

Issue 25002005: Telemetry / Android: do not crash on GetCpuStats() if the process is gone. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unittests! Created 7 years, 2 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 | tools/telemetry/telemetry/core/platform/android_platform_backend_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/platform/android_platform_backend.py
diff --git a/tools/telemetry/telemetry/core/platform/android_platform_backend.py b/tools/telemetry/telemetry/core/platform/android_platform_backend.py
index 9097dadd9e017024876399b86156098677fa7313..69ddfde8ee8c14eb27b078806a7dd2cf08ebb767 100644
--- a/tools/telemetry/telemetry/core/platform/android_platform_backend.py
+++ b/tools/telemetry/telemetry/core/platform/android_platform_backend.py
@@ -86,8 +86,11 @@ class AndroidPlatformBackend(platform_backend.PlatformBackend):
logging.warning('CPU stats cannot be retrieved on non-rooted device.')
return {}
stats = self._adb.GetProtectedFileContents('/proc/%s/stat' % pid,
- log_result=False)[0].split()
- return proc_util.GetCpuStats(stats)
+ log_result=False)
+ if not stats:
+ logging.warning('Unable to get /proc/%s/stat, process gone?', pid)
+ return {}
+ return proc_util.GetCpuStats(stats[0].split())
def GetCpuTimestamp(self):
if not self._adb.CanAccessProtectedFileContents():
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/platform/android_platform_backend_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698