1 <!DOCTYPE html> 2 <html> 3 <!-- 4 Copyright (c) 2012 The Chromium Authors. All rights reserved. 5 Use of this source code is governed by a BSD-style license that can be 6 found in the LICENSE file. 7 --> 8 <head> 9 <title>LinuxPerfGestureParser tests</title> 10 <script src="base.js"></script> 11 </head> 12 <body> 13 <script> 14 'use strict'; 15 16 base.require('unittest'); 17 base.require('test_utils'); 18 base.require('linux_perf_importer'); 19 20 function testGestureImport() { 21 var lines = [ 22 '<...>-1837 [000] ...1 875292.741648: tracing_mark_write: ' + 23 'log: start: TimerLogOutputs', 24 '<...>-1837 [000] ...1 875292.741651: tracing_mark_write: ' + 25 'log: end: TimerLogOutputs', 26 '<...>-1837 [000] ...1 875292.742796: tracing_mark_write: ' + 27 'log: start: LogTimerCallback', 28 '<...>-1837 [000] ...1 875292.742802: tracing_mark_write: ' + 29 'log: end: LogTimerCallback', 30 '<...>-1837 [000] ...1 875292.742805: tracing_mark_write: ' + 31 'HandleTimer: start: LoggingFilterInterpreter', 32 '<...>-1837 [000] ...1 875292.742809: tracing_mark_write: ' + 33 'HandleTimer: start: AppleTrackpadFilterInterpreter', 34 '<...>-1837 [000] ...1 875292.742814: tracing_mark_write: ' + 35 'HandleTimer: start: Cr48ProfileSensorFilterInterpreter', 36 '<...>-1837 [000] ...1 875292.742818: tracing_mark_write: ' + 37 'HandleTimer: start: T5R2CorrectingFilterInterpreter', 38 '<...>-1837 [000] ...1 875292.742822: tracing_mark_write: ' + 39 'HandleTimer: start: StuckButtonInhibitorFilterInterpreter', 40 '<...>-1837 [000] ...1 875292.742825: tracing_mark_write: ' + 41 'HandleTimer: start: IntegralGestureFilterInterpreter', 42 '<...>-1837 [000] ...1 875292.742829: tracing_mark_write: ' + 43 'HandleTimer: start: ScalingFilterInterpreter', 44 '<...>-1837 [000] ...1 875292.742833: tracing_mark_write: ' + 45 'HandleTimer: start: SplitCorrectingFilterInterpreter', 46 '<...>-1837 [000] ...1 875292.742836: tracing_mark_write: ' + 47 'HandleTimer: start: AccelFilterInterpreter', 48 '<...>-1837 [000] ...1 875292.742840: tracing_mark_write: ' + 49 'HandleTimer: start: SensorJumpFilterInterpreter', 50 '<...>-1837 [000] ...1 875292.742843: tracing_mark_write: ' + 51 'HandleTimer: start: BoxFilterInterpreter', 52 '<...>-1837 [000] ...1 875292.742846: tracing_mark_write: ' + 53 'HandleTimer: start: LookaheadFilterInterpreter', 54 '<...>-1837 [000] ...1 875292.742853: tracing_mark_write: ' + 55 'SyncInterpret: start: IirFilterInterpreter', 56 '<...>-1837 [000] ...1 875292.742861: tracing_mark_write: ' + 57 'SyncInterpret: start: PalmClassifyingFilterInterpreter', 58 '<...>-1837 [000] ...1 875292.742872: tracing_mark_write: ' + 59 'SyncInterpret: start: ClickWiggleFilterInterpreter', 60 '<...>-1837 [000] ...1 875292.742881: tracing_mark_write: ' + 61 'SyncInterpret: start: FlingStopFilterInterpreter', 62 '<...>-1837 [000] ...1 875292.742887: tracing_mark_write: ' + 63 'SyncInterpret: start: ImmediateInterpreter', 64 '<...>-1837 [000] ...1 875292.742906: tracing_mark_write: ' + 65 'SyncInterpret: end: ImmediateInterpreter', 66 '<...>-1837 [000] ...1 875292.742910: tracing_mark_write: ' + 67 'SyncInterpret: end: FlingStopFilterInterpreter', 68 '<...>-1837 [000] ...1 875292.742914: tracing_mark_write: ' + 69 'SyncInterpret: end: ClickWiggleFilterInterpreter', 70 '<...>-1837 [000] ...1 875292.742917: tracing_mark_write: ' + 71 'SyncInterpret: end: PalmClassifyingFilterInterpreter', 72 '<...>-1837 [000] ...1 875292.742921: tracing_mark_write: ' + 73 'SyncInterpret: end: IirFilterInterpreter', 74 '<...>-1837 [000] ...1 875292.742926: tracing_mark_write: ' + 75 'HandleTimer: end: LookaheadFilterInterpreter', 76 '<...>-1837 [000] ...1 875292.742929: tracing_mark_write: ' + 77 'HandleTimer: end: BoxFilterInterpreter', 78 '<...>-1837 [000] ...1 875292.742932: tracing_mark_write: ' + 79 'HandleTimer: end: SensorJumpFilterInterpreter', 80 '<...>-1837 [000] ...1 875292.742937: tracing_mark_write: ' + 81 'HandleTimer: end: AccelFilterInterpreter', 82 '<...>-1837 [000] ...1 875292.742940: tracing_mark_write: ' + 83 'HandleTimer: end: SplitCorrectingFilterInterpreter', 84 '<...>-1837 [000] ...1 875292.742944: tracing_mark_write: ' + 85 'HandleTimer: end: ScalingFilterInterpreter', 86 '<...>-1837 [000] ...1 875292.742949: tracing_mark_write: ' + 87 'HandleTimer: end: IntegralGestureFilterInterpreter', 88 '<...>-1837 [000] ...1 875292.742952: tracing_mark_write: ' + 89 'HandleTimer: end: StuckButtonInhibitorFilterInterpreter', 90 '<...>-1837 [000] ...1 875292.742956: tracing_mark_write: ' + 91 'HandleTimer: end: T5R2CorrectingFilterInterpreter', 92 '<...>-1837 [000] ...1 875292.742959: tracing_mark_write: ' + 93 'HandleTimer: end: Cr48ProfileSensorFilterInterpreter', 94 '<...>-1837 [000] ...1 875292.742962: tracing_mark_write: ' + 95 'HandleTimer: end: AppleTrackpadFilterInterpreter', 96 '<...>-1837 [000] ...1 875292.742966: tracing_mark_write: ' + 97 'HandleTimer: end: LoggingFilterInterpreter', 98 '<...>-1837 [000] ...1 875292.742969: tracing_mark_write: ' + 99 'log: start: TimerLogOutputs', 100 '<...>-1837 [000] ...1 875292.742973: tracing_mark_write: ' + 101 'log: end: TimerLogOutputs', 102 '<...>-1837 [000] ...1 875292.795219: tracing_mark_write: ' + 103 'log: start: LogHardwareState', 104 '<...>-1837 [000] ...1 875292.795231: tracing_mark_write: ' + 105 'log: end: LogHardwareState', 106 ]; 107 var m = new tracing.TimelineModel(lines.join('\n'), false); 108 assertEquals(0, m.importErrors.length); 109 var threads = m.getAllThreads(); 110 assertEquals(1, threads.length); 111 112 var gestureThread = threads[0]; 113 assertEquals('gesture', gestureThread.name); 114 assertEquals(21, gestureThread.slices.length); 115 assertEquals('touchpad_gesture', gestureThread.slices[0].category); 116 assertEquals('GestureLog', gestureThread.slices[0].title); 117 assertEquals('touchpad_gesture', gestureThread.slices[2].category); 118 assertEquals('SyncInterpret', gestureThread.slices[2].title); 119 assertEquals('touchpad_gesture', gestureThread.slices[7].category); 120 assertEquals('HandleTimer', gestureThread.slices[7].title); 121 } 122 123 function testUnusualStart() { 124 var lines = [ 125 'X-30368 [000] ...1 1819362.481867: tracing_mark_write: ' + 126 'SyncInterpret: start: IirFilterInterpreter', 127 'X-30368 [000] ...1 1819362.481881: tracing_mark_write: ' + 128 'SyncInterpret: start: PalmClassifyingFilterInterpreter', 129 'X-30368 [000] ...1 1819362.481894: tracing_mark_write: ' + 130 'SyncInterpret: start: ClickWiggleFilterInterpreter', 131 'X-30368 [000] ...1 1819362.481905: tracing_mark_write: ' + 132 'SyncInterpret: start: FlingStopFilterInterpreter', 133 'X-30368 [000] ...1 1819362.481912: tracing_mark_write: ' + 134 'SyncInterpret: start: ImmediateInterpreter', 135 'X-30368 [000] ...1 1819362.481933: tracing_mark_write: ' + 136 'SyncInterpret: end: ImmediateInterpreter', 137 'X-30368 [000] ...1 1819362.481938: tracing_mark_write: ' + 138 'SyncInterpret: end: FlingStopFilterInterpreter', 139 'X-30368 [000] ...1 1819362.481943: tracing_mark_write: ' + 140 'SyncInterpret: end: ClickWiggleFilterInterpreter', 141 'X-30368 [000] ...1 1819362.481947: tracing_mark_write: ' + 142 'SyncInterpret: end: PalmClassifyingFilterInterpreter', 143 'X-30368 [000] ...1 1819362.481952: tracing_mark_write: ' + 144 'SyncInterpret: end: IirFilterInterpreter', 145 'X-30368 [000] ...1 1819362.481958: tracing_mark_write: ' + 146 'HandleTimer: end: LookaheadFilterInterpreter', 147 'X-30368 [000] ...1 1819362.481962: tracing_mark_write: ' + 148 'HandleTimer: end: BoxFilterInterpreter', 149 'X-30368 [000] ...1 1819362.481967: tracing_mark_write: ' + 150 'HandleTimer: end: SensorJumpFilterInterpreter', 151 'X-30368 [000] ...1 1819362.481973: tracing_mark_write: ' + 152 'HandleTimer: end: AccelFilterInterpreter', 153 'X-30368 [000] ...1 1819362.481977: tracing_mark_write: ' + 154 'HandleTimer: end: SplitCorrectingFilterInterpreter', 155 'X-30368 [000] ...1 1819362.481982: tracing_mark_write: ' + 156 'HandleTimer: end: ScalingFilterInterpreter', 157 'X-30368 [000] ...1 1819362.481988: tracing_mark_write: ' + 158 'HandleTimer: end: IntegralGestureFilterInterpreter', 159 'X-30368 [000] ...1 1819362.481993: tracing_mark_write: ' + 160 'HandleTimer: end: StuckButtonInhibitorFilterInterpreter', 161 'X-30368 [000] ...1 1819362.481998: tracing_mark_write: ' + 162 'HandleTimer: end: T5R2CorrectingFilterInterpreter', 163 'X-30368 [000] ...1 1819362.482033: tracing_mark_write: ' + 164 'HandleTimer: end: Cr48ProfileSensorFilterInterpreter', 165 'X-30368 [000] ...1 1819362.482038: tracing_mark_write: ' + 166 'HandleTimer: end: AppleTrackpadFilterInterpreter', 167 'X-30368 [000] ...1 1819362.482043: tracing_mark_write: ' + 168 'HandleTimer: end: LoggingFilterInterpreter', 169 'X-30368 [000] ...1 1819362.482047: tracing_mark_write: ' + 170 'log: start: TimerLogOutputs', 171 'X-30368 [000] ...1 1819362.482053: tracing_mark_write: ' + 172 'log: end: TimerLogOutputs', 173 ]; 174 var m = new tracing.TimelineModel(lines.join('\n'), false); 175 assertEquals(0, m.importErrors.length); 176 var threads = m.getAllThreads(); 177 assertEquals(1, threads.length); 178 } 179 180 function testImportError() { 181 var lines = [ 182 'X-30368 [000] ...1 1819362.481912: tracing_mark_write: ' + 183 'SyncInterpret: start: ImmediateInterpreter', 184 'X-30368 [000] ...1 1819362.481958: tracing_mark_write: ' + 185 'HandleTimer: end: LookaheadFilterInterpreter', 186 'X-30368 [000] ...1 1819362.481962: tracing_mark_write: ' + 187 'HandleTimer: end: BoxFilterInterpreter', 188 'X-30368 [000] ...1 1819362.481967: tracing_mark_write: ' + 189 'HandleTimer: end: SensorJumpFilterInterpreter', 190 'X-30368 [000] ...1 1819362.481973: tracing_mark_write: ' + 191 'HandleTimer: end: AccelFilterInterpreter', 192 'X-30368 [000] ...1 1819362.481977: tracing_mark_write: ' + 193 'HandleTimer: end: SplitCorrectingFilterInterpreter', 194 'X-30368 [000] ...1 1819362.481982: tracing_mark_write: ' + 195 'HandleTimer: end: ScalingFilterInterpreter', 196 'X-30368 [000] ...1 1819362.481988: tracing_mark_write: ' + 197 'HandleTimer: end: IntegralGestureFilterInterpreter', 198 ]; 199 var m = new tracing.TimelineModel(lines.join('\n'), false); 200 assertEquals(7, m.importErrors.length); 201 } 202 203 </script> 204 </body> 205 </html> 206