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 import logging | 4 import logging |
5 | 5 |
| 6 from telemetry.value import improvement_direction |
6 from telemetry.value import scalar | 7 from telemetry.value import scalar |
7 from telemetry.web_perf import timeline_interaction_record as tir_module | 8 from telemetry.web_perf import timeline_interaction_record as tir_module |
8 from telemetry.web_perf.metrics import mainthread_jank_stats | 9 from telemetry.web_perf.metrics import mainthread_jank_stats |
9 from telemetry.web_perf.metrics import timeline_based_metric | 10 from telemetry.web_perf.metrics import timeline_based_metric |
10 | 11 |
11 | 12 |
12 class ResponsivenessMetric(timeline_based_metric.TimelineBasedMetric): | 13 class ResponsivenessMetric(timeline_based_metric.TimelineBasedMetric): |
13 """Computes metrics that measure respsonsiveness on the record ranges. | 14 """Computes metrics that measure respsonsiveness on the record ranges. |
14 | 15 |
15 total_big_jank_thread_time is the total thread duration of all top | 16 total_big_jank_thread_time is the total thread duration of all top |
(...skipping 21 matching lines...) Expand all Loading... |
37 except tir_module.NoThreadTimeDataException as e: | 38 except tir_module.NoThreadTimeDataException as e: |
38 #TODO(nednguyen): Report the warning with page_results system. | 39 #TODO(nednguyen): Report the warning with page_results system. |
39 logging.warning( | 40 logging.warning( |
40 'Main thread jank metrics cannot be computed for records %s since ' | 41 'Main thread jank metrics cannot be computed for records %s since ' |
41 'trace does not contain thread time data. %s', | 42 'trace does not contain thread time data. %s', |
42 repr(interaction_records), repr(e)) | 43 repr(interaction_records), repr(e)) |
43 return | 44 return |
44 | 45 |
45 results.AddValue(scalar.ScalarValue( | 46 results.AddValue(scalar.ScalarValue( |
46 results.current_page, 'responsive-total_big_jank_thread_time', 'ms', | 47 results.current_page, 'responsive-total_big_jank_thread_time', 'ms', |
47 jank_stats.total_big_jank_thread_time)) | 48 jank_stats.total_big_jank_thread_time, |
| 49 improvement_direction=improvement_direction.DOWN)) |
48 results.AddValue(scalar.ScalarValue( | 50 results.AddValue(scalar.ScalarValue( |
49 results.current_page, 'responsive-biggest_jank_thread_time', 'ms', | 51 results.current_page, 'responsive-biggest_jank_thread_time', 'ms', |
50 jank_stats.biggest_jank_thread_time)) | 52 jank_stats.biggest_jank_thread_time, |
| 53 improvement_direction=improvement_direction.DOWN)) |
OLD | NEW |