OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
| 5 from telemetry.value import improvement_direction |
5 from telemetry.value import list_of_scalar_values | 6 from telemetry.value import list_of_scalar_values |
6 from telemetry.web_perf.metrics import timeline_based_metric | 7 from telemetry.web_perf.metrics import timeline_based_metric |
7 | 8 |
8 | 9 |
9 class _SingleEventMetric(timeline_based_metric.TimelineBasedMetric): | 10 class _SingleEventMetric(timeline_based_metric.TimelineBasedMetric): |
10 """Reports directly durations of specific trace events that start during the | 11 """Reports directly durations of specific trace events that start during the |
11 user interaction. | 12 user interaction. |
12 """ | 13 """ |
13 | 14 |
14 def __init__(self, trace_event_name, metric_name, metric_description=None): | 15 def __init__(self, trace_event_name, metric_name, metric_description=None): |
(...skipping 17 matching lines...) Expand all Loading... |
32 events_found.append(event.thread_duration) | 33 events_found.append(event.thread_duration) |
33 else: | 34 else: |
34 events_found.append(event.duration) | 35 events_found.append(event.duration) |
35 if not events_found: | 36 if not events_found: |
36 return | 37 return |
37 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 38 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
38 page=results.current_page, | 39 page=results.current_page, |
39 name=self._metric_name, | 40 name=self._metric_name, |
40 units='ms', | 41 units='ms', |
41 values=events_found, | 42 values=events_found, |
42 description=self._metric_description)) | 43 description=self._metric_description, |
| 44 improvement_direction=improvement_direction.DOWN)) |
OLD | NEW |