summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/tracing/linux_perf_importer_test.html
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/resources/tracing/linux_perf_importer_test.html')
-rw-r--r--chrome/browser/resources/tracing/linux_perf_importer_test.html98
1 files changed, 90 insertions, 8 deletions
diff --git a/chrome/browser/resources/tracing/linux_perf_importer_test.html b/chrome/browser/resources/tracing/linux_perf_importer_test.html
index ccdac64..b9b5b8b 100644
--- a/chrome/browser/resources/tracing/linux_perf_importer_test.html
+++ b/chrome/browser/resources/tracing/linux_perf_importer_test.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<!--
-Copyright (c) 2011 The Chromium Authors. All rights reserved.
+Copyright (c) 2012 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
@@ -91,7 +91,7 @@ function testTraceEventClockSyncRE() {
}
function testCanImport() {
- lines = [
+ var lines = [
'# tracer: nop',
'#',
'# TASK-PID CPU# TIMESTAMP FUNCTION',
@@ -114,14 +114,14 @@ function testCanImport() {
];
assertTrue(tracing.LinuxPerfImporter.canImport(lines.join('\n')));
- lines = [
+ var lines = [
' <idle>-0 [001] 4467.843475: sched_switch: ' +
'prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> ' +
'next_comm=SurfaceFlinger next_pid=178 next_prio=112'
];
assertTrue(tracing.LinuxPerfImporter.canImport(lines.join('\n')));
- lines = [
+ var lines = [
' <idle>-0 [001] 4467.843475: sched_switch: ' +
'prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> ' +
'next_comm=SurfaceFlinger next_pid=178 next_prio=112',
@@ -133,7 +133,7 @@ function testCanImport() {
];
assertTrue(tracing.LinuxPerfImporter.canImport(lines.join('\n')));
- lines = [
+ var lines = [
'SomeRandomText',
'More random text'
];
@@ -141,7 +141,7 @@ function testCanImport() {
}
function testImportOneSequence() {
- lines = [
+ var lines = [
' <idle>-0 [001] 4467.843475: sched_switch: ' +
'prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> ' +
'next_comm=SurfaceFlinger next_pid=178 next_prio=112',
@@ -171,7 +171,7 @@ function testImportOneSequenceWithSchedWakeUp() {
}
function testImportWithNewline() {
- lines = [
+ var lines = [
''
];
var m = new tracing.TimelineModel(lines.join('\n'));
@@ -179,7 +179,7 @@ function testImportWithNewline() {
}
function testClockSync() {
- lines = [
+ var lines = [
' <idle>-0 [001] 4467.843475: sched_switch: ' +
'prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ' +
'==> next_comm=SurfaceFlinger next_pid=178 next_prio=112',
@@ -203,16 +203,98 @@ function testClockSync() {
assertAlmostEquals((467.843475 - 467.843) * 1000, c.slices[0].start);
}
+function testClockSyncMarkWrite() {
+ var lines = [
+ 'systrace.sh-8170 [001] 15180.978813: sched_switch: ' +
+ 'prev_comm=systrace.sh prev_pid=8170 prev_prio=120 ' +
+ 'prev_state=x ==> next_comm=kworker/1:0 next_pid=7873 ' +
+ 'next_prio=120',
+ ' kworker/1:0-7873 [001] 15180.978836: sched_switch: ' +
+ 'prev_comm=kworker/1:0 prev_pid=7873 prev_prio=120 ' +
+ 'prev_state=S ==> next_comm=debugd next_pid=4404 next_prio=120',
+ ' debugd-4404 [001] 15180.979010: sched_switch: prev_comm=debugd ' +
+ 'prev_pid=4404 prev_prio=120 prev_state=S ==> ' +
+ 'next_comm=dbus-daemon next_pid=510 next_prio=120',
+ 'systrace.sh-8182 [000] 15186.203900: tracing_mark_write: ' +
+ 'trace_event_clock_sync: parent_ts=0.0'
+ ];
+ var m = new tracing.TimelineModel(lines.join('\n'), false);
+ assertEquals(0, m.importErrors.length);
+
+ var c = m.cpus[1];
+ assertEquals(2, c.slices.length);
+
+ assertAlmostEquals((5180.978813 - 5186.2039) * 1000, c.slices[0].start);
+}
+
+
function testImportWithoutClockSyncDeletesEverything() {
}
function testWorkQueueImport() {
+ var lines = [
+ 'kworker/0:3-6880 [000] 2784.771958: workqueue_execute_start: ' +
+ 'work struct ffff8800a5083a20: function intel_unpin_work_fn',
+ 'kworker/0:3-6880 [000] 2784.771966: workqueue_execute_end: ' +
+ 'work struct ffff8800a5083a20',
+ 'kworker/1:2-7269 [001] 2784.805966: workqueue_execute_start: ' +
+ 'work struct ffff88014fb0f158: function do_dbs_timer',
+ 'kworker/1:2-7269 [001] 2784.805975: workqueue_execute_end: ' +
+ 'work struct ffff88014fb0f158'
+ ];
+ var m = new tracing.TimelineModel(lines.join('\n'), false);
+ assertEquals(0, m.importErrors.length);
+
+ assertEquals(1, m.processes['6880'].threads['6880'].subRows.length);
+ assertEquals(1, m.processes['7269'].threads['7269'].subRows.length);
}
function testPowerStartImport() {
}
function testCpuFrequencyImport() {
+ var lines = [
+ 'kworker/0:3-6880 [000] 2784.783015: power_frequency: ' +
+ 'type=2 state=1000000 cpu_id=0',
+ 'kworker/1:2-7269 [001] 2784.788993: power_frequency: ' +
+ 'type=2 state=800000 cpu_id=1',
+ 'kworker/1:2-7269 [001] 2784.993120: power_frequency: ' +
+ 'type=2 state=1300000 cpu_id=1'
+ ];
+ var m = new tracing.TimelineModel(lines.join('\n'), false);
+ assertEquals(0, m.importErrors.length);
+
+ var c0 = m.cpus[0];
+ assertEquals(0, c0.slices.length);
+ assertEquals(1, c0.counters['Power Frequency'].samples.length);
+
+ var c1 = m.cpus[1];
+ assertEquals(0, c1.slices.length);
+ assertEquals(2, c1.counters['Power Frequency'].samples.length);
+}
+
+function testi915Import() {
+ var lines = [
+ ' chrome-1223 [000] 2784.773556: i915_gem_object_pwrite: ' +
+ 'obj=ffff88013f13fc00, offset=0, len=2984',
+ ' X-964 [000] 2784.774864: i915_flip_request: ' +
+ 'plane=0, obj=ffff88013f0b9a00',
+ ' <idle>-0 [000] 2784.788644: i915_flip_complete: ' +
+ 'plane=0, obj=ffff88013f0b9a00'
+ ];
+ var m = new tracing.TimelineModel(lines.join('\n'), false);
+ assertEquals(0, m.importErrors.length);
+
+ assertEquals('i915_gem', m.processes['0'].threads['1'].name);
+ assertEquals(1, m.processes['0'].threads['1'].subRows.length);
+
+ assertEquals('i915_flip', m.processes['0'].threads['2'].name);
+ assertEquals(1, m.processes['0'].threads['1'].subRows.length);
+
+ assertAlmostEquals(2784.774864 * 1000.0,
+ m.processes['0'].threads['2'].subRows[0][0].start);
+ assertAlmostEquals((2784.788644 - 2784.774864) * 1000.0,
+ m.processes['0'].threads['2'].subRows[0][0].duration);
}
</script>