Chromium Code Reviews| Index: telemetry/telemetry/web_perf/timeline_based_measurement.py |
| diff --git a/telemetry/telemetry/web_perf/timeline_based_measurement.py b/telemetry/telemetry/web_perf/timeline_based_measurement.py |
| index c86e98464873b1bdf7b65ae1b4fd97043c8349b2..5b5cc0ba29abab3dae143f931d6ddca48b8214f6 100644 |
| --- a/telemetry/telemetry/web_perf/timeline_based_measurement.py |
| +++ b/telemetry/telemetry/web_perf/timeline_based_measurement.py |
| @@ -10,7 +10,6 @@ from tracing.metrics import metric_runner |
| from telemetry.timeline import chrome_trace_category_filter |
| from telemetry.timeline import model as model_module |
| from telemetry.timeline import tracing_config |
| -from telemetry.timeline import trace_data as trace_data_module |
| from telemetry.value import trace |
| from telemetry.value import common_value_helpers |
| from telemetry.web_perf.metrics import timeline_based_metric |
| @@ -292,29 +291,24 @@ class TimelineBasedMeasurement(story_test.StoryTest): |
| trace_value = trace.TraceValue(results.current_page, trace_result) |
| results.AddValue(trace_value) |
| - if self._tbm_options.GetTimelineBasedMetrics(): |
| - self._ComputeTimelineBasedMetrics(results, trace_value) |
| - # Legacy metrics can be computed, but only if explicitly specified. |
| - if self._tbm_options.GetLegacyTimelineBasedMetrics(): |
| - # Since this imports the trace model in python, it will also clean up |
| - # the trace handles for us. |
| - self._ComputeLegacyTimelineBasedMetrics(results, trace_result) |
| + try: |
| + if self._tbm_options.GetTimelineBasedMetrics(): |
| + self._ComputeTimelineBasedMetrics(results, trace_value) |
| + # Legacy metrics can be computed, but only if explicitly specified. |
| + if self._tbm_options.GetLegacyTimelineBasedMetrics(): |
| + self._ComputeLegacyTimelineBasedMetrics(results, trace_result) |
| else: |
| - # Clean up the trace handles ourselves if we did not use the python |
| - # trace importer. |
| - for data in trace_result.GetTracesFor( |
| - trace_data_module.CHROME_TRACE_PART): |
| - if isinstance(data, trace_data_module.TraceFileHandle): |
| - data.Clean() |
| - else: |
| - # Run all TBMv1 metrics if no other metric is specified (legacy behavior) |
| - if not self._tbm_options.GetLegacyTimelineBasedMetrics(): |
| - logging.warn('Please specify the TBMv1 metrics you are interested in ' |
| - 'explicitly. This implicit functionality will be removed ' |
| - 'on July 17, 2016.') |
| - self._tbm_options.SetLegacyTimelineBasedMetrics( |
| - _GetAllLegacyTimelineBasedMetrics()) |
| - self._ComputeLegacyTimelineBasedMetrics(results, trace_result) |
| + # Run all TBMv1 metrics if no other metric is specified |
| + # (legacy behavior) |
| + if not self._tbm_options.GetLegacyTimelineBasedMetrics(): |
| + logging.warn('Please specify the TBMv1 metrics you are interested in ' |
| + 'explicitly. This implicit functionality will be removed' |
| + ' on July 17, 2016.') |
|
perezju
2017/02/02 09:25:56
Date in the past. Maybe kill this functionality on
nednguyen
2017/02/02 14:00:22
Hmhh, I will ping Ethan on this.
|
| + self._tbm_options.SetLegacyTimelineBasedMetrics( |
| + _GetAllLegacyTimelineBasedMetrics()) |
| + self._ComputeLegacyTimelineBasedMetrics(results, trace_result) |
| + finally: |
| + trace_result.CleanUpAllTraces() |
| def DidRunStory(self, platform): |
| """Clean up after running the story.""" |