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 import unittest | 5 import unittest |
6 | 6 |
7 from telemetry.timeline import model as model_module | 7 from telemetry.timeline import model as model_module |
8 from telemetry.timeline import async_slice | 8 from telemetry.timeline import async_slice |
9 from telemetry.web_perf import timeline_interaction_record as tir_module | 9 from telemetry.web_perf import timeline_interaction_record as tir_module |
10 from telemetry.web_perf.metrics import mainthread_jank_stats | 10 from telemetry.web_perf.metrics import mainthread_jank_stats |
11 | 11 |
12 | 12 |
13 class MainthreadJankTests(unittest.TestCase): | 13 class MainthreadJankTests(unittest.TestCase): |
14 | 14 |
15 def CreateTestRecord(self, name, start, end, thread_start, thread_end, | 15 def CreateTestRecord(self, name, start, end, thread_start, thread_end, |
16 parent_thread): | 16 parent_thread): |
17 s = async_slice.AsyncSlice( | 17 s = async_slice.AsyncSlice( |
18 'cat', 'Interaction.%s/is_responsive' % name, | 18 'cat', 'Interaction.%s' % name, |
sullivan
2015/03/16 14:58:30
Do these names get propogated to the dashboard at
eakuefner
2015/03/16 15:20:28
What Ned said is correct -- we actually strip mark
nednguyen
2015/03/16 16:12:17
I don't think we will get rid of all flags. At lea
| |
19 timestamp=start, duration=end - start, start_thread=parent_thread, | 19 timestamp=start, duration=end - start, start_thread=parent_thread, |
20 end_thread=parent_thread, thread_start=thread_start, | 20 end_thread=parent_thread, thread_start=thread_start, |
21 thread_duration=thread_end - thread_start) | 21 thread_duration=thread_end - thread_start) |
22 return tir_module.TimelineInteractionRecord.FromAsyncEvent(s) | 22 return tir_module.TimelineInteractionRecord.FromAsyncEvent(s) |
23 | 23 |
24 def testComputeMainthreadJankStatsForRecord(self): | 24 def testComputeMainthreadJankStatsForRecord(self): |
25 # The slice hierarchy should look something like this: | 25 # The slice hierarchy should look something like this: |
26 # [ MessageLoop::RunTask ] [MessageLoop::RunTask][ MessagLoop::RunTask ] | 26 # [ MessageLoop::RunTask ] [MessageLoop::RunTask][ MessagLoop::RunTask ] |
27 # [ foo ] [ bar ] | 27 # [ foo ] [ bar ] |
28 # | | | 28 # | | |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 ] | 109 ] |
110 | 110 |
111 stats = mainthread_jank_stats.MainthreadJankStats( | 111 stats = mainthread_jank_stats.MainthreadJankStats( |
112 renderer_main, test_records) | 112 renderer_main, test_records) |
113 # Main thread janks covered by records' ranges are: | 113 # Main thread janks covered by records' ranges are: |
114 # Record 1: (40ms -> 70ms) | 114 # Record 1: (40ms -> 70ms) |
115 # Record 2: (120ms -> 200ms) | 115 # Record 2: (120ms -> 200ms) |
116 # Record 3: (220ms -> 400ms), (450ms -> 750ms) | 116 # Record 3: (220ms -> 400ms), (450ms -> 750ms) |
117 self.assertEquals(560, stats.total_big_jank_thread_time) | 117 self.assertEquals(560, stats.total_big_jank_thread_time) |
118 self.assertEquals(300, stats.biggest_jank_thread_time) | 118 self.assertEquals(300, stats.biggest_jank_thread_time) |
OLD | NEW |