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

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

Issue 1254843002: telemetry: Fix killing the perf profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments. Created 5 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 | build/android/pylib/device/device_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/device/device_utils.py
diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py
index 3373fd02cef39a67fb14eebc11682b23e03cd87f..5c0ba36c323b3e8b1710cd4a0219895fa68f7d3f 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -736,7 +736,7 @@ class DeviceUtils(object):
CommandTimeoutError on timeout.
DeviceUnreachableError on missing device.
"""
- pids = self.GetPids(process_name)
+ pids = list(itertools.chain(*self.GetPids(process_name).values()))
if not pids:
if quiet:
return 0
@@ -744,7 +744,7 @@ class DeviceUtils(object):
raise device_errors.CommandFailedError(
'No process "%s"' % process_name, str(self))
- cmd = ['kill', '-%d' % signum] + pids.values()
+ cmd = ['kill', '-%d' % signum] + pids
self.RunShellCommand(cmd, as_root=as_root, check_return=True)
if blocking:
@@ -1584,14 +1584,14 @@ class DeviceUtils(object):
retries: number of retries
Returns:
- A dict mapping process name to PID for each process that contained the
- provided |process_name|.
+ A dict mapping process name to a list of PIDs for each process that
+ contained the provided |process_name|.
Raises:
CommandTimeoutError on timeout.
DeviceUnreachableError on missing device.
"""
- procs_pids = {}
+ procs_pids = collections.defaultdict(list)
try:
ps_output = self._RunPipedShellCommand(
'ps | grep -F %s' % cmd_helper.SingleQuote(process_name))
@@ -1607,7 +1607,8 @@ class DeviceUtils(object):
try:
ps_data = line.split()
if process_name in ps_data[-1]:
- procs_pids[ps_data[-1]] = ps_data[1]
+ pid, process = ps_data[1], ps_data[-1]
+ procs_pids[process].append(pid)
except IndexError:
pass
return procs_pids
« no previous file with comments | « no previous file | build/android/pylib/device/device_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698