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

Unified Diff: tools/telemetry/telemetry/core/platform/profiler/__init__.py

Issue 297753007: Telemetry: Profilers ignore disappearing processes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/platform/profiler/__init__.py
diff --git a/tools/telemetry/telemetry/core/platform/profiler/__init__.py b/tools/telemetry/telemetry/core/platform/profiler/__init__.py
index 58febc9182e4b62d44bb6cfed54d5c620d13001a..806229e907efcf5167414529a0a951cd9a5b9cc7 100644
--- a/tools/telemetry/telemetry/core/platform/profiler/__init__.py
+++ b/tools/telemetry/telemetry/core/platform/profiler/__init__.py
@@ -4,6 +4,8 @@
import collections
+from telemetry.core import exceptions
+
class Profiler(object):
"""A sampling profiler provided by the platform.
@@ -49,12 +51,16 @@ class Profiler(object):
process_name_counts = collections.defaultdict(int)
process_output_file_map = {}
for pid in all_pids:
- cmd_line = self._platform_backend.GetCommandLine(pid)
- process_name = self._browser_backend.GetProcessName(cmd_line)
- output_file = '%s.%s%s' % (self._output_path, process_name,
- process_name_counts[process_name])
- process_name_counts[process_name] += 1
- process_output_file_map[pid] = output_file
+ try:
+ cmd_line = self._platform_backend.GetCommandLine(pid)
+ process_name = self._browser_backend.GetProcessName(cmd_line)
+ output_file = '%s.%s%s' % (self._output_path, process_name,
+ process_name_counts[process_name])
+ process_name_counts[process_name] += 1
+ process_output_file_map[pid] = output_file
+ except exceptions.ProcessGoneException:
+ # Ignore processes that disappeared since calling GetChildPids().
+ continue
return process_output_file_map
def CollectProfile(self):
« 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