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

Unified Diff: tools/telemetry/telemetry/core/chrome/linux_platform_backend.py

Issue 12703026: [Telemetry] Don't include zombie processes in child process list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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/chrome/linux_platform_backend.py
diff --git a/tools/telemetry/telemetry/core/chrome/linux_platform_backend.py b/tools/telemetry/telemetry/core/chrome/linux_platform_backend.py
index 4a34eb494f778e12229859105c4c6581cd47c664..3d36a6b49af1c8cdb7646b807bbcb297f82bfdb3 100644
--- a/tools/telemetry/telemetry/core/chrome/linux_platform_backend.py
+++ b/tools/telemetry/telemetry/core/chrome/linux_platform_backend.py
@@ -64,10 +64,13 @@ class LinuxPlatformBackend(platform_backend.PlatformBackend):
def GetChildPids(self, pid):
"""Retunds a list of child pids of |pid|."""
child_pids = []
- pid_ppid_list = subprocess.Popen(['ps', '-e', '-o', 'pid=', '-o', 'ppid='],
- stdout=subprocess.PIPE).communicate()[0]
- for pid_ppid in pid_ppid_list.splitlines():
- curr_pid, curr_ppid = pid_ppid.split()
+ pid_ppid_state_list = subprocess.Popen(
+ ['ps', '-e', '-o', 'pid,ppid,state'],
+ stdout=subprocess.PIPE).communicate()[0]
+ for pid_ppid_state in pid_ppid_state_list.splitlines()[1:]: # Skip header
+ curr_pid, curr_ppid, state = pid_ppid_state.split()
+ if 'Z' in state:
+ continue # Ignore zombie processes
if int(curr_ppid) == pid:
child_pids.append(int(curr_pid))
child_pids.extend(self.GetChildPids(int(curr_pid)))
« 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