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

Unified Diff: tools/perf/metrics/timeline.py

Issue 171013006: Telemetry: Use mimimum tracing for timeline benchmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove @property. Created 6 years, 10 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 | « tools/perf/measurements/thread_times_unittest.py ('k') | tools/perf/metrics/timeline_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/timeline.py
diff --git a/tools/perf/metrics/timeline.py b/tools/perf/metrics/timeline.py
index 3442cab15b01b00604f22a2541f4df74825a0c7f..333c5bd8ec9b76ae0869f5789fa5bae7c436dcfd 100644
--- a/tools/perf/metrics/timeline.py
+++ b/tools/perf/metrics/timeline.py
@@ -11,6 +11,16 @@ from telemetry.page import page_measurement
TRACING_MODE = 'tracing-mode'
TIMELINE_MODE = 'timeline-mode'
+# All tracing categories not disabled-by-default
+DEFAULT_TRACE_CATEGORIES = None
+
+# Categories for absolute minimum overhead tracing. This contains no
+# sub-traces of thread tasks, so it's only useful for capturing the
+# cpu-time spent on threads (as well as needed benchmark traces)
+MINIMAL_TRACE_CATEGORIES = ("toplevel,"
+ "benchmark,"
+ "webkit.console,"
+ "trace_event_overhead")
class MissingFramesError(page_measurement.MeasurementFailure):
def __init__(self):
@@ -24,6 +34,7 @@ class TimelineMetric(Metric):
"""
super(TimelineMetric, self).__init__()
assert mode in (TRACING_MODE, TIMELINE_MODE)
+ self.trace_categories = DEFAULT_TRACE_CATEGORIES
self._mode = mode
self._model = None
self._renderer_process = None
@@ -39,7 +50,7 @@ class TimelineMetric(Metric):
if self._mode == TRACING_MODE:
if not tab.browser.supports_tracing:
raise Exception('Not supported')
- tab.browser.StartTracing()
+ tab.browser.StartTracing(self.trace_categories)
else:
assert self._mode == TIMELINE_MODE
tab.StartTimelineRecording()
@@ -204,7 +215,8 @@ def ThreadCpuTimeResultName(thread_category):
return "thread_" + thread_category + "_cpu_time_per_frame"
def ThreadDetailResultName(thread_category, detail):
- return "thread_" + thread_category + "|" + detail
+ detail_sanitized = detail.replace('.','_')
+ return "thread_" + thread_category + "|" + detail_sanitized
class ResultsForThread(object):
@@ -252,12 +264,8 @@ class ResultsForThread(object):
self.toplevel_slices.extend(self.SlicesInActions(thread.toplevel_slices))
def AddResults(self, num_frames, results):
- clock_report_name = ThreadTimeResultName(self.name)
- cpu_report_name = ThreadCpuTimeResultName(self.name)
- clock_per_frame = (float(self.clock_time) / num_frames) if num_frames else 0
- cpu_per_frame = (float(self.cpu_time) / num_frames) if num_frames else 0
- results.Add(clock_report_name, 'ms', clock_per_frame)
- results.Add(cpu_report_name, 'ms', cpu_per_frame)
+ cpu_per_frame = (float(self.cpu_time) / num_frames) if num_frames else 0
+ results.Add(ThreadCpuTimeResultName(self.name), 'ms', cpu_per_frame)
def AddDetailedResults(self, num_frames, results):
slices_by_category = collections.defaultdict(list)
@@ -281,9 +289,17 @@ class ResultsForThread(object):
class ThreadTimesTimelineMetric(TimelineMetric):
def __init__(self):
super(ThreadTimesTimelineMetric, self).__init__(TRACING_MODE)
+ # Minimal traces, for minimum noise in CPU-time measurements.
+ self.trace_categories = MINIMAL_TRACE_CATEGORIES
self.results_to_report = AllThreads
self.details_to_report = NoThreads
+ def Start(self, page, tab):
+ # We need the other traces in order to have any details to report.
+ if not self.details_to_report == NoThreads:
+ self.trace_categories = DEFAULT_TRACE_CATEGORIES
+ super(ThreadTimesTimelineMetric, self).Start(page, tab)
+
def CountSlices(self, slices, substring):
count = 0
for event in slices:
« no previous file with comments | « tools/perf/measurements/thread_times_unittest.py ('k') | tools/perf/metrics/timeline_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698