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

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 clock time measurements (cpu is stable and better). 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..4e49eb0dc4f09bc6b239889f274264ec655286f4 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'
nduca 2014/02/20 05:35:05 eric how about pulling out the poll_cpu patch from
+# 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 = ("disabled-by-default-benchmark.poll_cpu,"
+ "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,8 +289,29 @@ class ResultsForThread(object):
class ThreadTimesTimelineMetric(TimelineMetric):
def __init__(self):
super(ThreadTimesTimelineMetric, self).__init__(TRACING_MODE)
- self.results_to_report = AllThreads
- self.details_to_report = NoThreads
+ # 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
+
+ @property
+ def results_to_report(self):
+ return self._results_to_report
+
+ @results_to_report.setter
+ def results_to_report(self, results_to_report):
+ self._results_to_report = results_to_report
+
+ @property
+ def details_to_report(self):
+ return self._details_to_report
+
+ @details_to_report.setter
+ def details_to_report(self, details_to_report):
+ self._details_to_report = details_to_report
+ # We need the other traces in order to have any details to report.
+ if not details_to_report == NoThreads:
+ self.trace_categories = DEFAULT_TRACE_CATEGORIES
def CountSlices(self, slices, substring):
count = 0
@@ -322,9 +351,9 @@ class ThreadTimesTimelineMetric(TimelineMetric):
# Report the desired results and details.
for thread_results in thread_category_results.values():
- if thread_results.name in self.results_to_report:
+ if thread_results.name in self._results_to_report:
thread_results.AddResults(num_frames, results)
# TOOD(nduca): When generic results objects are done, this special case
# can be replaced with a generic UI feature.
- if thread_results.name in self.details_to_report:
+ if thread_results.name in self._details_to_report:
thread_results.AddDetailedResults(num_frames, results)
« 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