Index: tools/perf/measurements/smoothness.py |
diff --git a/tools/perf/measurements/smoothness.py b/tools/perf/measurements/smoothness.py |
index a26ba682913a7d981a11cc3b295fab93a717b7db..88b1f10baf62b8c53dc1621187ad7baf23789a85 100644 |
--- a/tools/perf/measurements/smoothness.py |
+++ b/tools/perf/measurements/smoothness.py |
@@ -43,9 +43,11 @@ class Smoothness(page_measurement.PageMeasurement): |
return hasattr(page, 'smoothness') |
def WillRunAction(self, page, tab, action): |
- # TODO(ernstm): remove 'webkit' category when |
- # https://codereview.chromium.org/23848006/ has landed. |
- tab.browser.StartTracing('webkit,webkit.console,benchmark', 60) |
+ # We don't need to start tracing, if a trace profiler is already running. |
+ # Note that all trace event categories are enabled in this case, which |
+ # increases the risk of a trace buffer overflow. |
+ if self.options.profiler != 'trace': |
+ tab.browser.StartTracing('webkit.console,benchmark', 60) |
if tab.browser.platform.IsRawDisplayFrameRateSupported(): |
tab.browser.platform.StartRawDisplayFrameRateMeasurement() |
self._metrics = smoothness.SmoothnessMetrics(tab) |
@@ -59,6 +61,8 @@ class Smoothness(page_measurement.PageMeasurement): |
tab.browser.platform.StopRawDisplayFrameRateMeasurement() |
if not action.CanBeBound(): |
self._metrics.Stop() |
+ # Always stop tracing at this point. If a trace profiler is running, it will |
+ # be stopped here. |
tab.browser.StopTracing() |
def FindTimelineMarker(self, timeline): |
@@ -80,7 +84,12 @@ class Smoothness(page_measurement.PageMeasurement): |
smoothness.CalcFirstPaintTimeResults(results, tab) |
- timeline = tab.browser.GetTraceResultAndReset().AsTimelineModel() |
+ # Fetch the results without resetting, if a trace profiler is running. The |
+ # profiler needs to read the results later on. |
+ if self.options.profiler == 'trace': |
+ timeline = tab.browser.GetTraceResult().AsTimelineModel() |
+ else: |
+ timeline = tab.browser.GetTraceResultAndReset().AsTimelineModel() |
timeline_marker = self.FindTimelineMarker(timeline) |
benchmark_stats = GpuRenderingStats(timeline_marker, |
rendering_stats_deltas, |