diff options
Diffstat (limited to 'chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf')
41 files changed, 0 insertions, 8082 deletions
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/android_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/android_parser.html deleted file mode 100644 index 5e9dda90f42..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/android_parser.html +++ /dev/null @@ -1,240 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> -<link rel="import" href="/tracing/model/counter_series.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses trace_marker events that were inserted in the trace by - * userland. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - var ColorScheme = tr.b.ColorScheme; - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses linux trace mark events that were inserted in the trace by userland. - * @constructor - */ - function AndroidParser(importer) { - Parser.call(this, importer); - - importer.registerEventHandler('tracing_mark_write:android', - AndroidParser.prototype.traceMarkWriteAndroidEvent.bind(this)); - importer.registerEventHandler('0:android', - AndroidParser.prototype.traceMarkWriteAndroidEvent.bind(this)); - - this.model_ = importer.model_; - this.ppids_ = {}; - } - - function parseArgs(argsString) { - var args = {}; - if (argsString) { - var argsArray = argsString.split(';'); - for (var i = 0; i < argsArray.length; ++i) { - var parts = argsArray[i].split('='); - if (parts[0]) - args[parts.shift()] = parts.join('='); - } - } - return args; - } - - AndroidParser.prototype = { - __proto__: Parser.prototype, - - openAsyncSlice: function(thread, category, name, cookie, ts, args) { - var asyncSliceConstructor = - tr.model.AsyncSlice.getConstructor( - category, name); - var slice = new asyncSliceConstructor( - category, name, - ColorScheme.getColorIdForGeneralPurposeString(name), ts, args); - var key = category + ':' + name + ':' + cookie; - slice.id = cookie; - slice.startThread = thread; - - if (!this.openAsyncSlices) { - this.openAsyncSlices = { }; - } - this.openAsyncSlices[key] = slice; - }, - - closeAsyncSlice: function(thread, category, name, cookie, ts, args) { - if (!this.openAsyncSlices) { - // No async slices have been started. - return; - } - - var key = category + ':' + name + ':' + cookie; - var slice = this.openAsyncSlices[key]; - if (!slice) { - // No async slices w/ this key have been started. - return; - } - - for (var arg in args) { - if (slice.args[arg] !== undefined) { - this.model_.importWarning({ - type: 'parse_error', - message: 'Both the S and F events of ' + slice.title + - ' provided values for argument ' + arg + '.' + - ' The value of the F event will be used.' - }); - } - slice.args[arg] = args[arg]; - } - - slice.endThread = thread; - slice.duration = ts - slice.start; - slice.startThread.asyncSliceGroup.push(slice); - slice.subSlices = [new tr.model.AsyncSlice(slice.category, - slice.title, slice.colorId, slice.start, slice.args, slice.duration)]; - delete this.openAsyncSlices[key]; - }, - - traceMarkWriteAndroidEvent: function(eventName, cpuNumber, pid, ts, - eventBase) { - var eventData = eventBase.details.split('|'); - switch (eventData[0]) { - case 'B': - var ppid = parseInt(eventData[1]); - var title = eventData[2]; - var args = parseArgs(eventData[3]); - var category = eventData[4]; - if (category === undefined) - category = 'android'; - - var thread = this.model_.getOrCreateProcess(ppid) - .getOrCreateThread(pid); - thread.name = eventBase.threadName; - if (!thread.sliceGroup.isTimestampValidForBeginOrEnd(ts)) { - this.model_.importWarning({ - type: 'parse_error', - message: 'Timestamps are moving backward.' - }); - return false; - } - - this.ppids_[pid] = ppid; - thread.sliceGroup.beginSlice(category, title, ts, args); - - break; - - case 'E': - var ppid = this.ppids_[pid]; - if (ppid === undefined) { - // Silently ignore unmatched E events. - break; - } - - var thread = this.model_.getOrCreateProcess(ppid) - .getOrCreateThread(pid); - if (!thread.sliceGroup.openSliceCount) { - // Silently ignore unmatched E events. - break; - } - - var slice = thread.sliceGroup.endSlice(ts); - - var args = parseArgs(eventData[3]); - for (var arg in args) { - if (slice.args[arg] !== undefined) { - this.model_.importWarning({ - type: 'parse_error', - message: 'Both the B and E events of ' + slice.title + - ' provided values for argument ' + arg + '.' + - ' The value of the E event will be used.' - }); - } - slice.args[arg] = args[arg]; - } - - break; - - case 'C': - var ppid = parseInt(eventData[1]); - var name = eventData[2]; - var value = parseInt(eventData[3]); - var category = eventData[4]; - if (category === undefined) - category = 'android'; - - var ctr = this.model_.getOrCreateProcess(ppid) - .getOrCreateCounter(category, name); - // Initialize the counter's series fields if needed. - if (ctr.numSeries === 0) { - ctr.addSeries(new tr.model.CounterSeries(value, - ColorScheme.getColorIdForGeneralPurposeString( - ctr.name + '.' + 'value'))); - } - - ctr.series.forEach(function(series) { - series.addCounterSample(ts, value); - }); - - break; - - case 'S': - var ppid = parseInt(eventData[1]); - var name = eventData[2]; - var cookie = parseInt(eventData[3]); - var args = parseArgs(eventData[4]); - var category = eventData[5]; - if (category === undefined) - category = 'android'; - - - var thread = this.model_.getOrCreateProcess(ppid) - .getOrCreateThread(pid); - thread.name = eventBase.threadName; - - this.ppids_[pid] = ppid; - this.openAsyncSlice(thread, category, name, cookie, ts, args); - - break; - - case 'F': - // Note: An async slice may end on a different thread from the one - // that started it so this thread may not have been seen yet. - var ppid = parseInt(eventData[1]); - - var name = eventData[2]; - var cookie = parseInt(eventData[3]); - var args = parseArgs(eventData[4]); - var category = eventData[5]; - if (category === undefined) - category = 'android'; - - var thread = this.model_.getOrCreateProcess(ppid) - .getOrCreateThread(pid); - thread.name = eventBase.threadName; - - this.ppids_[pid] = ppid; - this.closeAsyncSlice(thread, category, name, cookie, ts, args); - - break; - - default: - return false; - } - - return true; - } - }; - - Parser.register(AndroidParser); - - return { - AndroidParser: AndroidParser - }; -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/android_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/android_parser_test.html deleted file mode 100644 index ddc5ba99823..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/android_parser_test.html +++ /dev/null @@ -1,230 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - function newModel(events) { - return tr.c.TestUtils.newModelWithEvents([events], { - shiftWorldToZero: false - }); - } - - test('androidUserlandImport', function() { - var lines = [ - 'SurfaceFlinger-4831 [001] ...1 80909.598554: tracing_mark_write: B|4829|onMessageReceived', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.598572: tracing_mark_write: B|4829|handleMessageInvalidate', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.598590: tracing_mark_write: B|4829|latchBuffer', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.598604: tracing_mark_write: E', - 'SurfaceFlinger-4831 [001] ...1 80909.598627: tracing_mark_write: B|4829|latchBuffer', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.598651: tracing_mark_write: B|4829|updateTexImage', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.598675: tracing_mark_write: B|4829|acquireBuffer', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.598695: tracing_mark_write: B|4829|' + // @suppress longLineCheck - 'com.android.launcher/com.android.launcher2.Launcher: 0', - 'SurfaceFlinger-4831 [001] ...1 80909.598709: tracing_mark_write: E', - 'SurfaceFlinger-4831 [001] ...1 80909.598733: tracing_mark_write: C|4829|' + // @suppress longLineCheck - 'com.android.launcher/com.android.launcher2.Launcher|0', - 'SurfaceFlinger-4831 [001] ...1 80909.598746: tracing_mark_write: E', - 'SurfaceFlinger-4831 [001] ...1 80909.598844: tracing_mark_write: B|4829|releaseBuffer', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.598862: tracing_mark_write: B|4829|' + // @suppress longLineCheck - 'com.android.launcher/com.android.launcher2.Launcher: 2', - 'SurfaceFlinger-4831 [001] ...1 80909.598876: tracing_mark_write: E', - 'SurfaceFlinger-4831 [001] ...1 80909.598892: tracing_mark_write: E', - 'SurfaceFlinger-4831 [001] ...1 80909.598925: tracing_mark_write: E', - 'SurfaceFlinger-4831 [001] ...1 80909.598955: tracing_mark_write: E', - 'SurfaceFlinger-4831 [001] ...1 80909.598988: tracing_mark_write: B|4829|latchBuffer', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.599001: tracing_mark_write: E', - 'SurfaceFlinger-4831 [001] ...1 80909.599021: tracing_mark_write: B|4829|latchBuffer', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.599036: tracing_mark_write: E', - 'SurfaceFlinger-4831 [001] ...1 80909.599068: tracing_mark_write: E', - 'SurfaceFlinger-4831 [001] ...1 80909.599087: tracing_mark_write: E', - 'SurfaceFlinger-4831 [001] ...1 80909.599104: tracing_mark_write: E' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var thread = threads[0]; - assert.equal(thread.parent.pid, 4829); - assert.equal(thread.tid, 4831); - assert.equal(thread.name, 'SurfaceFlinger'); - assert.equal(thread.sliceGroup.length, 11); - }); - - test('androidUserlandImportWithSpacesInThreadName', function() { - var lines = [ - 'Surface Flinger -4831 [001] ...1 80909.598590: tracing_mark_write: B|4829|latchBuffer', // @suppress longLineCheck - 'Surface Flinger -4831 [001] ...1 80909.598604: tracing_mark_write: E' // @suppress longLineCheck - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var thread = threads[0]; - assert.equal(thread.parent.pid, 4829); - assert.equal(thread.tid, 4831); - assert.equal(thread.name, 'Surface Flinger '); - assert.equal(thread.sliceGroup.length, 1); - }); - - test('androidAsyncUserlandImport', function() { - var lines = [ - 'ndroid.launcher-9649 ( 9649) [000] ...1 1990280.663276: ' + - 'tracing_mark_write: S|9649|animator:childrenOutlineAlpha|' + - '1113053968', - 'ndroid.launcher-9649 ( 9649) [000] ...1 1990280.781445: ' + - 'tracing_mark_write: F|9649|animator:childrenOutlineAlpha|' + - '1113053968' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var thread = threads[0]; - assert.equal(thread.parent.pid, 9649); - assert.equal(thread.tid, 9649); - assert.equal(thread.name, 'ndroid.launcher'); - assert.equal(thread.sliceGroup.length, 0); - assert.equal(thread.asyncSliceGroup.length, 1); - - var slice = thread.asyncSliceGroup.slices[0]; - assert.equal(slice.title, 'animator:childrenOutlineAlpha'); - assert.closeTo(118.169, slice.duration, 1e-5); - }); - - test('androidUserlandLegacyKernelImport', function() { - var lines = [ - 'SurfaceFlinger-4831 [001] ...1 80909.598554: 0: B|4829|onMessageReceived', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.598572: 0: B|4829|handleMessageInvalidate', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.598590: 0: B|4829|latchBuffer', - 'SurfaceFlinger-4831 [001] ...1 80909.598604: 0: E', - 'SurfaceFlinger-4831 [001] ...1 80909.598627: 0: B|4829|latchBuffer', - 'SurfaceFlinger-4831 [001] ...1 80909.598651: 0: B|4829|updateTexImage', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.598675: 0: B|4829|acquireBuffer', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.598695: 0: B|4829|' + - 'com.android.launcher/com.android.launcher2.Launcher: 0', - 'SurfaceFlinger-4831 [001] ...1 80909.598709: 0: E', - 'SurfaceFlinger-4831 [001] ...1 80909.598733: 0: C|4829|' + - 'com.android.launcher/com.android.launcher2.Launcher|0', - 'SurfaceFlinger-4831 [001] ...1 80909.598746: 0: E', - 'SurfaceFlinger-4831 [001] ...1 80909.598844: 0: B|4829|releaseBuffer', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.598862: 0: B|4829|' + - 'com.android.launcher/com.android.launcher2.Launcher: 2', - 'SurfaceFlinger-4831 [001] ...1 80909.598876: 0: E', - 'SurfaceFlinger-4831 [001] ...1 80909.598892: 0: E', - 'SurfaceFlinger-4831 [001] ...1 80909.598925: 0: E', - 'SurfaceFlinger-4831 [001] ...1 80909.598955: 0: E', - 'SurfaceFlinger-4831 [001] ...1 80909.598988: 0: B|4829|latchBuffer', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.599001: 0: E', - 'SurfaceFlinger-4831 [001] ...1 80909.599021: 0: B|4829|latchBuffer', // @suppress longLineCheck - 'SurfaceFlinger-4831 [001] ...1 80909.599036: 0: E', - 'SurfaceFlinger-4831 [001] ...1 80909.599068: 0: E', - 'SurfaceFlinger-4831 [001] ...1 80909.599087: 0: E', - 'SurfaceFlinger-4831 [001] ...1 80909.599104: 0: E' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var thread = threads[0]; - assert.equal(thread.parent.pid, 4829); - assert.equal(thread.tid, 4831); - assert.equal(thread.name, 'SurfaceFlinger'); - assert.equal(thread.sliceGroup.length, 11); - }); - - test('androidUserlandChromiumImport', function() { - var lines = [ - 'SandboxedProces-2894 [001] ...1 253.780659: tracing_mark_write: B|2867|DoWorkLoop|arg1=1|cat1', // @suppress longLineCheck - 'SandboxedProces-2894 [001] ...1 253.780671: tracing_mark_write: B|2867|DeferOrRunPendingTask|source=test=test;task=xyz|cat2', // @suppress longLineCheck - 'SandboxedProces-2894 [001] ...1 253.780671: tracing_mark_write: E|2867|DeferOrRunPendingTask||cat1', // @suppress longLineCheck - 'SandboxedProces-2894 [001] ...1 253.780686: tracing_mark_write: B|2867|MessageLoop::RunTask|source=ipc/ipc_sync_message_filter.cc:Send|cat2', // @suppress longLineCheck - 'SandboxedProces-2894 [001] ...1 253.780700: tracing_mark_write: E|2867|MessageLoop::RunTask||cat1', // @suppress longLineCheck - 'SandboxedProces-2894 [001] ...1 253.780750: tracing_mark_write: C|2867|counter1|10|cat1', // @suppress longLineCheck - 'SandboxedProces-2894 [001] ...1 253.780859: tracing_mark_write: E|2867|DoWorkLoop|arg2=2|cat2', // @suppress longLineCheck - 'SandboxedProces-2894 [000] ...1 255.663276: tracing_mark_write: S|2867|async|1113053968|arg1=1;arg2=2|cat1', // @suppress longLineCheck - 'SandboxedProces-2894 [000] ...1 255.663276: tracing_mark_write: F|2867|async|1113053968|arg3=3|cat1', // @suppress longLineCheck - 'SandboxedProces-2894 [000] ...1 255.663276: tracing_mark_write: trace_event_clock_sync: parent_ts=128' // @suppress longLineCheck - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var thread = threads[0]; - assert.equal(thread.parent.pid, 2867); - assert.equal(thread.tid, 2894); - assert.equal(thread.name, 'SandboxedProces'); - assert.equal(thread.sliceGroup.length, 3); - - assert.equal(thread.sliceGroup.slices[0].args['arg1'], '1'); - assert.equal(thread.sliceGroup.slices[0].args['arg2'], '2'); - - assert.equal(thread.sliceGroup.slices[1].args['source'], 'test=test'); - assert.equal(thread.sliceGroup.slices[1].category, 'cat2'); - assert.equal('DeferOrRunPendingTask', - thread.sliceGroup.slices[1].title); - assert.equal(thread.sliceGroup.slices[1].args['task'], 'xyz'); - - assert.equal('ipc/ipc_sync_message_filter.cc:Send', - thread.sliceGroup.slices[2].args['source']); - - assert.equal(thread.asyncSliceGroup.length, 1); - assert.equal(thread.asyncSliceGroup.slices[0].args['arg1'], '1'); - assert.equal(thread.asyncSliceGroup.slices[0].args['arg2'], '2'); - assert.equal(thread.asyncSliceGroup.slices[0].args['arg3'], '3'); - - var counters = m.getAllCounters(); - assert.equal(counters.length, 1); - assert.equal(counters[0].category, 'cat1'); - assert.equal(counters[0].name, 'counter1'); - - assert.equal(counters[0].numSamples, 1); - assert.equal(counters[0].getSeries(0).getSample(0).value, 10); - - assert.equal(Math.round((253.780659 - (255.663276 - 128)) * 1000), - Math.round(thread.sliceGroup.slices[0].start)); - }); - - test('androidNeedReschedImport', function() { - var lines = [ - 'RenderThread-3894 [001] ...1 253.780659: tracing_mark_write: B|3586|DrawFrame', // @suppress longLineCheck - 'RenderThread-3894 [001] ...1 253.780671: tracing_mark_write: B|3586|waitForTask', // @suppress longLineCheck - 'RenderThread-3894 [001] .N.1 253.780671: tracing_mark_write: E', // @suppress longLineCheck - 'RenderThread-3894 [001] ...1 253.780671: tracing_mark_write: B|3586|waitForTask', // @suppress longLineCheck - 'RenderThread-3894 [001] .n.1 253.780671: tracing_mark_write: E', // @suppress longLineCheck - 'RenderThread-3894 [001] ...1 253.780671: tracing_mark_write: B|3586|waitForTask', // @suppress longLineCheck - 'RenderThread-3894 [001] .p.1 253.780671: tracing_mark_write: E', // @suppress longLineCheck - 'RenderThread-3894 [001] ...1 253.780686: tracing_mark_write: E' // @suppress longLineCheck - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings, 'hasImportWarnings'); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var thread = threads[0]; - assert.equal(thread.parent.pid, 3586); - assert.equal(thread.tid, 3894); - assert.equal(thread.name, 'RenderThread'); - assert.equal(thread.sliceGroup.length, 4); - }); -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/binder_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/binder_parser.html deleted file mode 100644 index 4cebf557bdf..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/binder_parser.html +++ /dev/null @@ -1,694 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2015 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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses Binder events - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - var ColorScheme = tr.b.ColorScheme; - var Parser = tr.e.importer.linux_perf.Parser; - - // Matches binder transactions: - // transaction=%d dest_node=%d dest_proc=%d dest_thread=%d reply=%d flags=0x%x - // code=0x%x - var binderTransRE = new RegExp('transaction=(\\d+) dest_node=(\\d+) ' + - 'dest_proc=(\\d+) dest_thread=(\\d+) ' + - 'reply=(\\d+) flags=(0x[0-9a-fA-F]+) ' + - 'code=(0x[0-9a-fA-F]+)'); - - var binderTransReceivedRE = /transaction=(\d+)/; - - function isBinderThread(name) { - return (name.indexOf('Binder') > -1); - } - - // Taken from kernel source: include/uapi/linux/android/binder.h. - var TF_ONE_WAY = 0x01; - var TF_ROOT_OBJECT = 0x04; - var TF_STATUS_CODE = 0x08; - var TF_ACCEPT_FDS = 0x10; - var NO_FLAGS = 0; - - function binderFlagsToHuman(num) { - var flag = parseInt(num, 16); - var str = ''; - - if (flag & TF_ONE_WAY) - str += 'this is a one-way call: async, no return; '; - if (flag & TF_ROOT_OBJECT) - str += 'contents are the components root object; '; - if (flag & TF_STATUS_CODE) - str += 'contents are a 32-bit status code; '; - if (flag & TF_ACCEPT_FDS) - str += 'allow replies with file descriptors; '; - if (flag === NO_FLAGS) - str += 'No Flags Set'; - - return str; - } - - function isReplyToOrigin(calling, called) { - return (called.dest_proc === calling.calling_pid || - called.dest_thread === calling.calling_pid); - } - - function binderCodeToHuman(code) { - return 'Java Layer Dependent'; - } - - function doInternalSlice(trans, slice, ts) { - if (slice.subSlices.length !== 0) { - /* We want to make sure we keep moving the small slice to the end of - the big slice or else the arrows will not point to the end. - */ - slice.subSlices[0].start = ts; - return slice.subSlices[0]; - } - var kthread = trans.calling_kthread.thread; - var internal_slice = kthread.sliceGroup.pushCompleteSlice('binder', - slice.title, - ts, .001, 0, 0, - slice.args); - - internal_slice.title = slice.title; - internal_slice.id = slice.id; - internal_slice.colorId = slice.colorId; - slice.subSlices.push(internal_slice); - return internal_slice; - } - - function generateBinderArgsForSlice(trans, c_threadName) { - return { - 'Transaction Id': trans.transaction_key, - 'Destination Node': trans.dest_node, - 'Destination Process': trans.dest_proc, - 'Destination Thread': trans.dest_thread, - 'Destination Name': c_threadName, - 'Reply transaction?': trans.is_reply_transaction, - 'Flags': trans.flags + ' ' + - binderFlagsToHuman(trans.flags), - - 'Code': trans.code + ' ' + - binderCodeToHuman(trans.code), - - 'Calling PID': trans.calling_pid, - 'Calling tgid': trans.calling_kthread.thread.parent.pid - }; - } - - /** @constructor */ - function BinderTransaction(events, calling_pid, calling_ts, calling_kthread) { - this.transaction_key = parseInt(events[1]); - this.dest_node = parseInt(events[2]); - this.dest_proc = parseInt(events[3]); - this.dest_thread = parseInt(events[4]); - this.is_reply_transaction = parseInt(events[5]) === 1 ? true : false; - this.expect_reply = ((this.is_reply_transaction === false) && - (parseInt(events[6], 16) & TF_ONE_WAY) === 0); - - this.flags = events[6]; - this.code = events[7]; - this.calling_pid = calling_pid; - this.calling_ts = calling_ts; - this.calling_kthread = calling_kthread; - } - - - /** @constructor */ - function BinderParser(importer) { - Parser.call(this, importer); - importer.registerEventHandler('binder_locked', - BinderParser.prototype. - binderLocked.bind(this)); - importer.registerEventHandler('binder_unlock', - BinderParser.prototype. - binderUnlock.bind(this)); - importer.registerEventHandler('binder_lock', - BinderParser.prototype.binderLock.bind(this)); - importer.registerEventHandler('binder_transaction', - BinderParser.prototype. - binderTransaction.bind(this)); - importer.registerEventHandler('binder_transaction_received', - BinderParser.prototype. - binderTransactionReceived.bind(this)); - - this.model_ = importer.model; - this.kthreadlookup = {}; - this.importer_ = importer; - this.transWaitingRecv = {}; - this.syncTransWaitingCompletion = {}; - this.recursiveSyncTransWaitingCompletion_ByPID = {}; - this.receivedTransWaitingConversion = {}; - } - - BinderParser.prototype = { - __proto__: Parser.prototype, - - binderLock: function(eventName, cpuNumber, pid, ts, eventBase) { - var tgid = parseInt(eventBase.tgid); - this.doNameMappings(pid, tgid, eventName.threadName); - - var kthread = this.importer_. - getOrCreateBinderKernelThread(eventBase.threadName, tgid, pid); - - kthread.binderAttemptLockTS = ts; - kthread.binderOpenTsA = ts; - return true; - }, - - binderLocked: function(eventName, cpuNumber, pid, ts, eventBase) { - var binder_thread = isBinderThread(eventBase.threadName); - var tgid, name; - var as_slice; - var need_push = false; - var kthread, rthread; - - tgid = parseInt(eventBase.tgid); - name = eventBase.threadName; - - kthread = this.importer_. - getOrCreateBinderKernelThread(eventBase.threadName, tgid, pid); - - this.doNameMappings(pid, tgid, name); - - rthread = kthread.thread; - kthread.binderLockAquiredTS = ts; - - if (kthread.binderAttemptLockTS === undefined) - return false; - - var args = this.generateArgsForSlice(tgid, pid, name, kthread); - rthread.sliceGroup.pushCompleteSlice('binder', 'binder lock waiting', - kthread.binderAttemptLockTS, - ts - kthread.binderAttemptLockTS, - 0, 0, args); - - kthread.binderAttemptLockTS = undefined; - return true; - }, - - binderUnlock: function(eventName, cpuNumber, pid, ts, eventBase) { - var tgid = parseInt(eventBase.tgid); - var kthread = this.importer_. - getOrCreateBinderKernelThread( - eventBase.threadName, tgid, pid); - - if (kthread.binderLockAquiredTS === undefined) - return false; - - var args = this.generateArgsForSlice(tgid, pid, eventBase.threadName, - kthread); - kthread.thread.sliceGroup.pushCompleteSlice( - 'binder', - 'binder lock held', - kthread.binderLockAquiredTS, - ts - kthread.binderLockAquiredTS, - 0, 0, args); - - kthread.binderLockAquiredTS = undefined; - return true; - }, - - /** There are a few transaction status changes that signify - * progress through a binder transaction: - * - * Case One: Sync transaction. - * Thread A calls a blocking function on Thread B. We receive a - * binder_transaction msg From thread A stating that it is going to Call - * thread B. We create a slice and a binder object for this transaction and - * add it to addTransactionWaitingForRecv(transaction key, binder object) - * This notifies thread B and passes the slice, binder object and time - * stamp. - * - * Case Two: Async transaction. - * Thread A calls an async function on Thread B. Like above we receive a - * binder_transaction message, but the flags differ from above. The - * TF_ONEWAY flags are set so we know that when Thread B gets the - * binder_transaction_received with the same transaciton key the total - * transaction is complete. - * - * Case Three: 'Prior_receive' - * Prior_receive occurs when the thread being called (think A calls B), - * receives a binder_transaction_received message, but cannot correlate it - * to any current outstanding recursive transactions. That means the - * message it just received is the start of some communication, not some - * ongoing communication. - * Once the execution flow has been passed to thread B, from A: - * Thread B enters binder_transaction_received() we see that Thread A - * had notified us that it sent us a message by calling - * getTransactionWaitingForRecv(transaction key); - * What can happen now is either this was a simple Call reply, - * or this is a call -> recursion -> reply. We call modelPriorReceive() - * which sets up the slices accordingly. - * If this is a call -> recursion -> reply - * we will go to case 4 by calling addRecursiveSyncTransNeedingCompletion() - * The function takes B's PID, the binder object from A and the current - * binder object from B. This function adds outstanding non-complete - * transactions to a stack on thread B. - * - * Case Four: 'recursive_trans' - * This case follows Like above: - * A sent binder_transaction - * B got binder_transaction_received - * B instead of replying to A can Call C or call 'into' A, ie recursion - * Case four also deals with setting up a large slice to 'contain' - * all the recursive transactions that happen until B finally replies to - * A. - * - * - * An example: A-> B-> C-> B-> A - * - * (1) A starts a synchronous transaction to B. - * (2) A enters binderTransaction() event handler, hits the else statement - * (3) A calls addTransactionWaitingForRecv(trans key, object) to notify - * Thread B. - * (4) B Enters binderTransactionReceived(). - * (5) B hits the second if after calling - * getTransactionWaitingForRecv(trans key) - * This function returns us the object set up in step (3). - * (6) This is not an async transaction, B calls - * setCurrentReceiveOnPID(B's PID, [ts for (4), object from (3)]). - * - * (7) B enters binderTransaction() event handler, first if triggers after - * calling getPriorReceiveOnPID(B's PID) the tuple from (6) is returned. - * - * (8) Execution enters modelPriorReceive(). - * (8a) A slice is setup for this binder transaction in B's timeline. - * (9) This is not a reply to thread A, B is going to call Thread C. - * (10) else statement is hit. - * (11) We set the tile from (8a) to be binder_reply this is the - * 'containg slice' for the recursion - * (12) We create a new slice 'binder_transaction' this slice is the - * recursive slice that will have arrows to Thread C's slice. - * (13) addRecursiveSyncTransNeedingCompletion(B's PID, - * [obj from (3), obj from 7]) - * this sets up notification that B's pid has outstanding recursive - * transactions that need to be completed. - * (14) B notifies C that a transaction is waiting for it by calling - * addTransactionWaitingForRecv like in step (3). - * (15) C enters binderTransactionReceived() step 5 6 7 8 8a happen, but in - * the context of Thread C. - * (16) C is in modelPriorReceive(), it hits the first if statement, - * this transaction _IS_ a reply, and it is a reply to B. - * (17) C calls addSyncTransNeedingCompletion(trans key, - * [object from(3), object from 15-5]) - * (18) B enters binderTransactionReceived() hits the first if after calling - * getSyncTransNeedingCompletion(trans key from (17)) the tuple from - * (17) gets returned. - * - * (19) B scales up the slice created in (12) and sets up flows from 15-8a - * slice. - * (20) B enters BinderTransaction() event handler and the second if is hit - * after calling getRecursiveTransactionNeedingCompletion(B's pid). - * (21) modelRecursiveTransactions() gets called, first if executes. - * (22) slice durations are fixed up. - * (23) B notifies A via - * addSyncTransNeedingCompletion(trans key, binder obj from 8a). - * (24) B deletes the outstanding asynctrans via - ( removeRecursiveTransaction(B's pid). - * (25) A enters binderTransactionReceived() event handler and finishes up - * some flows, and slices. - */ - binderTransaction: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = binderTransRE.exec(eventBase.details); - if (event === undefined) - return false; - - var tgid = parseInt(eventBase.tgid); - - this.doNameMappings(pid, tgid, eventBase.threadName); - - var kthread; - kthread = this.importer_. - getOrCreateBinderKernelThread(eventBase.threadName, tgid, pid); - - var trans = new BinderTransaction(event, pid, ts, kthread); - var args = generateBinderArgsForSlice(trans, eventBase.threadName); - /** - * This thread previously ack'd the transaction with a - * transaction_received. That means someone sent us a message we processed - * it and are now sending a transaction. - * The transaction could be a response, or it could be recursive. - */ - var prior_receive = this.getPriorReceiveOnPID(pid); - - if (prior_receive !== false) { - return this.modelPriorReceive(prior_receive, ts, pid, tgid, kthread, - trans, args, event); - } - /** - * This Thread has an already established recursive slice. We will now - * either complete the entire transaction, OR do more recursive calls. - */ - var recursive_trans = this.getRecursiveTransactionNeedingCompletion(pid); - - if (recursive_trans !== false) - return this.modelRecursiveTransactions(recursive_trans, ts, pid, - kthread, trans, args); - - /** - * Start of a Transaction. This thread is the initiator of either a call - * response, an async call -> ack, or a call -> recursion -> response. - * Note, we put a fake duration into this slice and patch it up later. - */ - var slice = kthread.thread.sliceGroup.pushCompleteSlice('binder', - '', ts, .03, 0, 0, args); - - slice.colorId = ColorScheme.getColorIdForGeneralPurposeString( - ts.toString()); - trans.slice = slice; - - if (trans.expect_reply) - slice.title = 'binder transaction'; - else - slice.title = 'binder transaction async'; - - this.addTransactionWaitingForRecv(trans.transaction_key, trans); - - return true; - }, - - binderTransactionReceived: function(eventName, cpuNumber, pid, ts, - eventBase) { - var event = binderTransReceivedRE.exec(eventBase.details); - - if (event === undefined) - return false; - - var transactionkey = parseInt(event[1]); - var tgid = parseInt(eventBase.tgid); - var kthread; - kthread = this.importer_. - getOrCreateBinderKernelThread(eventBase.threadName, tgid, pid); - - var syncComplete = this.getSyncTransNeedsCompletion(transactionkey); - - if (syncComplete !== false) { - /* This recv is the completion of a synchronous transaction. - * We need to scale the slice up to the current ts and finish - * creating some flows. - */ - var sync_trans = syncComplete[0]; - var sync_slice = sync_trans.slice; - var response_trans = syncComplete[1]; - var response_slice = response_trans.slice; - - sync_slice.duration = ts - sync_slice.start; - /** These calls are a little hack that places a very small slice at - * the end of the sync slice and the response slice. This allows us - * to hook flow events (arrows) from the start to the end of the - * slices. - */ - var sync_internal = doInternalSlice(sync_trans, sync_slice, ts); - var response_ts = response_slice.start + response_slice.duration; - var response_internal = doInternalSlice(response_trans, - response_slice, response_ts); - - if (response_slice.outFlowEvents.length === 0 || - sync_slice.inFlowEvents.length === 0) { - var flow = this.generateFlow(response_internal, sync_internal, - response_trans, sync_trans); - - sync_slice.inFlowEvents.push(flow); - response_slice.outFlowEvents.push(flow); - this.model_.flowEvents.push(flow); - } - // Move flow arrows -- but not the first one. - for (var i = 1; i < sync_slice.inFlowEvents.length; i++) { - sync_slice.inFlowEvents[i].duration = - ts - sync_slice.inFlowEvents[i].start; - } - return true; - } - - var tr_for_recv = this.getTransactionWaitingForRecv(transactionkey); - - if (tr_for_recv !== false) { - if (!tr_for_recv.expect_reply) { - // This is an async call place an Async slice. - var args = generateBinderArgsForSlice(tr_for_recv, - eventBase.threadName); - var slice = kthread.thread.sliceGroup. - pushCompleteSlice('binder', - 'binder Async recv', - ts, .03, 0, 0, - args); - - var fake_event = [0, 0, 0, 0, 0, 0, 0]; - var fake_trans = new BinderTransaction(fake_event, pid, ts, kthread); - var flow = this.generateFlow(tr_for_recv.slice, slice, - tr_for_recv, fake_trans); - - this.model_.flowEvents.push(flow); - tr_for_recv.slice.title = 'binder transaction async'; - tr_for_recv.slice.duration = .03; - return true; - } - // Setup prior receive. - tr_for_recv.slice.title = 'binder transaction'; - this.setCurrentReceiveOnPID(pid, [ts, tr_for_recv]); - return true; - } - /** This case is when we received an ack for a transaction we have - * never seen before. This usually happens at the start of a trace. - * We will get incomplete transactions that started before started - * tracing. Just discard them. - */ - return false; - }, - - // helper functions - modelRecursiveTransactions: function(recursive_trans, ts, pid, kthread, - trans, args) { - - var recursive_slice = recursive_trans[1].slice; - var orig_slice = recursive_trans[0].slice; - recursive_slice.duration = ts - recursive_slice.start; - trans.slice = recursive_slice; - - if (trans.is_reply_transaction) { - /* Case one: - * This transaction is finally the reply of the recursion. - */ - orig_slice.duration = ts - orig_slice.start; - this.addSyncTransNeedingCompletion(trans.transaction_key, - recursive_trans); - - if (isReplyToOrigin(recursive_trans[0], trans)) - this.removeRecursiveTransaction(pid); - } else { - /** - * Case two: - * This transaction is more recursive calls. - * This is a nested call within an already started transaction, - * it can either be a async or a normal sync transaction. - */ - var slice = kthread.thread.sliceGroup.pushCompleteSlice('binder', - '' , ts, .03, 0, - 0, args); - - trans.slice = slice; - this.addTransactionWaitingForRecv(trans.transaction_key, trans); - } - return true; - }, - - modelPriorReceive: function(prior_receive, ts, pid, tgid, kthread, trans, - args, event) { - var callee_slice = prior_receive[1].slice; - var callee_trans = prior_receive[1]; - var recv_ts = prior_receive[0]; - var slice = kthread.thread.sliceGroup.pushCompleteSlice('binder', - '', recv_ts, ts - recv_ts, 0, 0, args); - - var flow = this.generateFlow(callee_slice, slice, callee_trans, trans); - this.model_.flowEvents.push(flow); - trans.slice = slice; - - if (trans.is_reply_transaction) { - /* This is a response to a synchronous or a recursive sync - * transaction. - */ - slice.title = 'binder reply'; - /* Notify this transaction key that when it recv's it is completing - * a sync transaction. - */ - this.addSyncTransNeedingCompletion(trans.transaction_key, - [callee_trans, trans]); - } else { - /** - * Recursive calls and or calls around, either way it's not - * going to complete a transaction. - */ - slice.title = 'binder reply'; - /* Since this is a recursive transaction we want to create the main - * large slice which will contain all these recursive transactions. - * For that we created the main slice above and this is a recursive - * transaction that will be placed right below it. Note, that this - * is only for the first recursive transaction. If more come they will - * be handled below in the getRecursiveTransactionNeedingCompletion - */ - var trans1 = new BinderTransaction(event, pid, ts, kthread); - - slice = kthread.thread.sliceGroup. - pushCompleteSlice('binder', - 'binder transaction', - recv_ts, - (ts - recv_ts), 0, - 0, args); - - /* could be a async trans if so set the length to be a small one */ - if (!trans.expect_reply) { - slice.title = 'binder transaction async'; - slice.duration = .03; - } else { - /* stupid hack to stop merging of AIDL slices and - * this slice. This is currently disabled, if AIDL tracing is on we - * will see merging of this slice and the AIDL slice. Once upstream - * has a solution for flow events to be placed in the middle of - * slices this part can be fixed. - * - * This is commented out because AIDL tracing doesn't exit yet. - */ - //slice.start += .15; - } - trans1.slice = slice; - this.addRecursiveSyncTransNeedingCompletion(pid, - [callee_trans, trans]); - this.addTransactionWaitingForRecv(trans.transaction_key, trans1); - } - return true; - }, - - getRecursiveTransactionNeedingCompletion: function(pid) { - if (this.recursiveSyncTransWaitingCompletion_ByPID[pid] === undefined) - return false; - - var len = this.recursiveSyncTransWaitingCompletion_ByPID[pid].length; - if (len === 0) - return false; - - return this.recursiveSyncTransWaitingCompletion_ByPID[pid][len - 1]; - }, - - addRecursiveSyncTransNeedingCompletion: function(pid, tuple) { - if (this.recursiveSyncTransWaitingCompletion_ByPID[pid] === undefined) - this.recursiveSyncTransWaitingCompletion_ByPID[pid] = []; - - this.recursiveSyncTransWaitingCompletion_ByPID[pid].push(tuple); - }, - - removeRecursiveTransaction: function(pid) { - var len = this.recursiveSyncTransWaitingCompletion_ByPID[pid].length; - if (len === 0) { - delete this.recursiveSyncTransWaitingCompletion_ByPID[pid]; - return; - } - - this.recursiveSyncTransWaitingCompletion_ByPID[pid].splice(len - 1, 1); - }, - - setCurrentReceiveOnPID: function(pid, tuple) { - if (this.receivedTransWaitingConversion[pid] === undefined) { - this.receivedTransWaitingConversion[pid] = []; - } - this.receivedTransWaitingConversion[pid].push(tuple); - }, - - getPriorReceiveOnPID: function(pid) { - if (this.receivedTransWaitingConversion[pid] === undefined) - return false; - - var len = this.receivedTransWaitingConversion[pid].length; - if (len === 0) - return false; - - return this.receivedTransWaitingConversion[pid].splice(len - 1, 1)[0]; - }, - - addSyncTransNeedingCompletion: function(transactionkey, tuple) { - var dict = this.syncTransWaitingCompletion; - dict[transactionkey] = tuple; - }, - - getSyncTransNeedsCompletion: function(transactionkey) { - var ret = this.syncTransWaitingCompletion[transactionkey]; - if (ret === undefined) - return false; - - delete this.syncTransWaitingCompletion[transactionkey]; - return ret; - }, - - getTransactionWaitingForRecv: function(transactionkey) { - var ret = this.transWaitingRecv[transactionkey]; - if (ret === undefined) - return false; - - delete this.transWaitingRecv[transactionkey]; - return ret; - }, - - addTransactionWaitingForRecv: function(transactionkey, transaction) { - this.transWaitingRecv[transactionkey] = transaction; - }, - - generateFlow: function(from, to, from_trans, to_trans) { - var title = 'Transaction from : ' + - this.pid2name(from_trans.calling_pid) + - ' From PID: ' + from_trans.calling_pid + ' to pid: ' + - to_trans.calling_pid + - ' Thread Name: ' + this.pid2name(to_trans.calling_pid); - - var ts = from.start; - var flow = new tr.model.FlowEvent('binder', 'binder', - title, 1, ts, []); - flow.startSlice = from; - flow.endSlice = to; - flow.start = from.start; - flow.duration = to.start - ts; - - from.outFlowEvents.push(flow); - to.inFlowEvents.push(flow); - - return flow; - }, - - generateArgsForSlice: function(tgid, pid, name, kthread) { - return { - 'Thread Name': name, - 'pid': pid, - 'gid': tgid - }; - }, - - pid2name: function(pid) { - return this.kthreadlookup[pid]; - }, - - doNameMappings: function(pid, tgid, name) { - this.registerPidName(pid, name); - this.registerPidName(tgid, name); - }, - - registerPidName: function(pid, name) { - if (this.pid2name(pid) === undefined) - this.kthreadlookup[pid] = name; - } - }; - - Parser.register(BinderParser); - return { - BinderParser: BinderParser - }; -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/binder_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/binder_parser_test.html deleted file mode 100644 index 513279adbea..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/binder_parser_test.html +++ /dev/null @@ -1,225 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - test('binderParserImport', function() { - var lines = [ - 'binderLibTest-10619 (10619) [001] ...1 25191.335749: binder_transaction' + - ': transaction=489053 dest_node=489048 dest_proc=10670 dest_thread=0 ' + - 'reply=0 flags=0x10 code=0xd', - 'binderLibTest-10670 (10670) [000] ...1 25191.335996:' + - ' binder_transaction_received: transaction=489053', - 'binderLibTest-10670 (10670) [000] ...1 25191.336167:' + - ' binder_transaction: transaction=489056 dest_node=161277 ' + - 'dest_proc=3454 dest_thread=0 reply=0 flags=0x10 code=0x2', - '/system/bin/servicemanager-3454 ( 3454) [000] ...1 25191.336199:' + - ' binder_transaction_received: transaction=489056', - '/system/bin/servicemanager-3454 ( 3454) [000] ...1 25191.336302:' + - ' binder_transaction: transaction=489057 dest_node=0 dest_proc=10670' + - ' dest_thread=10670 reply=1 flags=0x0 code=0x0', - 'binderLibTest-10670 (10670) [000] ...1 25191.336334:' + - ' binder_transaction_received: transaction=489057', - 'binderLibTest-10670 (10670) [000] ...1 25191.336655:' + - ' binder_transaction: transaction=489059 dest_node=488755' + - ' dest_proc=10622 dest_thread=0 reply=0 flags=0x10 code=0x1', - 'Binder_4-10645 (10622) [001] ...1 25191.336693:' + - ' binder_transaction_received: transaction=489059', - 'Binder_4-10645 (10622) [001] ...1 25191.336754: binder_transaction:' + - ' transaction=489060 dest_node=0 dest_proc=10670 dest_thread=10670' + - ' reply=1 flags=0x0 code=0x0', - 'binderLibTest-10670 (10670) [000] ...1 25191.337003:' + - ' binder_transaction_received: transaction=489060', - 'binderLibTest-10670 (10670) [000] ...1 25191.337052:' + - ' binder_transaction: transaction=489061 dest_node=0 dest_proc=10619' + - ' dest_thread=10619 reply=1 flags=0x8 code=0x0', - 'binderLibTest-10619 (10619) [001] ...1 25191.337085:' + - ' binder_transaction_received: transaction=489061', - 'atrace-10618 (10618) [000] ...1 25196.059954: tracing_mark_write:' + - ' trace_event_clock_sync: parent_ts=25196.050781' - ]; - - var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], { - shfitWorldToZero: false - }); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 4); - - }); - - test('binderRecursiveTest', function() { - var lines = [ - 'binderLibTest-10619 (10619) [001] ...1 25191.335749: binder_transaction' + - ': transaction=489053 dest_node=489048 dest_proc=10670 dest_thread=0 ' + - 'reply=0 flags=0x10 code=0xd', - 'binderLibTest-10670 (10670) [000] ...1 25191.335996:' + - ' binder_transaction_received: transaction=489053', - 'binderLibTest-10670 (10670) [000] ...1 25191.336167:' + - ' binder_transaction: transaction=489056 dest_node=161277 ' + - 'dest_proc=3454 dest_thread=0 reply=0 flags=0x10 code=0x2', - '/system/bin/servicemanager-3454 ( 3454) [000] ...1 25191.336199:' + - ' binder_transaction_received: transaction=489056', - '/system/bin/servicemanager-3454 ( 3454) [000] ...1 25191.336302:' + - ' binder_transaction: transaction=489057 dest_node=0 dest_proc=10670' + - ' dest_thread=10670 reply=1 flags=0x0 code=0x0', - 'binderLibTest-10670 (10670) [000] ...1 25191.336334:' + - ' binder_transaction_received: transaction=489057', - 'binderLibTest-10670 (10670) [000] ...1 25191.336655:' + - ' binder_transaction: transaction=489059 dest_node=488755' + - ' dest_proc=10622 dest_thread=0 reply=0 flags=0x10 code=0x1', - 'Binder_4-10645 (10622) [001] ...1 25191.336693:' + - ' binder_transaction_received: transaction=489059', - 'Binder_4-10645 (10622) [001] ...1 25191.336754: binder_transaction:' + - ' transaction=489060 dest_node=0 dest_proc=10670 dest_thread=10670' + - ' reply=1 flags=0x0 code=0x0', - 'binderLibTest-10670 (10670) [000] ...1 25191.337003:' + - ' binder_transaction_received: transaction=489060', - 'binderLibTest-10670 (10670) [000] ...1 25191.337052:' + - ' binder_transaction: transaction=489061 dest_node=0 dest_proc=10619' + - ' dest_thread=10619 reply=1 flags=0x8 code=0x0', - 'binderLibTest-10619 (10619) [001] ...1 25191.337085:' + - ' binder_transaction_received: transaction=489061', - 'atrace-10618 (10618) [000] ...1 25196.059954: tracing_mark_write:' + - ' trace_event_clock_sync: parent_ts=25196.050781' - ]; - - var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], { - shfitWorldToZero: false - }); - var threads = m.getAllThreads(); - - var thread = threads[0]; - assert.equal(thread.parent.pid, 3454); - assert.equal(thread.tid, 3454); - assert.equal(thread.name, '/system/bin/servicemanager'); - /* one main slice and one 'internal slice' for the end flow event' */ - assert.equal(thread.sliceGroup.length, 2); - - /* check flow events for service manager */ - var main_slice = thread.sliceGroup.slices[0]; - assert.equal(main_slice.inFlowEvents.length, 1); - assert.equal(main_slice.outFlowEvents.length, 1); - var internal_slice = thread.sliceGroup.slices[1]; - assert.equal(internal_slice.outFlowEvents.length, 1); - - /* check name of slice */ - assert.equal(main_slice.title, 'binder reply'); - - /* check binderLibTest */ - thread = threads[1]; - assert.equal(thread.parent.pid, 10619); - assert.equal(thread.tid, 10619); - assert.equal(thread.name, 'binderLibTest'); - - assert.equal(2, thread.sliceGroup.length); - - main_slice = thread.sliceGroup.slices[0]; - assert.equal(main_slice.inFlowEvents.length, 1); - assert.equal(main_slice.outFlowEvents.length, 1); - internal_slice = thread.sliceGroup.slices[1]; - assert.equal(internal_slice.inFlowEvents.length, 1); - - assert.equal(main_slice.title, 'binder transaction'); - - /* check Binder_4 */ - thread = threads[2]; - assert.equal(thread.parent.pid, 10622); - assert.equal(thread.tid, 10645); - assert.equal(thread.name, 'Binder_4'); - assert.equal(2, thread.sliceGroup.length); - - main_slice = thread.sliceGroup.slices[0]; - assert.equal(main_slice.inFlowEvents.length, 1); - assert.equal(main_slice.outFlowEvents.length, 1); - internal_slice = thread.sliceGroup.slices[1]; - assert.equal(internal_slice.outFlowEvents.length, 1); - - assert.equal(main_slice.title, 'binder reply'); - - /* check last binderLibTest with recursive slices */ - thread = threads[3]; - assert.equal(thread.parent.pid, 10670); - assert.equal(thread.tid, 10670); - assert.equal(thread.name, 'binderLibTest'); - assert.equal(6, thread.sliceGroup.length); - - main_slice = thread.sliceGroup.slices[0]; - assert.equal(main_slice.inFlowEvents.length, 1); - assert.equal(main_slice.outFlowEvents.length, 1); - internal_slice = thread.sliceGroup.slices[5]; - assert.equal(internal_slice.outFlowEvents.length, 1); - - assert.equal(main_slice.title, 'binder reply'); - - var recursive = thread.sliceGroup.slices[1]; - var recursive_internal = thread.sliceGroup.slices[2]; - assert.equal(recursive.inFlowEvents.length, 1); - assert.equal(recursive.outFlowEvents.length, 1); - assert.equal(recursive_internal.inFlowEvents.length, 1); - - assert.equal(recursive.title, 'binder transaction'); - - /* check second recursive slice and internal */ - - var recursive = thread.sliceGroup.slices[3]; - var recursive_internal = thread.sliceGroup.slices[4]; - assert.equal(recursive.inFlowEvents.length, 1); - assert.equal(recursive.outFlowEvents.length, 1); - assert.equal(recursive_internal.inFlowEvents.length, 1); - - assert.equal(recursive.title, 'binder transaction'); - }); - - test('binderSimpleAsync', function() { - var lines = [ - '/system/bin/surfaceflinger-3462 ( 3462) [000] ...1 108286.109437:' + - ' binder_transaction: transaction=923419 dest_node=175950' + - ' dest_proc=4044 dest_thread=0 reply=0 flags=0x11 code=0x1', - 'Binder_5-12869 ( 4044) [000] ...1 108286.109835:' + - ' binder_transaction_received: transaction=923419' - ]; - - var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], { - shfitWorldToZero: false - }); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(0); - assert.equal(threads.length, 2); - - var thread = threads[0]; - assert.equal(thread.tid, 3462); - assert.equal(thread.name, '/system/bin/surfaceflinger'); - assert.equal(thread.sliceGroup.length, 1); - - var slice = thread.sliceGroup.slices[0]; - assert.equal(slice.outFlowEvents.length, 1); - assert.equal(slice.inFlowEvents.length, 0); - assert.equal(slice.title, 'binder transaction async'); - - thread = threads[1]; - assert.equal(thread.tid, 12869); - assert.equal(thread.name, 'Binder_5'); - assert.equal(thread.sliceGroup.length, 1); - - slice = thread.sliceGroup.slices[0]; - assert.equal(slice.inFlowEvents.length, 1); - assert.equal(slice.outFlowEvents.length, 0); - assert.equal(slice.title, 'binder Async recv'); - - }); -}); - -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/bus_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/bus_parser.html deleted file mode 100644 index 55d80730405..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/bus_parser.html +++ /dev/null @@ -1,90 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> -<link rel="import" href="/tracing/model/counter_series.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses trace_marker events that were inserted in the trace by - * userland. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - var ColorScheme = tr.b.ColorScheme; - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses linux trace mark events that were inserted in the trace by userland. - * @constructor - */ - function BusParser(importer) { - Parser.call(this, importer); - - importer.registerEventHandler('memory_bus_usage', - BusParser.prototype.traceMarkWriteBusEvent.bind(this)); - - this.model_ = importer.model_; - this.ppids_ = {}; - } - - BusParser.prototype = { - __proto__: Parser.prototype, - - traceMarkWriteBusEvent: function(eventName, cpuNumber, pid, ts, - eventBase, threadName) { - var re = new RegExp('bus=(\\S+) rw_bytes=(\\d+) r_bytes=(\\d+) ' + - 'w_bytes=(\\d+) cycles=(\\d+) ns=(\\d+)'); - var event = re.exec(eventBase.details); - - var name = event[1]; - var rw_bytes = parseInt(event[2]); - var r_bytes = parseInt(event[3]); - var w_bytes = parseInt(event[4]); - var cycles = parseInt(event[5]); - var ns = parseInt(event[6]); - - // BW in MB/s - var r_bw = r_bytes * 1000000000 / ns; - r_bw /= 1024 * 1024; - var w_bw = w_bytes * 1000000000 / ns; - w_bw /= 1024 * 1024; - - var ctr = this.model_.kernel - .getOrCreateCounter(null, 'bus ' + name + ' read'); - if (ctr.numSeries === 0) { - ctr.addSeries(new tr.model.CounterSeries('value', - ColorScheme.getColorIdForGeneralPurposeString( - ctr.name + '.' + 'value'))); - } - ctr.series.forEach(function(series) { - series.addCounterSample(ts, r_bw); - }); - - ctr = this.model_.kernel - .getOrCreateCounter(null, 'bus ' + name + ' write'); - if (ctr.numSeries === 0) { - ctr.addSeries(new tr.model.CounterSeries('value', - ColorScheme.getColorIdForGeneralPurposeString( - ctr.name + '.' + 'value'))); - } - ctr.series.forEach(function(series) { - series.addCounterSample(ts, r_bw); - }); - - return true; - } - }; - - Parser.register(BusParser); - - return { - BusParser: BusParser - }; -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/bus_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/bus_parser_test.html deleted file mode 100644 index 6222067d64c..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/bus_parser_test.html +++ /dev/null @@ -1,68 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - test('exynos5Bus', function() { - var lines = [ - 's3c-fb-vsync-85 [001] d..2 8116.730115: memory_bus_usage: ' + - 'bus=RIGHT rw_bytes=0 r_bytes=0 w_bytes=0 cycles=2681746 ns=16760792', - - 's3c-fb-vsync-85 [001] d..2 8116.730118: memory_bus_usage: ' + - 'bus=CPU rw_bytes=2756608 r_bytes=2267328 w_bytes=491328 ' + - 'cycles=6705198 ns=16763375', - - 's3c-fb-vsync-85 [001] d..2 8116.746788: memory_bus_usage: ' + - 'bus=DDR_C rw_bytes=2736128 r_bytes=2260864 w_bytes=479248 ' + - 'cycles=6670677 ns=16676375', - - 's3c-fb-vsync-85 [001] d..2 8116.746790: memory_bus_usage: ' + - 'bus=DDR_R1 rw_bytes=31457280 r_bytes=31460912 w_bytes=0 ' + - 'cycles=6670521 ns=16676500', - - 's3c-fb-vsync-85 [001] d..2 8116.746792: memory_bus_usage: ' + - 'bus=DDR_L rw_bytes=16953344 r_bytes=16731088 w_bytes=223664 ' + - 'cycles=6669885 ns=16674833', - - 's3c-fb-vsync-85 [001] d..2 8116.746793: memory_bus_usage: ' + - 'bus=RIGHT rw_bytes=0 r_bytes=0 w_bytes=0 cycles=2667378 ns=16671250', - - 's3c-fb-vsync-85 [001] d..2 8116.746798: memory_bus_usage: ' + - 'bus=CPU rw_bytes=2797568 r_bytes=2309424 w_bytes=491968 ' + - 'cycles=6672156 ns=16680458', - - 's3c-fb-vsync-85 [001] d..2 8116.763521: memory_bus_usage: ' + - 'bus=DDR_C rw_bytes=2408448 r_bytes=1968448 w_bytes=441456 ' + - 'cycles=6689562 ns=16723458', - - 's3c-fb-vsync-85 [001] d..2 8116.763523: memory_bus_usage: ' + - 'bus=DDR_R1 rw_bytes=31490048 r_bytes=31493360 w_bytes=0 ' + - 'cycles=6690012 ns=16725083', - - 's3c-fb-vsync-85 [001] d..2 8116.763525: memory_bus_usage: ' + - 'bus=DDR_L rw_bytes=16941056 r_bytes=16719136 w_bytes=223472 ' + - 'cycles=6690156 ns=16725375' - - ]; - var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], { - shiftWorldToZero: false - }); - assert.isFalse(m.hasImportWarnings); - - var counters = m.getAllCounters(); - assert.equal(counters.length, 10); - - assert.equal(counters[0].series[0].samples.length, 2); - }); -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/clock_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/clock_parser.html deleted file mode 100644 index 41c12d7f0c3..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/clock_parser.html +++ /dev/null @@ -1,70 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> -<link rel="import" href="/tracing/model/counter_series.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses trace_marker events that were inserted in the trace by - * userland. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - - var ColorScheme = tr.b.ColorScheme; - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses linux trace mark events that were inserted in the trace by userland. - * @constructor - */ - function ClockParser(importer) { - Parser.call(this, importer); - - importer.registerEventHandler('clock_set_rate', - ClockParser.prototype.traceMarkWriteClockEvent.bind(this)); - - this.model_ = importer.model_; - this.ppids_ = {}; - } - - ClockParser.prototype = { - __proto__: Parser.prototype, - - traceMarkWriteClockEvent: function(eventName, cpuNumber, pid, ts, - eventBase, threadName) { - var event = /(\S+) state=(\d+) cpu_id=(\d+)/.exec(eventBase.details); - - - var name = event[1]; - var rate = parseInt(event[2]); - - var ctr = this.model_.kernel - .getOrCreateCounter(null, name); - // Initialize the counter's series fields if needed. - if (ctr.numSeries === 0) { - ctr.addSeries(new tr.model.CounterSeries('value', - ColorScheme.getColorIdForGeneralPurposeString( - ctr.name + '.' + 'value'))); - } - ctr.series.forEach(function(series) { - series.addCounterSample(ts, rate); - }); - - return true; - } - }; - - Parser.register(ClockParser); - - return { - ClockParser: ClockParser - }; -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/clock_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/clock_parser_test.html deleted file mode 100644 index a348fe07cbc..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/clock_parser_test.html +++ /dev/null @@ -1,60 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - test('clock', function() { - var lines = [ - 'cfinteractive-23 [000] d..2 8113.233768: clock_set_rate: ' + - 'fout_apll state=500000000 cpu_id=0', - - 'cfinteractive-23 [000] d..2 8113.249509: clock_set_rate: ' + - 'fout_apll state=300000000 cpu_id=0', - - 'cfinteractive-23 [000] d..2 8113.289796: clock_set_rate: ' + - 'fout_apll state=400000000 cpu_id=0', - - 'cfinteractive-23 [000] d..2 8113.294568: clock_set_rate: ' + - 'fout_apll state=500000000 cpu_id=0', - - 'cfinteractive-23 [000] d..2 8113.309509: clock_set_rate: ' + - 'fout_apll state=800000000 cpu_id=0', - - 'cfinteractive-23 [000] d..2 8113.388732: clock_set_rate: ' + - 'fout_apll state=200000000 cpu_id=0', - - 'cfinteractive-23 [000] d..2 8113.410182: clock_set_rate: ' + - 'fout_apll state=300000000 cpu_id=0', - - 'cfinteractive-23 [000] d..2 8113.414872: clock_set_rate: ' + - 'fout_apll state=600000000 cpu_id=0', - - 'cfinteractive-23 [000] d..2 8113.494455: clock_set_rate: ' + - 'fout_apll state=200000000 cpu_id=0', - - 'cfinteractive-23 [000] d..2 8113.515254: clock_set_rate: ' + - 'fout_apll state=500000000 cpu_id=0' - ]; - - var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], { - shiftWorldToZero: false - }); - assert.isFalse(m.hasImportWarnings); - - var counters = m.getAllCounters(); - assert.equal(counters.length, 1); - - assert.equal(counters[0].series[0].samples.length, 10); - }); -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/cpufreq_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/cpufreq_parser.html deleted file mode 100644 index cd7f357c8e5..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/cpufreq_parser.html +++ /dev/null @@ -1,115 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses cpufreq events in the Linux event trace format. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - - var ColorScheme = tr.b.ColorScheme; - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses linux cpufreq trace events. - * @constructor - */ - function CpufreqParser(importer) { - Parser.call(this, importer); - - importer.registerEventHandler('cpufreq_interactive_up', - CpufreqParser.prototype.cpufreqUpDownEvent.bind(this)); - importer.registerEventHandler('cpufreq_interactive_down', - CpufreqParser.prototype.cpufreqUpDownEvent.bind(this)); - importer.registerEventHandler('cpufreq_interactive_already', - CpufreqParser.prototype.cpufreqTargetEvent.bind(this)); - importer.registerEventHandler('cpufreq_interactive_notyet', - CpufreqParser.prototype.cpufreqTargetEvent.bind(this)); - importer.registerEventHandler('cpufreq_interactive_setspeed', - CpufreqParser.prototype.cpufreqTargetEvent.bind(this)); - importer.registerEventHandler('cpufreq_interactive_target', - CpufreqParser.prototype.cpufreqTargetEvent.bind(this)); - importer.registerEventHandler('cpufreq_interactive_boost', - CpufreqParser.prototype.cpufreqBoostUnboostEvent.bind(this)); - importer.registerEventHandler('cpufreq_interactive_unboost', - CpufreqParser.prototype.cpufreqBoostUnboostEvent.bind(this)); - } - - function splitData(input) { - // TODO(sleffler) split by cpu - var data = {}; - var args = input.split(/\s+/); - var len = args.length; - for (var i = 0; i < len; i++) { - var item = args[i].split('='); - data[item[0]] = parseInt(item[1]); - } - return data; - } - - CpufreqParser.prototype = { - __proto__: Parser.prototype, - - cpufreqSlice: function(ts, eventName, cpu, args) { - // TODO(sleffler) should be per-cpu - var kthread = this.importer.getOrCreatePseudoThread('cpufreq'); - kthread.openSlice = eventName; - var slice = new tr.model.Slice('', kthread.openSlice, - ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice), - ts, args, 0); - - kthread.thread.sliceGroup.pushSlice(slice); - }, - - cpufreqBoostSlice: function(ts, eventName, args) { - var kthread = this.importer.getOrCreatePseudoThread('cpufreq_boost'); - kthread.openSlice = eventName; - var slice = new tr.model.Slice('', kthread.openSlice, - ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice), - ts, args, 0); - - kthread.thread.sliceGroup.pushSlice(slice); - }, - - /** - * Parses cpufreq events and sets up state in the importer. - */ - cpufreqUpDownEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var data = splitData(eventBase.details); - this.cpufreqSlice(ts, eventName, data.cpu, data); - return true; - }, - - cpufreqTargetEvent: function(eventName, cpuNumber, pid, ts, - eventBase) { - var data = splitData(eventBase.details); - this.cpufreqSlice(ts, eventName, data.cpu, data); - return true; - }, - - cpufreqBoostUnboostEvent: function(eventName, cpuNumber, pid, ts, - eventBase) { - this.cpufreqBoostSlice(ts, eventName, - { - type: eventBase.details - }); - return true; - } - }; - - Parser.register(CpufreqParser); - - return { - CpufreqParser: CpufreqParser - }; -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/cpufreq_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/cpufreq_parser_test.html deleted file mode 100644 index 114b8aa4c1a..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/cpufreq_parser_test.html +++ /dev/null @@ -1,173 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - function newModel(events) { - return tr.c.TestUtils.newModelWithEvents([events], { - shiftWorldToZero: false - }); - } - - test('cpuFreqTargetImport', function() { - var lines = [ - '<idle>-0 [000] ..s3 1043.718825: cpufreq_interactive_target: ' + - 'cpu=0 load=2 cur=2000000 targ=300000\n', - '<idle>-0 [000] ..s3 1043.718825: cpufreq_interactive_target: ' + - 'cpu=0 load=12 cur=1000000 actual=1000000 targ=200000\n' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var thread = threads[0]; - assert.equal(thread.sliceGroup.slices[0].args['cpu'], 0); - assert.equal(thread.sliceGroup.slices[0].args['load'], 2); - assert.equal(thread.sliceGroup.slices[0].args['cur'], 2000000); - assert.equal(thread.sliceGroup.slices[0].args['targ'], 300000); - - assert.equal(thread.sliceGroup.slices[1].args['cpu'], 0); - assert.equal(thread.sliceGroup.slices[1].args['load'], 12); - assert.equal(thread.sliceGroup.slices[1].args['cur'], 1000000); - assert.equal(thread.sliceGroup.slices[1].args['actual'], 1000000); - assert.equal(thread.sliceGroup.slices[1].args['targ'], 200000); - }); - - test('cpuFreqNotYetImport', function() { - var lines = [ - '<idle>-0 [001] ..s3 1043.718832: cpufreq_interactive_notyet: ' + - 'cpu=1 load=10 cur=700000 targ=200000\n', - '<idle>-0 [001] ..s3 1043.718832: cpufreq_interactive_notyet: ' + - 'cpu=1 load=10 cur=700000 actual=1000000 targ=200000\n' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var thread = threads[0]; - assert.equal(thread.sliceGroup.slices[0].args['cpu'], 1); - assert.equal(thread.sliceGroup.slices[0].args['load'], 10); - assert.equal(thread.sliceGroup.slices[0].args['cur'], 700000); - assert.equal(thread.sliceGroup.slices[0].args['targ'], 200000); - - assert.equal(thread.sliceGroup.slices[1].args['cpu'], 1); - assert.equal(thread.sliceGroup.slices[1].args['load'], 10); - assert.equal(thread.sliceGroup.slices[1].args['cur'], 700000); - assert.equal(thread.sliceGroup.slices[1].args['actual'], 1000000); - assert.equal(thread.sliceGroup.slices[1].args['targ'], 200000); - }); - - test('cpuFreqSetSpeedImport', function() { - var lines = [ - 'cfinteractive-23 [001] ...1 1043.719688: ' + - 'cpufreq_interactive_setspeed: cpu=0 targ=200000 actual=700000\n' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var thread = threads[0]; - assert.equal(thread.sliceGroup.slices[0].args['cpu'], 0); - assert.equal(thread.sliceGroup.slices[0].args['targ'], 200000); - assert.equal(thread.sliceGroup.slices[0].args['actual'], 700000); - }); - - test('cpuFreqAlreadyImport', function() { - var lines = [ - '<idle>-0 [000] ..s3 1043.738822: cpufreq_interactive_already: cpu=0 load=18 cur=200000 actual=700000 targ=200000\n' // @suppress longLineCheck - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var thread = threads[0]; - assert.equal(thread.sliceGroup.slices[0].args['cpu'], 0); - assert.equal(thread.sliceGroup.slices[0].args['load'], 18); - assert.equal(thread.sliceGroup.slices[0].args['cur'], 200000); - assert.equal(thread.sliceGroup.slices[0].args['actual'], 700000); - assert.equal(thread.sliceGroup.slices[0].args['targ'], 200000); - }); - - test('cpuFreqBoostImport', function() { - var lines = [ - 'InputDispatcher-465 [001] ...1 1044.213948: ' + - 'cpufreq_interactive_boost: pulse\n' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var thread = threads[0]; - assert.equal(thread.sliceGroup.slices[0].args['type'], 'pulse'); - }); - - test('cpuFreqUnBoostImport', function() { - var lines = [ - 'InputDispatcher-465 [001] ...1 1044.213948: ' + - 'cpufreq_interactive_unboost: pulse\n' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var thread = threads[0]; - assert.equal(thread.sliceGroup.slices[0].args['type'], 'pulse'); - }); - - test('cpuFreqUpImport', function() { - var lines = [ - 'kinteractive-69 [003] .... 414324.164432: ' + - 'cpufreq_interactive_up: cpu=1 targ=1400000 actual=800000' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var thread = threads[0]; - assert.equal(thread.sliceGroup.slices[0].args['cpu'], 1); - assert.equal(thread.sliceGroup.slices[0].args['targ'], 1400000); - assert.equal(thread.sliceGroup.slices[0].args['actual'], 800000); - }); - - test('cpuFreqDownImport', function() { - var lines = [ - 'kinteractive-69 [003] .... 414365.834193: ' + - 'cpufreq_interactive_down: cpu=3 targ=800000 actual=1000000' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var thread = threads[0]; - assert.equal(thread.sliceGroup.slices[0].args['cpu'], 3); - assert.equal(thread.sliceGroup.slices[0].args['targ'], 800000); - assert.equal(thread.sliceGroup.slices[0].args['actual'], 1000000); - }); -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/disk_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/disk_parser.html deleted file mode 100644 index bbbeae733f3..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/disk_parser.html +++ /dev/null @@ -1,313 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses filesystem and block device events in the Linux event - * trace format. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - - var ColorScheme = tr.b.ColorScheme; - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses linux filesystem and block device trace events. - * @constructor - */ - function DiskParser(importer) { - Parser.call(this, importer); - - importer.registerEventHandler('f2fs_write_begin', - DiskParser.prototype.f2fsWriteBeginEvent.bind(this)); - importer.registerEventHandler('f2fs_write_end', - DiskParser.prototype.f2fsWriteEndEvent.bind(this)); - importer.registerEventHandler('f2fs_sync_file_enter', - DiskParser.prototype.f2fsSyncFileEnterEvent.bind(this)); - importer.registerEventHandler('f2fs_sync_file_exit', - DiskParser.prototype.f2fsSyncFileExitEvent.bind(this)); - importer.registerEventHandler('ext4_sync_file_enter', - DiskParser.prototype.ext4SyncFileEnterEvent.bind(this)); - importer.registerEventHandler('ext4_sync_file_exit', - DiskParser.prototype.ext4SyncFileExitEvent.bind(this)); - importer.registerEventHandler('ext4_da_write_begin', - DiskParser.prototype.ext4WriteBeginEvent.bind(this)); - importer.registerEventHandler('ext4_da_write_end', - DiskParser.prototype.ext4WriteEndEvent.bind(this)); - importer.registerEventHandler('block_rq_issue', - DiskParser.prototype.blockRqIssueEvent.bind(this)); - importer.registerEventHandler('block_rq_complete', - DiskParser.prototype.blockRqCompleteEvent.bind(this)); - } - - DiskParser.prototype = { - __proto__: Parser.prototype, - - openAsyncSlice: function(ts, category, threadName, pid, key, name) { - var kthread = this.importer.getOrCreateKernelThread( - category + ':' + threadName, pid); - var asyncSliceConstructor = - tr.model.AsyncSlice.getConstructor( - category, name); - var slice = new asyncSliceConstructor( - category, name, - ColorScheme.getColorIdForGeneralPurposeString(name), - ts); - slice.startThread = kthread.thread; - - if (!kthread.openAsyncSlices) { - kthread.openAsyncSlices = { }; - } - kthread.openAsyncSlices[key] = slice; - }, - - closeAsyncSlice: function(ts, category, threadName, pid, key, args) { - var kthread = this.importer.getOrCreateKernelThread( - category + ':' + threadName, pid); - if (kthread.openAsyncSlices) { - var slice = kthread.openAsyncSlices[key]; - if (slice) { - slice.duration = ts - slice.start; - slice.args = args; - slice.endThread = kthread.thread; - slice.subSlices = [ - new tr.model.AsyncSlice(category, slice.title, - slice.colorId, slice.start, slice.args, slice.duration) - ]; - kthread.thread.asyncSliceGroup.push(slice); - delete kthread.openAsyncSlices[key]; - } - } - }, - - /** - * Parses events and sets up state in the importer. - */ - f2fsWriteBeginEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /dev = \((\d+,\d+)\), ino = (\d+), pos = (\d+), len = (\d+), flags = (\d+)/. // @suppress longLineCheck - exec(eventBase.details); - if (!event) - return false; - var device = event[1]; - var inode = parseInt(event[2]); - var pos = parseInt(event[3]); - var len = parseInt(event[4]); - var key = device + '-' + inode + '-' + pos + '-' + len; - this.openAsyncSlice(ts, 'f2fs', eventBase.threadName, eventBase.pid, - key, 'f2fs_write'); - return true; - }, - - f2fsWriteEndEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /dev = \((\d+,\d+)\), ino = (\d+), pos = (\d+), len = (\d+), copied = (\d+)/. // @suppress longLineCheck - exec(eventBase.details); - if (!event) - return false; - - var device = event[1]; - var inode = parseInt(event[2]); - var pos = parseInt(event[3]); - var len = parseInt(event[4]); - var error = parseInt(event[5]) !== len; - var key = device + '-' + inode + '-' + pos + '-' + len; - this.closeAsyncSlice(ts, 'f2fs', eventBase.threadName, eventBase.pid, - key, { - device: device, - inode: inode, - error: error - }); - return true; - }, - - ext4WriteBeginEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /dev (\d+,\d+) ino (\d+) pos (\d+) len (\d+) flags (\d+)/. - exec(eventBase.details); - if (!event) - return false; - var device = event[1]; - var inode = parseInt(event[2]); - var pos = parseInt(event[3]); - var len = parseInt(event[4]); - var key = device + '-' + inode + '-' + pos + '-' + len; - this.openAsyncSlice(ts, 'ext4', eventBase.threadName, eventBase.pid, - key, 'ext4_write'); - return true; - }, - - ext4WriteEndEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /dev (\d+,\d+) ino (\d+) pos (\d+) len (\d+) copied (\d+)/. - exec(eventBase.details); - if (!event) - return false; - - var device = event[1]; - var inode = parseInt(event[2]); - var pos = parseInt(event[3]); - var len = parseInt(event[4]); - var error = parseInt(event[5]) !== len; - var key = device + '-' + inode + '-' + pos + '-' + len; - this.closeAsyncSlice(ts, 'ext4', eventBase.threadName, eventBase.pid, - key, { - device: device, - inode: inode, - error: error - }); - return true; - }, - - f2fsSyncFileEnterEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = new RegExp( - 'dev = \\((\\d+,\\d+)\\), ino = (\\d+), pino = (\\d+), i_mode = (\\S+), ' + // @suppress longLineCheck - 'i_size = (\\d+), i_nlink = (\\d+), i_blocks = (\\d+), i_advise = (\\d+)'). // @suppress longLineCheck - exec(eventBase.details); - if (!event) - return false; - - var device = event[1]; - var inode = parseInt(event[2]); - var key = device + '-' + inode; - this.openAsyncSlice(ts, 'f2fs', eventBase.threadName, eventBase.pid, - key, 'fsync'); - return true; - }, - - f2fsSyncFileExitEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = new RegExp('dev = \\((\\d+,\\d+)\\), ino = (\\d+), checkpoint is (\\S+), ' + // @suppress longLineCheck - 'datasync = (\\d+), ret = (\\d+)'). - exec(eventBase.details.replace('not needed', 'not_needed')); - if (!event) - return false; - - var device = event[1]; - var inode = parseInt(event[2]); - var error = parseInt(event[5]); - var key = device + '-' + inode; - this.closeAsyncSlice(ts, 'f2fs', eventBase.threadName, eventBase.pid, - key, { - device: device, - inode: inode, - error: error - }); - return true; - }, - - ext4SyncFileEnterEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /dev (\d+,\d+) ino (\d+) parent (\d+) datasync (\d+)/. - exec(eventBase.details); - if (!event) - return false; - - var device = event[1]; - var inode = parseInt(event[2]); - var datasync = event[4] == 1; - var key = device + '-' + inode; - var action = datasync ? 'fdatasync' : 'fsync'; - this.openAsyncSlice(ts, 'ext4', eventBase.threadName, eventBase.pid, - key, action); - return true; - }, - - ext4SyncFileExitEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /dev (\d+,\d+) ino (\d+) ret (\d+)/.exec(eventBase.details); - if (!event) - return false; - - var device = event[1]; - var inode = parseInt(event[2]); - var error = parseInt(event[3]); - var key = device + '-' + inode; - this.closeAsyncSlice(ts, 'ext4', eventBase.threadName, eventBase.pid, - key, { - device: device, - inode: inode, - error: error - }); - return true; - }, - - blockRqIssueEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = new RegExp('(\\d+,\\d+) (F)?([DWRN])(F)?(A)?(S)?(M)? ' + - '\\d+ \\(.*\\) (\\d+) \\+ (\\d+) \\[.*\\]').exec(eventBase.details); - if (!event) - return false; - - var action; - switch (event[3]) { - case 'D': - action = 'discard'; - break; - case 'W': - action = 'write'; - break; - case 'R': - action = 'read'; - break; - case 'N': - action = 'none'; - break; - default: - action = 'unknown'; - break; - } - - if (event[2]) { - action += ' flush'; - } - if (event[4] == 'F') { - action += ' fua'; - } - if (event[5] == 'A') { - action += ' ahead'; - } - if (event[6] == 'S') { - action += ' sync'; - } - if (event[7] == 'M') { - action += ' meta'; - } - var device = event[1]; - var sector = parseInt(event[8]); - var numSectors = parseInt(event[9]); - var key = device + '-' + sector + '-' + numSectors; - this.openAsyncSlice(ts, 'block', eventBase.threadName, eventBase.pid, - key, action); - return true; - }, - - blockRqCompleteEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = new RegExp('(\\d+,\\d+) (F)?([DWRN])(F)?(A)?(S)?(M)? ' + - '\\(.*\\) (\\d+) \\+ (\\d+) \\[(.*)\\]').exec(eventBase.details); - if (!event) - return false; - - var device = event[1]; - var sector = parseInt(event[8]); - var numSectors = parseInt(event[9]); - var error = parseInt(event[10]); - var key = device + '-' + sector + '-' + numSectors; - this.closeAsyncSlice(ts, 'block', eventBase.threadName, eventBase.pid, - key, { - device: device, - sector: sector, - numSectors: numSectors, - error: error - }); - return true; - } - }; - - Parser.register(DiskParser); - - return { - DiskParser: DiskParser - }; -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/disk_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/disk_parser_test.html deleted file mode 100644 index c2e9a14deab..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/disk_parser_test.html +++ /dev/null @@ -1,119 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - test('diskImport', function() { - var lines = [ - // NB: spliced from different traces; mismatched timestamps don't matter - 'AsyncTask #2-18830 [000] ...1 154578.668286: ext4_sync_file_enter: ' + - 'dev 259,1 ino 81993 parent 81906 datasync 1', - 'Binder_A-3179 [001] ...1 1354.510088: f2fs_sync_file_enter: ' + - 'dev = (259,14), ino = 4882, pino = 313, i_mode = 0x81b0, i_size = ' + - '25136, i_nlink = 1, i_blocks = 8, i_advise = 0x0', - 'Binder_A-3179 [001] ...1 1354.514013: f2fs_sync_file_exit: ' + - 'dev = (259,14), ino = 4882, checkpoint is not needed, datasync = 1, ret = 0', // @suppress longLineCheck - 'mmcqd/0-81 [000] d..2 154578.668390: block_rq_issue: ' + - '179,0 WS 0 () 3427120 + 16 [mmcqd/0]', - 'mmcqd/0-81 [000] d..2 154578.669181: block_rq_complete: ' + - '179,0 WS () 3427120 + 16 [0]', - 'mmcqd/0-81 [001] d..2 154578.670853: block_rq_issue: ' + - '179,0 FWS 0 () 18446744073709551615 + 0 [mmcqd/0]', - 'mmcqd/0-81 [001] d..2 154578.670869: block_rq_complete: ' + - '179,0 FWS () 18446744073709551615 + 0 [0]', - 'AsyncTask #2-18830 [001] ...1 154578.670901: ext4_sync_file_exit: ' + - 'dev 259,1 ino 81993 ret 0', - 'mmcqd/0-81 [001] d..2 154578.877038: block_rq_issue: ' + - '179,0 R 0 () 3255256 + 8 [mmcqd/0]', - 'mmcqd/0-81 [001] d..2 154578.877110: block_rq_issue: ' + - '179,0 R 0 () 3255288 + 8 [mmcqd/0]', - 'mmcqd/0-81 [000] d..2 154578.877345: block_rq_complete: ' + - '179,0 R () 3255256 + 8 [0]', - 'mmcqd/0-81 [000] d..2 154578.877466: block_rq_complete: ' + - '179,0 R () 3255288 + 8 [0]', - 'ContactsProvide-1184 [000] ...1 66.613719: f2fs_write_begin: ' + - 'dev = (253,2), ino = 3342, pos = 0, len = 75, flags = 0', - 'ContactsProvide-1184 [000] ...1 66.613733: f2fs_write_end: ' + - 'dev = (253,2), ino = 3342, pos = 0, len = 75, copied = 75' - ]; - var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], { - shiftWorldToZero: false - }); - assert.isFalse(m.hasImportWarnings); - - var blockThread = undefined; - var ext4Thread = undefined; - var f2fsSyncThread = undefined; - var f2fsWriteThread = undefined; - - m.getAllThreads().forEach(function(t) { - switch (t.name) { - case 'block:mmcqd/0': - blockThread = t; - break; - case 'ext4:AsyncTask #2': - ext4Thread = t; - break; - case 'f2fs:Binder_A': - f2fsSyncThread = t; - break; - case 'f2fs:ContactsProvide': - f2fsWriteThread = t; - break; - default: - throw new unittest.TestError('Unexpected thread named ' + t.name); - } - }); - assert.isDefined(blockThread); - assert.isDefined(ext4Thread); - assert.isDefined(f2fsSyncThread); - assert.isDefined(f2fsWriteThread); - - assert.equal(blockThread.asyncSliceGroup.length, 4); - - var slice = blockThread.asyncSliceGroup.slices[0]; - assert.equal(slice.category, 'block'); - assert.equal(slice.title, 'write sync'); - assert.equal(slice.args.device, '179,0'); - assert.equal(slice.args.error, 0); - assert.equal(slice.args.numSectors, 16); - assert.equal(slice.args.sector, 3427120); - - assert.equal(ext4Thread.asyncSliceGroup.length, 1); - - slice = ext4Thread.asyncSliceGroup.slices[0]; - assert.equal(slice.category, 'ext4'); - assert.equal(slice.title, 'fdatasync'); - assert.equal(slice.args.device, '259,1'); - assert.equal(slice.args.error, 0); - assert.equal(slice.args.inode, 81993); - - assert.equal(f2fsSyncThread.asyncSliceGroup.length, 1); - - slice = f2fsSyncThread.asyncSliceGroup.slices[0]; - assert.equal(slice.category, 'f2fs'); - assert.equal(slice.title, 'fsync'); - assert.equal(slice.args.device, '259,14'); - assert.equal(slice.args.error, 0); - assert.equal(slice.args.inode, 4882); - - assert.equal(f2fsWriteThread.asyncSliceGroup.length, 1); - - slice = f2fsWriteThread.asyncSliceGroup.slices[0]; - assert.equal(slice.category, 'f2fs'); - assert.equal(slice.title, 'f2fs_write'); - assert.equal(slice.args.device, '253,2'); - assert.equal(slice.args.inode, 3342); - assert.equal(slice.args.error, false); - }); -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/drm_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/drm_parser.html deleted file mode 100644 index 78dd9515f25..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/drm_parser.html +++ /dev/null @@ -1,71 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses drm driver events in the Linux event trace format. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - - var ColorScheme = tr.b.ColorScheme; - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses linux drm trace events. - * @constructor - */ - function DrmParser(importer) { - Parser.call(this, importer); - - importer.registerEventHandler('drm_vblank_event', - DrmParser.prototype.vblankEvent.bind(this)); - } - - DrmParser.prototype = { - __proto__: Parser.prototype, - - drmVblankSlice: function(ts, eventName, args) { - var kthread = this.importer.getOrCreatePseudoThread('drm_vblank'); - kthread.openSlice = eventName; - var slice = new tr.model.Slice('', kthread.openSlice, - ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice), - ts, args, 0); - - kthread.thread.sliceGroup.pushSlice(slice); - }, - - /** - * Parses drm driver events and sets up state in the importer. - */ - vblankEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /crtc=(\d+), seq=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - var crtc = parseInt(event[1]); - var seq = parseInt(event[2]); - this.drmVblankSlice(ts, 'vblank:' + crtc, - { - crtc: crtc, - seq: seq - }); - return true; - } - }; - - Parser.register(DrmParser); - - return { - DrmParser: DrmParser - }; -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/drm_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/drm_parser_test.html deleted file mode 100644 index cdb214fb2de..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/drm_parser_test.html +++ /dev/null @@ -1,34 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - test('drmImport', function() { - var lines = [ - ' chrome-2465 [000] 71.653157: drm_vblank_event: crtc=0, seq=4233', - ' <idle>-0 [000] 71.669851: drm_vblank_event: crtc=0, seq=4234' - ]; - var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], { - shiftWorldToZero: false - }); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var vblankThread = threads[0]; - assert.equal(vblankThread.name, 'drm_vblank'); - assert.equal(vblankThread.sliceGroup.length, 2); - }); -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/exynos_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/exynos_parser.html deleted file mode 100644 index e573b8d25a1..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/exynos_parser.html +++ /dev/null @@ -1,128 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses exynos events in the Linux event trace format. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - - var ColorScheme = tr.b.ColorScheme; - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses linux exynos trace events. - * @constructor - */ - function ExynosParser(importer) { - Parser.call(this, importer); - - importer.registerEventHandler('exynos_busfreq_target_int', - ExynosParser.prototype.busfreqTargetIntEvent.bind(this)); - importer.registerEventHandler('exynos_busfreq_target_mif', - ExynosParser.prototype.busfreqTargetMifEvent.bind(this)); - - importer.registerEventHandler('exynos_page_flip_state', - ExynosParser.prototype.pageFlipStateEvent.bind(this)); - } - - ExynosParser.prototype = { - __proto__: Parser.prototype, - - exynosBusfreqSample: function(name, ts, frequency) { - var targetCpu = this.importer.getOrCreateCpu(0); - var counter = targetCpu.getOrCreateCounter('', name); - if (counter.numSeries === 0) { - counter.addSeries(new tr.model.CounterSeries('frequency', - ColorScheme.getColorIdForGeneralPurposeString( - counter.name + '.' + 'frequency'))); - } - counter.series.forEach(function(series) { - series.addCounterSample(ts, frequency); - }); - }, - - /** - * Parses exynos_busfreq_target_int events and sets up state. - */ - busfreqTargetIntEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /frequency=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - this.exynosBusfreqSample('INT Frequency', ts, parseInt(event[1])); - return true; - }, - - /** - * Parses exynos_busfreq_target_mif events and sets up state. - */ - busfreqTargetMifEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /frequency=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - this.exynosBusfreqSample('MIF Frequency', ts, parseInt(event[1])); - return true; - }, - - exynosPageFlipStateOpenSlice: function(ts, pipe, fb, state) { - var kthread = this.importer.getOrCreatePseudoThread( - 'exynos_flip_state (pipe:' + pipe + ', fb:' + fb + ')'); - kthread.openSliceTS = ts; - kthread.openSlice = state; - }, - - exynosPageFlipStateCloseSlice: function(ts, pipe, fb, args) { - var kthread = this.importer.getOrCreatePseudoThread( - 'exynos_flip_state (pipe:' + pipe + ', fb:' + fb + ')'); - if (kthread.openSlice) { - var slice = new tr.model.Slice('', kthread.openSlice, - ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice), - kthread.openSliceTS, - args, - ts - kthread.openSliceTS); - kthread.thread.sliceGroup.pushSlice(slice); - } - kthread.openSlice = undefined; - }, - - /** - * Parses page_flip_state events and sets up state in the importer. - */ - pageFlipStateEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /pipe=(\d+), fb=(\d+), state=(.*)/.exec(eventBase.details); - if (!event) - return false; - - var pipe = parseInt(event[1]); - var fb = parseInt(event[2]); - var state = event[3]; - - this.exynosPageFlipStateCloseSlice(ts, pipe, fb, - { - pipe: pipe, - fb: fb - }); - if (state !== 'flipped') - this.exynosPageFlipStateOpenSlice(ts, pipe, fb, state); - return true; - } - }; - - Parser.register(ExynosParser); - - return { - ExynosParser: ExynosParser - }; -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/exynos_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/exynos_parser_test.html deleted file mode 100644 index c27e7c65a93..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/exynos_parser_test.html +++ /dev/null @@ -1,128 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - function newModel(events) { - return tr.c.TestUtils.newModelWithEvents([events], { - shiftWorldToZero: false - }); - } - - test('exynosBusfreqImport', function() { - var lines = [ - ' kworker/1:0-4177 [001] .... 2803.129806: ' + - 'exynos_busfreq_target_int: frequency=200000', - ' kworker/1:0-4177 [001] .... 2803.229207: ' + - 'exynos_busfreq_target_int: frequency=267000', - ' kworker/1:0-4177 [001] .... 2803.329031: ' + - 'exynos_busfreq_target_int: frequency=160000', - ' kworker/1:0-4177 [001] .... 2805.729039: ' + - 'exynos_busfreq_target_mif: frequency=200000' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var c0 = m.kernel.cpus[0]; - assert.equal(c0.slices.length, 0); - assert.equal(c0.counters['.INT Frequency'].series[0].samples.length, 3); - assert.equal(c0.counters['.MIF Frequency'].series[0].samples.length, 1); - }); - - test('exynosPageFlipSlowRequestImport', function() { - var lines = [ - ' <idle>-0 [000] d.h. 1000.000000: ' + - 'exynos_page_flip_state: pipe=0, fb=26, state=wait_kds', - ' Chrome_IOThread-21603 [000] d.h. 1000.000001: ' + - 'exynos_page_flip_state: pipe=0, fb=26, state=wait_apply', - ' kworker/0:1-25931 [000] .... 1000.000002: ' + - 'exynos_page_flip_state: pipe=0, fb=26, state=wait_flip', - ' kworker/0:1-25931 [000] .... 1000.000003: ' + - 'exynos_page_flip_state: pipe=0, fb=26, state=flipped', - ' <idle>-0 [000] d.h. 1000.000004: ' + - 'exynos_page_flip_state: pipe=0, fb=25, state=wait_kds', - ' Chrome_IOThread-21603 [000] d.h. 1000.000005: ' + - 'exynos_page_flip_state: pipe=0, fb=25, state=wait_apply', - ' kworker/0:1-25931 [000] .... 1000.000006: ' + - 'exynos_page_flip_state: pipe=0, fb=25, state=wait_flip', - ' kworker/0:1-25931 [000] .... 1000.000007: ' + - 'exynos_page_flip_state: pipe=0, fb=25, state=flipped' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - // there are 2 threads: - // (1) "exynos_flip_state (pipe:0, fb:25)" - // (2) "exynos_flip_state (pipe:0, fb:26)" - assert.equal(threads.length, 2); - - // in the test data, event of fb=26 occurs first, so it's thread[0] - var gfxFbId26Thread = threads[0]; // thread where fb == 26 - var gfxFbId25Thread = threads[1]; // thread where fb == 25 - assert.equal(gfxFbId25Thread.name, 'exynos_flip_state (pipe:0, fb:25)'); - assert.equal(gfxFbId26Thread.name, 'exynos_flip_state (pipe:0, fb:26)'); - // Every state (except for 'flipped') will start a new slice. - // The last event will not be closed, so it's not a slice - assert.equal(gfxFbId25Thread.sliceGroup.length, 3); - assert.equal(gfxFbId26Thread.sliceGroup.length, 3); - }); - - test('exynosPageFlipFastRequestImport', function() { - var lines = [ - ' <idle>-0 [000] d.h. 1000.000000: ' + - 'exynos_page_flip_state: pipe=0, fb=26, state=wait_kds', - ' Chrome_IOThread-21603 [000] d.h. 1000.000001: ' + - 'exynos_page_flip_state: pipe=0, fb=25, state=wait_kds', - ' X-21385 [000] .... 1000.000002: ' + - 'exynos_page_flip_state: pipe=0, fb=26, state=wait_apply', - ' kworker/0:1-25931 [000] .... 1000.000003: ' + - 'exynos_page_flip_state: pipe=0, fb=26, state=wait_flip', - ' X-21385 [001] .... 1000.000004: ' + - 'exynos_page_flip_state: pipe=0, fb=25, state=wait_apply', - ' kworker/0:1-25931 [000] .... 1000.000005: ' + - 'exynos_page_flip_state: pipe=0, fb=26, state=flipped', - ' <idle>-0 [000] d.h. 1000.000006: ' + - 'exynos_page_flip_state: pipe=0, fb=26, state=wait_kds', - ' X-21385 [000] .... 1000.000007: ' + - 'exynos_page_flip_state: pipe=0, fb=25, state=wait_flip', - ' kworker/0:1-25931 [000] .... 1000.000008: ' + - 'exynos_page_flip_state: pipe=0, fb=25, state=flipped', - ' kworker/0:1-25931 [000] .... 1000.000009: ' + - 'exynos_page_flip_state: pipe=0, fb=25, state=wait_kds', - ' Chrome_IOThread-21603 [000] d.h. 1000.000010: ' + - 'exynos_page_flip_state: pipe=0, fb=25, state=wait_apply', - ' <idle>-0 [000] d.h. 1000.000011: ' + - 'exynos_page_flip_state: pipe=0, fb=26, state=wait_apply' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - // there are 2 threads: - // (1) "exynos_flip_state (pipe:0, fb:25)" - // (2) "exynos_flip_state (pipe:0, fb:26)" - assert.equal(threads.length, 2); - - // in the test data, event of fb=26 occurs first, so it's thread[0] - var gfxFbId26Thread = threads[0]; // thread where fb == 26 - var gfxFbId25Thread = threads[1]; // thread where fb == 25 - assert.equal(gfxFbId25Thread.name, 'exynos_flip_state (pipe:0, fb:25)'); - assert.equal(gfxFbId26Thread.name, 'exynos_flip_state (pipe:0, fb:26)'); - // Every state (except for 'flipped') will start a new slice. - // The last event will not be closed, so it's not a slice - assert.equal(gfxFbId25Thread.sliceGroup.length, 4); - assert.equal(gfxFbId26Thread.sliceGroup.length, 4); - }); -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer.html deleted file mode 100644 index 477223b1640..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer.html +++ /dev/null @@ -1,920 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> - -<link rel="import" href="/tracing/base/color_scheme.html"> -<link rel="import" href="/tracing/base/iteration_helpers.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/android_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/binder_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/bus_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/clock_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/cpufreq_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/disk_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/drm_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/exynos_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/gesture_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/i915_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/irq_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/kfunc_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/mali_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/memreclaim_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/power_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/regulator_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/sched_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/sync_parser.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/workqueue_parser.html"> -<link rel="import" href="/tracing/importer/importer.html"> -<link rel="import" href="/tracing/importer/simple_line_reader.html"> -<link rel="import" href="/tracing/model/clock_sync_manager.html"> -<link rel="import" href="/tracing/model/model.html"> - -<script> -/** - * @fileoverview Imports text files in the Linux event trace format into the - * Model. This format is output both by sched_trace and by Linux's perf tool. - * - * This importer assumes the events arrive as a string. The unit tests provide - * examples of the trace format. - * - * Linux scheduler traces use a definition for 'pid' that is different than - * tracing uses. Whereas tracing uses pid to identify a specific process, a pid - * in a linux trace refers to a specific thread within a process. Within this - * file, we the definition used in Linux traces, as it improves the importing - * code's readability. - */ -'use strict'; - -tr.exportTo('tr.e.importer.linux_perf', function() { - var MONOTONIC_TO_FTRACE_GLOBAL_SYNC_ID = - 'linux_clock_monotonic_to_ftrace_global'; - - /** - * Imports linux perf events into a specified model. - * @constructor - */ - function FTraceImporter(model, events) { - this.importPriority = 2; - this.model_ = model; - this.events_ = events; - this.wakeups_ = []; - this.blocked_reasons_ = []; - this.kernelThreadStates_ = {}; - this.buildMapFromLinuxPidsToThreads_(); - this.lines_ = []; - this.pseudoThreadCounter = 1; - this.parsers_ = []; - this.eventHandlers_ = {}; - this.haveClockSyncedMonotonicToGlobal_ = false; - } - - var TestExports = {}; - - // Matches the trace record in 3.2 and later with the print-tgid option: - // <idle>-0 0 [001] d... 1.23: sched_switch - // - // A TGID (Thread Group ID) is basically what the Linux kernel calls what - // userland refers to as a process ID (as opposed to a Linux pid, which is - // what userland calls a thread ID). - var lineREWithTGID = new RegExp( - '^\\s*(.+)-(\\d+)\\s+\\(\\s*(\\d+|-+)\\)\\s\\[(\\d+)\\]' + - '\\s+[dX.][Nnp.][Hhs.][0-9a-f.]' + - '\\s+(\\d+\\.\\d+):\\s+(\\S+):\\s(.*)$'); - var lineParserWithTGID = function(line) { - var groups = lineREWithTGID.exec(line); - if (!groups) { - return groups; - } - - var tgid = groups[3]; - if (tgid[0] === '-') - tgid = undefined; - - return { - threadName: groups[1], - pid: groups[2], - tgid: tgid, - cpuNumber: groups[4], - timestamp: groups[5], - eventName: groups[6], - details: groups[7] - }; - }; - TestExports.lineParserWithTGID = lineParserWithTGID; - - // Matches the default trace record in 3.2 and later (includes irq-info): - // <idle>-0 [001] d... 1.23: sched_switch - var lineREWithIRQInfo = new RegExp( - '^\\s*(.+)-(\\d+)\\s+\\[(\\d+)\\]' + - '\\s+[dX.][Nnp.][Hhs.][0-9a-f.]' + - '\\s+(\\d+\\.\\d+):\\s+(\\S+):\\s(.*)$'); - var lineParserWithIRQInfo = function(line) { - var groups = lineREWithIRQInfo.exec(line); - if (!groups) { - return groups; - } - return { - threadName: groups[1], - pid: groups[2], - cpuNumber: groups[3], - timestamp: groups[4], - eventName: groups[5], - details: groups[6] - }; - }; - TestExports.lineParserWithIRQInfo = lineParserWithIRQInfo; - - // Matches the default trace record pre-3.2: - // <idle>-0 [001] 1.23: sched_switch - var lineREWithLegacyFmt = - /^\s*(.+)-(\d+)\s+\[(\d+)\]\s*(\d+\.\d+):\s+(\S+):\s(.*)$/; - var lineParserWithLegacyFmt = function(line) { - var groups = lineREWithLegacyFmt.exec(line); - if (!groups) { - return groups; - } - return { - threadName: groups[1], - pid: groups[2], - cpuNumber: groups[3], - timestamp: groups[4], - eventName: groups[5], - details: groups[6] - }; - }; - TestExports.lineParserWithLegacyFmt = lineParserWithLegacyFmt; - - // Matches the trace_event_clock_sync marker: - // 0: trace_event_clock_sync: parent_ts=19581477508 - var traceEventClockSyncRE = /trace_event_clock_sync: parent_ts=(\d+\.?\d*)/; - TestExports.traceEventClockSyncRE = traceEventClockSyncRE; - - var realTimeClockSyncRE = /trace_event_clock_sync: realtime_ts=(\d+)/; - var genericClockSyncRE = /trace_event_clock_sync: name=(\w+)/; - - // Some kernel trace events are manually classified in slices and - // hand-assigned a pseudo PID. - var pseudoKernelPID = 0; - - /** - * Deduce the format of trace data. Linux kernels prior to 3.3 used one - * format (by default); 3.4 and later used another. Additionally, newer - * kernels can optionally trace the TGID. - * - * @return {function} the function for parsing data when the format is - * recognized; otherwise undefined. - */ - function autoDetectLineParser(line) { - if (line[0] == '{') - return false; - if (lineREWithTGID.test(line)) - return lineParserWithTGID; - if (lineREWithIRQInfo.test(line)) - return lineParserWithIRQInfo; - if (lineREWithLegacyFmt.test(line)) - return lineParserWithLegacyFmt; - return undefined; - }; - TestExports.autoDetectLineParser = autoDetectLineParser; - - /** - * Guesses whether the provided events is a Linux perf string. - * Looks for the magic string "# tracer" at the start of the file, - * or the typical task-pid-cpu-timestamp-function sequence of a typical - * trace's body. - * - * @return {boolean} True when events is a linux perf array. - */ - FTraceImporter.canImport = function(events) { - if (!(typeof(events) === 'string' || events instanceof String)) - return false; - - if (FTraceImporter._extractEventsFromSystraceHTML(events, false).ok) - return true; - - if (FTraceImporter._extractEventsFromSystraceMultiHTML(events, false).ok) - return true; - - if (/^# tracer:/.test(events)) - return true; - - var lineBreakIndex = events.indexOf('\n'); - if (lineBreakIndex > -1) - events = events.substring(0, lineBreakIndex); - - if (autoDetectLineParser(events)) - return true; - - return false; - }; - - FTraceImporter._extractEventsFromSystraceHTML = function( - incoming_events, produce_result) { - var failure = {ok: false}; - if (produce_result === undefined) - produce_result = true; - - if (/^<!DOCTYPE html>/.test(incoming_events) == false) - return failure; - var r = new tr.importer.SimpleLineReader(incoming_events); - - // Try to find the data... - if (!r.advanceToLineMatching(/^ <script>$/)) - return failure; - if (!r.advanceToLineMatching(/^ var linuxPerfData = "\\$/)) - return failure; - - var events_begin_at_line = r.curLineNumber + 1; - r.beginSavingLines(); - if (!r.advanceToLineMatching(/^ <\/script>$/)) - return failure; - - var raw_events = r.endSavingLinesAndGetResult(); - - // Drop off first and last event as it contains the tag. - raw_events = raw_events.slice(1, raw_events.length - 1); - - if (!r.advanceToLineMatching(/^<\/body>$/)) - return failure; - if (!r.advanceToLineMatching(/^<\/html>$/)) - return failure; - - function endsWith(str, suffix) { - return str.indexOf(suffix, str.length - suffix.length) !== -1; - } - function stripSuffix(str, suffix) { - if (!endsWith(str, suffix)) - return str; - return str.substring(str, str.length - suffix.length); - } - - // Strip off escaping in the file needed to preserve linebreaks. - var events = []; - if (produce_result) { - for (var i = 0; i < raw_events.length; i++) { - var event = raw_events[i]; - event = stripSuffix(event, '\\n\\'); - events.push(event); - } - } else { - events = [raw_events[raw_events.length - 1]]; - } - - // Last event ends differently. Strip that off too, - // treating absence of that trailing string as a failure. - var oldLastEvent = events[events.length - 1]; - var newLastEvent = stripSuffix(oldLastEvent, '\\n";'); - if (newLastEvent == oldLastEvent) - return failure; - events[events.length - 1] = newLastEvent; - - return {ok: true, - lines: produce_result ? events : undefined, - events_begin_at_line: events_begin_at_line}; - }; - - FTraceImporter._extractEventsFromSystraceMultiHTML = function( - incoming_events, produce_result) { - var failure = {ok: false}; - if (produce_result === undefined) - produce_result = true; - - if (new RegExp('^<!DOCTYPE HTML>', 'i').test(incoming_events) == false) - return failure; - - var r = new tr.importer.SimpleLineReader(incoming_events); - - // Try to find the Linux perf trace in any of the trace-data tags - var events = []; - while (!/^# tracer:/.test(events)) { - if (!r.advanceToLineMatching( - /^ <script class="trace-data" type="application\/text">$/)) - return failure; - - var events_begin_at_line = r.curLineNumber + 1; - - r.beginSavingLines(); - if (!r.advanceToLineMatching(/^ <\/script>$/)) - return failure; - - events = r.endSavingLinesAndGetResult(); - - // Drop off first and last event as it contains the tag. - events = events.slice(1, events.length - 1); - } - - if (!r.advanceToLineMatching(/^<\/body>$/)) - return failure; - if (!r.advanceToLineMatching(/^<\/html>$/)) - return failure; - - return {ok: true, - lines: produce_result ? events : undefined, - events_begin_at_line: events_begin_at_line}; - }; - - FTraceImporter.prototype = { - __proto__: tr.importer.Importer.prototype, - - get importerName() { - return 'FTraceImporter'; - }, - - get model() { - return this.model_; - }, - - /** - * Imports clock sync markers into model_. - */ - importClockSyncMarkers: function() { - this.lazyInit_(); - - this.forEachLine_(function(text, eventBase, cpuNumber, pid, ts) { - var eventName = eventBase.eventName; - if (eventName !== 'tracing_mark_write' && eventName !== '0') - return; - - if (traceEventClockSyncRE.exec(eventBase.details) || - genericClockSyncRE.exec(eventBase.details)) { - this.traceClockSyncEvent_(eventName, cpuNumber, pid, ts, eventBase); - } else if (realTimeClockSyncRE.exec(eventBase.details)) { - // TODO(charliea): Migrate this sync to ClockSyncManager. - // This entry syncs CLOCK_REALTIME with CLOCK_MONOTONIC. Store the - // offset between the two in the model so that importers parsing files - // with CLOCK_REALTIME timestamps can map back to CLOCK_MONOTONIC. - var match = realTimeClockSyncRE.exec(eventBase.details); - this.model_.realtime_to_monotonic_offset_ms = ts - match[1]; - } - }.bind(this)); - }, - - /** - * Imports the data in this.events_ into model_. - */ - importEvents: function() { - var modelTimeTransformer = - this.model_.clockSyncManager.getModelTimeTransformer( - tr.model.ClockDomainId.LINUX_FTRACE_GLOBAL); - - this.importCpuData_(modelTimeTransformer); - this.buildMapFromLinuxPidsToThreads_(); - this.buildPerThreadCpuSlicesFromCpuState_(); - }, - - /** - * Registers a linux perf event parser used by importCpuData_. - */ - registerEventHandler: function(eventName, handler) { - // TODO(sleffler) how to handle conflicts? - this.eventHandlers_[eventName] = handler; - }, - - /** - * @return {Cpu} A Cpu corresponding to the given cpuNumber. - */ - getOrCreateCpu: function(cpuNumber) { - return this.model_.kernel.getOrCreateCpu(cpuNumber); - }, - - /** - * @return {TimelineThread} A thread corresponding to the kernelThreadName. - */ - getOrCreateKernelThread: function(kernelThreadName, pid, tid) { - if (!this.kernelThreadStates_[kernelThreadName]) { - var thread = this.model_.getOrCreateProcess(pid).getOrCreateThread(tid); - thread.name = kernelThreadName; - this.kernelThreadStates_[kernelThreadName] = { - pid: pid, - thread: thread, - openSlice: undefined, - openSliceTS: undefined - }; - this.threadsByLinuxPid[pid] = thread; - } - return this.kernelThreadStates_[kernelThreadName]; - }, - - /** - * Processes can have multiple binder threads. - * Binder thread names are not unique across processes we therefore need to - * keep more information in order to return the correct threads. - */ - getOrCreateBinderKernelThread: function(kernelThreadName, pid, tid) { - var key = kernelThreadName + pid + tid; - if (!this.kernelThreadStates_[key]) { - var thread = this.model_.getOrCreateProcess(pid).getOrCreateThread(tid); - thread.name = kernelThreadName; - this.kernelThreadStates_[key] = { - pid: pid, - thread: thread, - openSlice: undefined, - openSliceTS: undefined - }; - this.threadsByLinuxPid[pid] = thread; - } - return this.kernelThreadStates_[key]; - }, - - /** - * @return {TimelineThread} A pseudo thread corresponding to the - * threadName. Pseudo threads are for events that we want to break - * out to a separate timeline but would not otherwise happen. - * These threads are assigned to pseudoKernelPID and given a - * unique (incrementing) TID. - */ - getOrCreatePseudoThread: function(threadName) { - var thread = this.kernelThreadStates_[threadName]; - if (!thread) { - thread = this.getOrCreateKernelThread(threadName, pseudoKernelPID, - this.pseudoThreadCounter); - this.pseudoThreadCounter++; - } - return thread; - }, - - /** - * Records the fact that a pid has become runnable. This data will - * eventually get used to derive each thread's timeSlices array. - */ - markPidRunnable: function(ts, pid, comm, prio, fromPid) { - // The the pids that get passed in to this function are Linux kernel - // pids, which identify threads. The rest of trace-viewer refers to - // these as tids, so the change of nomenclature happens in the following - // construction of the wakeup object. - this.wakeups_.push({ts: ts, tid: pid, fromTid: fromPid}); - }, - - /** - * Records the reason why a pid has gone into uninterruptible sleep. - */ - addPidBlockedReason: function(ts, pid, iowait, caller) { - // The the pids that get passed in to this function are Linux kernel - // pids, which identify threads. The rest of trace-viewer refers to - // these as tids, so the change of nomenclature happens in the following - // construction of the wakeup object. - this.blocked_reasons_.push({ts: ts, tid: pid, iowait: iowait, - caller: caller}); - }, - - /** - * Precomputes a lookup table from linux pids back to existing - * Threads. This is used during importing to add information to each - * thread about whether it was running, descheduled, sleeping, et - * cetera. - */ - buildMapFromLinuxPidsToThreads_: function() { - this.threadsByLinuxPid = {}; - this.model_.getAllThreads().forEach( - function(thread) { - this.threadsByLinuxPid[thread.tid] = thread; - }.bind(this)); - }, - - /** - * Builds the timeSlices array on each thread based on our knowledge of what - * each Cpu is doing. This is done only for Threads that are - * already in the model, on the assumption that not having any traced data - * on a thread means that it is not of interest to the user. - */ - buildPerThreadCpuSlicesFromCpuState_: function() { - var SCHEDULING_STATE = tr.model.SCHEDULING_STATE; - - // Push the cpu slices to the threads that they run on. - for (var cpuNumber in this.model_.kernel.cpus) { - var cpu = this.model_.kernel.cpus[cpuNumber]; - - for (var i = 0; i < cpu.slices.length; i++) { - var cpuSlice = cpu.slices[i]; - - var thread = this.threadsByLinuxPid[cpuSlice.args.tid]; - if (!thread) - continue; - - cpuSlice.threadThatWasRunning = thread; - - if (!thread.tempCpuSlices) - thread.tempCpuSlices = []; - thread.tempCpuSlices.push(cpuSlice); - } - } - - for (var i in this.wakeups_) { - var wakeup = this.wakeups_[i]; - var thread = this.threadsByLinuxPid[wakeup.tid]; - if (!thread) - continue; - thread.tempWakeups = thread.tempWakeups || []; - thread.tempWakeups.push(wakeup); - } - for (var i in this.blocked_reasons_) { - var reason = this.blocked_reasons_[i]; - var thread = this.threadsByLinuxPid[reason.tid]; - if (!thread) - continue; - thread.tempBlockedReasons = thread.tempBlockedReasons || []; - thread.tempBlockedReasons.push(reason); - } - - // Create slices for when the thread is not running. - this.model_.getAllThreads().forEach(function(thread) { - if (thread.tempCpuSlices === undefined) - return; - var origSlices = thread.tempCpuSlices; - delete thread.tempCpuSlices; - - origSlices.sort(function(x, y) { - return x.start - y.start; - }); - - var wakeups = thread.tempWakeups || []; - delete thread.tempWakeups; - wakeups.sort(function(x, y) { - return x.ts - y.ts; - }); - - var reasons = thread.tempBlockedReasons || []; - delete thread.tempBlockedReasons; - reasons.sort(function(x, y) { - return x.ts - y.ts; - }); - - // Walk the slice list and put slices between each original slice to - // show when the thread isn't running. - var slices = []; - - if (origSlices.length) { - var slice = origSlices[0]; - - if (wakeups.length && wakeups[0].ts < slice.start) { - var wakeup = wakeups.shift(); - var wakeupDuration = slice.start - wakeup.ts; - var args = {'wakeup from tid': wakeup.fromTid}; - slices.push(new tr.model.ThreadTimeSlice( - thread, SCHEDULING_STATE.RUNNABLE, '', - wakeup.ts, args, wakeupDuration)); - } - - var runningSlice = new tr.model.ThreadTimeSlice( - thread, SCHEDULING_STATE.RUNNING, '', - slice.start, {}, slice.duration); - runningSlice.cpuOnWhichThreadWasRunning = slice.cpu; - slices.push(runningSlice); - } - - var wakeup = undefined; - for (var i = 1; i < origSlices.length; i++) { - var prevSlice = origSlices[i - 1]; - var nextSlice = origSlices[i]; - var midDuration = nextSlice.start - prevSlice.end; - while (wakeups.length && wakeups[0].ts < nextSlice.start) { - var w = wakeups.shift(); - if (wakeup === undefined && w.ts > prevSlice.end) { - wakeup = w; - } - } - var blocked_reason = undefined; - while (reasons.length && reasons[0].ts < prevSlice.end) { - var r = reasons.shift(); - } - if (wakeup !== undefined && - reasons.length && - reasons[0].ts < wakeup.ts) { - blocked_reason = reasons.shift(); - } - - // Push a sleep slice onto the slices list, interrupting it with a - // wakeup if appropriate. - var pushSleep = function(state) { - if (wakeup !== undefined) { - midDuration = wakeup.ts - prevSlice.end; - } - - if (blocked_reason !== undefined) { - var args = { - 'kernel callsite when blocked:' : blocked_reason.caller - }; - if (blocked_reason.iowait) { - switch (state) { - case SCHEDULING_STATE.UNINTR_SLEEP: - state = SCHEDULING_STATE.UNINTR_SLEEP_IO; - break; - case SCHEDULING_STATE.UNINTR_SLEEP_WAKE_KILL: - state = SCHEDULING_STATE.UNINTR_SLEEP_WAKE_KILL_IO; - break; - case SCHEDULING_STATE.UNINTR_SLEEP_WAKING: - state = SCHEDULING_STATE.UNINTR_SLEEP_WAKE_KILL_IO; - break; - default: - } - } - slices.push(new tr.model.ThreadTimeSlice( - thread, - state, '', prevSlice.end, args, midDuration)); - } else { - slices.push(new tr.model.ThreadTimeSlice( - thread, - state, '', prevSlice.end, {}, midDuration)); - } - if (wakeup !== undefined) { - var wakeupDuration = nextSlice.start - wakeup.ts; - var args = {'wakeup from tid': wakeup.fromTid}; - slices.push(new tr.model.ThreadTimeSlice( - thread, SCHEDULING_STATE.RUNNABLE, '', - wakeup.ts, args, wakeupDuration)); - wakeup = undefined; - } - }; - - if (prevSlice.args.stateWhenDescheduled == 'S') { - pushSleep(SCHEDULING_STATE.SLEEPING); - } else if (prevSlice.args.stateWhenDescheduled == 'R' || - prevSlice.args.stateWhenDescheduled == 'R+') { - slices.push(new tr.model.ThreadTimeSlice( - thread, SCHEDULING_STATE.RUNNABLE, '', - prevSlice.end, {}, midDuration)); - } else if (prevSlice.args.stateWhenDescheduled == 'D') { - pushSleep(SCHEDULING_STATE.UNINTR_SLEEP); - } else if (prevSlice.args.stateWhenDescheduled == 'T') { - slices.push(new tr.model.ThreadTimeSlice( - thread, SCHEDULING_STATE.STOPPED, '', - prevSlice.end, {}, midDuration)); - } else if (prevSlice.args.stateWhenDescheduled == 't') { - slices.push(new tr.model.ThreadTimeSlice( - thread, SCHEDULING_STATE.DEBUG, '', - prevSlice.end, {}, midDuration)); - } else if (prevSlice.args.stateWhenDescheduled == 'Z') { - slices.push(new tr.model.ThreadTimeSlice( - thread, SCHEDULING_STATE.ZOMBIE, '', - prevSlice.end, {}, midDuration)); - } else if (prevSlice.args.stateWhenDescheduled == 'X') { - slices.push(new tr.model.ThreadTimeSlice( - thread, SCHEDULING_STATE.EXIT_DEAD, '', - prevSlice.end, {}, midDuration)); - } else if (prevSlice.args.stateWhenDescheduled == 'x') { - slices.push(new tr.model.ThreadTimeSlice( - thread, SCHEDULING_STATE.TASK_DEAD, '', - prevSlice.end, {}, midDuration)); - } else if (prevSlice.args.stateWhenDescheduled == 'K') { - slices.push(new tr.model.ThreadTimeSlice( - thread, SCHEDULING_STATE.WAKE_KILL, '', - prevSlice.end, {}, midDuration)); - } else if (prevSlice.args.stateWhenDescheduled == 'W') { - slices.push(new tr.model.ThreadTimeSlice( - thread, SCHEDULING_STATE.WAKING, '', - prevSlice.end, {}, midDuration)); - } else if (prevSlice.args.stateWhenDescheduled == 'D|K') { - pushSleep(SCHEDULING_STATE.UNINTR_SLEEP_WAKE_KILL); - } else if (prevSlice.args.stateWhenDescheduled == 'D|W') { - pushSleep(SCHEDULING_STATE.UNINTR_SLEEP_WAKING); - } else { - slices.push(new tr.model.ThreadTimeSlice( - thread, SCHEDULING_STATE.UNKNOWN, '', - prevSlice.end, {}, midDuration)); - this.model_.importWarning({ - type: 'parse_error', - message: 'Unrecognized sleep state: ' + - prevSlice.args.stateWhenDescheduled - }); - } - - var runningSlice = new tr.model.ThreadTimeSlice( - thread, SCHEDULING_STATE.RUNNING, '', - nextSlice.start, {}, nextSlice.duration); - runningSlice.cpuOnWhichThreadWasRunning = prevSlice.cpu; - slices.push(runningSlice); - } - thread.timeSlices = slices; - }, this); - }, - - /** - * Creates an instance of each registered linux perf event parser. - * This allows the parsers to register handlers for the events they - * understand. We also register our own special handlers (for the - * timestamp synchronization markers). - */ - createParsers_: function() { - // Instantiate the parsers; this will register handlers for known events - var allTypeInfos = tr.e.importer.linux_perf. - Parser.getAllRegisteredTypeInfos(); - var parsers = allTypeInfos.map( - function(typeInfo) { - return new typeInfo.constructor(this); - }, this); - - return parsers; - }, - - registerDefaultHandlers_: function() { - this.registerEventHandler('tracing_mark_write', - FTraceImporter.prototype.traceMarkingWriteEvent_.bind(this)); - // NB: old-style trace markers; deprecated - this.registerEventHandler('0', - FTraceImporter.prototype.traceMarkingWriteEvent_.bind(this)); - // Register dummy clock sync handlers to avoid warnings in the log. - this.registerEventHandler('tracing_mark_write:trace_event_clock_sync', - function() { return true; }); - this.registerEventHandler('0:trace_event_clock_sync', - function() { return true; }); - }, - - /** - * Processes a trace_event_clock_sync event. - */ - traceClockSyncEvent_: function(eventName, cpuNumber, pid, ts, eventBase) { - // Check to see if we have a normal clock sync marker that contains a - // sync ID and the current time according to the "ftrace global" clock. - var event = /name=(\w+?)\s(.+)/.exec(eventBase.details); - if (event) { - var name = event[1]; - var pieces = event[2].split(' '); - var args = { - perfTs: ts - }; - for (var i = 0; i < pieces.length; i++) { - var parts = pieces[i].split('='); - if (parts.length != 2) - throw new Error('omgbbq'); - args[parts[0]] = parts[1]; - } - - this.model_.clockSyncManager.addClockSyncMarker( - tr.model.ClockDomainId.LINUX_FTRACE_GLOBAL, name, ts); - return true; - } - - // Check to see if we have a special clock sync marker that contains both - // the current "ftrace global" time and the current CLOCK_MONOTONIC time. - event = /parent_ts=(\d+\.?\d*)/.exec(eventBase.details); - if (!event) - return false; - - var monotonicTs = event[1] * 1000; - // A monotonic timestamp of zero is used as a sentinel value to indicate - // that CLOCK_MONOTONIC and the ftrace global clock are identical. - if (monotonicTs === 0) - monotonicTs = ts; - - if (this.haveClockSyncedMonotonicToGlobal_) - // ftrace sometimes includes multiple clock syncs between the monotonic - // and global clocks within a single trace. We protect against this by - // only taking the first one into account. - return true; - - // We have a clock sync event that contains two timestamps: a timestamp - // according to the ftrace 'global' clock, and that same timestamp - // according to clock_gettime(CLOCK_MONOTONIC). - this.model_.clockSyncManager.addClockSyncMarker( - tr.model.ClockDomainId.LINUX_FTRACE_GLOBAL, - MONOTONIC_TO_FTRACE_GLOBAL_SYNC_ID, ts); - this.model_.clockSyncManager.addClockSyncMarker( - tr.model.ClockDomainId.LINUX_CLOCK_MONOTONIC, - MONOTONIC_TO_FTRACE_GLOBAL_SYNC_ID, monotonicTs); - - this.haveClockSyncedMonotonicToGlobal_ = true; - return true; - }, - - /** - * Processes a trace_marking_write event. - */ - traceMarkingWriteEvent_: function(eventName, cpuNumber, pid, ts, eventBase, - threadName) { - - // Some profiles end up with a \n\ on the end of each line. Strip it - // before we do the comparisons. - eventBase.details = eventBase.details.replace(/\\n.*$/, ''); - - var event = /^\s*(\w+):\s*(.*)$/.exec(eventBase.details); - if (!event) { - // Check if the event matches events traced by the Android framework - var tag = eventBase.details.substring(0, 2); - if (tag == 'B|' || tag == 'E' || tag == 'E|' || tag == 'X|' || - tag == 'C|' || tag == 'S|' || tag == 'F|') { - eventBase.subEventName = 'android'; - } else { - return false; - } - } else { - eventBase.subEventName = event[1]; - eventBase.details = event[2]; - } - - var writeEventName = eventName + ':' + eventBase.subEventName; - var handler = this.eventHandlers_[writeEventName]; - if (!handler) { - this.model_.importWarning({ - type: 'parse_error', - message: 'Unknown trace_marking_write event ' + writeEventName - }); - return true; - } - return handler(writeEventName, cpuNumber, pid, ts, eventBase, threadName); - }, - - /** - * Walks the this.events_ structure and creates Cpu objects. - */ - importCpuData_: function(modelTimeTransformer) { - this.forEachLine_(function(text, eventBase, cpuNumber, pid, ts) { - var eventName = eventBase.eventName; - var handler = this.eventHandlers_[eventName]; - if (!handler) { - this.model_.importWarning({ - type: 'parse_error', - message: 'Unknown event ' + eventName + ' (' + text + ')' - }); - return; - } - ts = modelTimeTransformer(ts); - if (!handler(eventName, cpuNumber, pid, ts, eventBase)) { - this.model_.importWarning({ - type: 'parse_error', - message: 'Malformed ' + eventName + ' event (' + text + ')' - }); - } - }.bind(this)); - }, - - /** - * Walks the this.events_ structure and populates this.lines_. - */ - parseLines_: function() { - var lines = []; - var extractResult = FTraceImporter._extractEventsFromSystraceHTML( - this.events_, true); - if (!extractResult.ok) - extractResult = FTraceImporter._extractEventsFromSystraceMultiHTML( - this.events_, true); - var lines = extractResult.ok ? - extractResult.lines : this.events_.split('\n'); - - var lineParser = undefined; - for (var lineNumber = 0; lineNumber < lines.length; ++lineNumber) { - var line = lines[lineNumber].trim(); - if (line.length == 0 || /^#/.test(line)) - continue; - - if (!lineParser) { - lineParser = autoDetectLineParser(line); - if (!lineParser) { - this.model_.importWarning({ - type: 'parse_error', - message: 'Cannot parse line: ' + line - }); - continue; - } - } - - var eventBase = lineParser(line); - if (!eventBase) { - this.model_.importWarning({ - type: 'parse_error', - message: 'Unrecognized line: ' + line - }); - continue; - } - - this.lines_.push([ - line, - eventBase, - parseInt(eventBase.cpuNumber), - parseInt(eventBase.pid), - parseFloat(eventBase.timestamp) * 1000 - ]); - } - }, - - /** - * Calls |handler| for every parsed line. - */ - forEachLine_: function(handler) { - for (var i = 0; i < this.lines_.length; ++i) { - var line = this.lines_[i]; - handler.apply(this, line); - } - }, - - /** - * Initializes the ftrace importer. This initialization can't be done in the - * constructor because all trace event handlers may not have been registered - * by that point. - */ - lazyInit_: function() { - this.parsers_ = this.createParsers_(); - this.registerDefaultHandlers_(); - this.parseLines_(); - } - }; - - tr.importer.Importer.register(FTraceImporter); - - return { - FTraceImporter: FTraceImporter, - _FTraceImporterTestExports: TestExports - }; -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer_test.html deleted file mode 100644 index 244e3e28a13..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer_test.html +++ /dev/null @@ -1,530 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> -<link rel="import" href="/tracing/importer/import.html"> -<link rel="import" href="/tracing/model/clock_sync_manager.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - var ClockDomainId = tr.model.ClockDomainId; - var FTraceImporter = tr.e.importer.linux_perf.FTraceImporter; - var FTraceImporterTestExports = - tr.e.importer.linux_perf._FTraceImporterTestExports; - - function newModel(events) { - return tr.c.TestUtils.newModelWithEvents([events], { - shiftWorldToZero: false - }); - } - - test('lineParserWithLegacyFmt', function() { - var p = FTraceImporterTestExports.lineParserWithLegacyFmt; - var x = p(' <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'); - assert.isNotNull(x); - assert.equal(x.threadName, '<idle>'); - assert.equal(x.pid, '0'); - assert.equal(x.cpuNumber, '001'); - assert.equal(x.timestamp, '4467.843475'); - assert.equal(x.eventName, 'sched_switch'); - assert.equal('prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R' + - ' ==> next_comm=SurfaceFlinger next_pid=178 next_prio=112', x.details); - - var x = p('Binder-Thread #-647 [001] 260.464294: sched_switch: ' + - 'prev_comm=Binder Thread # prev_pid=647 prev_prio=120 prev_state=D ' + - ' ==> next_comm=.android.chrome next_pid=1562 next_prio=120'); - assert.isNotNull(x); - assert.equal(x.threadName, 'Binder-Thread #'); - assert.equal(x.pid, '647'); - }); - - test('lineParserWithIRQInfo', function() { - var p = FTraceImporterTestExports.lineParserWithIRQInfo; - var x = p(' systrace.sh-5441 [001] d... 1031.091570: ' + - 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); - assert.isNotNull(x); - assert.equal(x.threadName, 'systrace.sh'); - assert.equal(x.pid, '5441'); - assert.equal(x.cpuNumber, '001'); - assert.equal(x.timestamp, '1031.091570'); - assert.equal(x.eventName, 'sched_wakeup'); - assert.equal(x.details, 'comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); // @suppress longLineCheck - }); - - test('lineParserWithIRQInfoNeedResched', function() { - var p = FTraceImporterTestExports.lineParserWithIRQInfo; - var x = p(' systrace.sh-5441 [001] .N.. 1031.091570: ' + - 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); - assert.isNotNull(x); - assert.equal(x.threadName, 'systrace.sh'); - assert.equal(x.pid, '5441'); - assert.equal(x.cpuNumber, '001'); - assert.equal(x.timestamp, '1031.091570'); - assert.equal(x.eventName, 'sched_wakeup'); - assert.equal(x.details, 'comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); // @suppress longLineCheck - - var x = p(' systrace.sh-5441 [001] .n.. 1031.091570: ' + - 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); - assert.isNotNull(x); - assert.equal(x.threadName, 'systrace.sh'); - - var x = p(' systrace.sh-5441 [001] .p.. 1031.091570: ' + - 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); - assert.isNotNull(x); - assert.equal(x.threadName, 'systrace.sh'); - }); - - test('lineParserWithTGID', function() { - var p = FTraceImporterTestExports.lineParserWithTGID; - var x = p(' systrace.sh-5441 (54321) [001] d... 1031.091570: ' + - 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); - assert.isNotNull(x); - assert.equal(x.threadName, 'systrace.sh'); - assert.equal(x.pid, '5441'); - assert.equal(x.tgid, '54321'); - assert.equal(x.cpuNumber, '001'); - assert.equal(x.timestamp, '1031.091570'); - assert.equal(x.eventName, 'sched_wakeup'); - assert.equal(x.details, 'comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); // @suppress longLineCheck - - var x = p(' systrace.sh-5441 ( 321) [001] d... 1031.091570: ' + - 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); - assert.isNotNull(x); - assert.equal(x.tgid, '321'); - - var x = p(' systrace.sh-5441 (-----) [001] d... 1031.091570: ' + - 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); - assert.isNotNull(x); - assert.isUndefined(x.tgid); - }); - - test('lineParserWithTGIDNeedResched', function() { - var p = FTraceImporterTestExports.lineParserWithTGID; - var x = p(' systrace.sh-5441 (54321) [001] .N.. 1031.091570: ' + - 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); - assert.isNotNull(x); - assert.equal(x.threadName, 'systrace.sh'); - assert.equal(x.pid, '5441'); - assert.equal(x.tgid, '54321'); - assert.equal(x.cpuNumber, '001'); - assert.equal(x.timestamp, '1031.091570'); - assert.equal(x.eventName, 'sched_wakeup'); - assert.equal(x.details, 'comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); // @suppress longLineCheck - - var x = p(' systrace.sh-5441 ( 321) [001] .n.. 1031.091570: ' + - 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); - assert.isNotNull(x); - assert.equal(x.tgid, '321'); - - var x = p(' systrace.sh-5441 (-----) [001] .p.. 1031.091570: ' + - 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); - assert.isNotNull(x); - assert.isUndefined(x.tgid); - }); - - test('autodetectLineCornerCases', function() { - var detectParser = FTraceImporterTestExports.autoDetectLineParser; - var lineParserWithLegacyFmt = - FTraceImporterTestExports.lineParserWithLegacyFmt; - var lineParserWithIRQInfo = FTraceImporterTestExports.lineParserWithIRQInfo; - var lineParserWithTGID = FTraceImporterTestExports.lineParserWithTGID; - - var lineWithLegacyFmt = - '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'; - var detected = detectParser(lineWithLegacyFmt); - assert.equal(lineParserWithLegacyFmt, detected); - - var lineWithIRQInfo = - 'systrace.sh-8170 [001] d... 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'; - var detected = detectParser(lineWithIRQInfo); - assert.equal(lineParserWithIRQInfo, detected); - - var lineWithTGID = - 'systrace.sh-8170 (54321) [001] d... 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'; - var detected = detectParser(lineWithTGID); - assert.equal(lineParserWithTGID, detected); - }); - - test('traceEventClockSyncRE', function() { - var re = FTraceImporterTestExports.traceEventClockSyncRE; - var x = re.exec('trace_event_clock_sync: parent_ts=19581477508'); - assert.isNotNull(x); - assert.equal(x[1], '19581477508'); - - var x = re.exec('trace_event_clock_sync: parent_ts=123.456'); - assert.isNotNull(x); - assert.equal(x[1], '123.456'); - }); - - test('genericClockSync', function() { - var lines = [ - '# tracer: nop', - '#', - '# TASK-PID CPU# TIMESTAMP FUNCTION', - '# | | | | |', - 'sh-26121 [000] ...1 15.050: tracing_mark_write: trace_event_clock_sync: name=battor regulator=8941_smbb_boost' // @suppress longLineCheck - ]; - - var io = new tr.importer.ImportOptions(); - var m = new tr.Model(); - var i = new tr.importer.Import(m, io); - - m.clockSyncManager.addClockSyncMarker(ClockDomainId.BATTOR, 'battor', 50); - - i.importTraces([lines.join('\n')]); - - assert.isFalse(m.hasImportWarnings); - // The clock sync happened at 15050 in the ftrace global domain and at 50 - // in the BattOr domain. This means the ftrace global timestamps need 15000 - // subtracted from them in order to be on the BattOr timeline. - assert.strictEqual( - m.clockSyncManager.getModelTimeTransformer(ClockDomainId.BATTOR)(3), - 3); - assert.strictEqual( - m.clockSyncManager.getModelTimeTransformer( - ClockDomainId.LINUX_FTRACE_GLOBAL)(15003), - 3); - }); - - test('canImport', function() { - var lines = [ - '# tracer: nop', - '#', - '# TASK-PID CPU# TIMESTAMP FUNCTION', - '# | | | | |', - ' <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', - - ' SurfaceFlinger-178 [001] 4467.843536: sched_switch: ' + - 'prev_comm=SurfaceFlinger prev_pid=178 prev_prio=112 prev_state=S ' + - '==> next_comm=kworker/u:2 next_pid=2844 next_prio=120', - - ' kworker/u:2-2844 [001] 4467.843567: sched_switch: ' + - 'prev_comm=kworker/u:2 prev_pid=2844 prev_prio=120 prev_state=S ' + - '==> next_comm=swapper next_pid=0 next_prio=120', - - ' <idle>-0 [001] 4467.844208: sched_switch: ' + - 'prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> ' + - 'next_comm=kworker/u:2 next_pid=2844 next_prio=120' - ]; - assert.isTrue(FTraceImporter.canImport(lines.join('\n'))); - - 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' - ]; - assert.isTrue(FTraceImporter.canImport(lines.join('\n'))); - - 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', - - ' SurfaceFlinger-178 [001] 4467.843536: sched_switch: ' + - 'prev_comm=SurfaceFlinger prev_pid=178 prev_prio=112 ' + - 'prev_state=S ==> next_comm=kworker/u:2 next_pid=2844 ' + - 'next_prio=120' - ]; - assert.isTrue(FTraceImporter.canImport(lines.join('\n'))); - - var lines = [ - 'SomeRandomText', - 'More random text' - ]; - assert.isFalse(FTraceImporter.canImport(lines.join('\n'))); - }); - - test('canImport34AndLater', function() { - var lines = [ - '# tracer: nop', - '#', - '# entries-in-buffer/entries-written: 55191/55191 #P:2', - '#', - '# _-----=> irqs-off', - '# / _----=> need-resched', - '# | / _---=> hardirq/softirq', - '# || / _--=> preempt-depth', - '# ||| / delay', - '# TASK-PID CPU# |||| TIMESTAMP FUNCTION', - '# | | | |||| | |', - ' systrace.sh-5441 [001] d... 1031.091570: sched_wakeup: ' + - 'comm=debugd pid=4978 prio=120 success=1 target_cpu=000', - ' systrace.sh-5441 [001] d... 1031.091584: sched_switch: ' + - 'prev_comm=systrace.sh prev_pid=5441 prev_prio=120 prev_state=x ' + - '==> next_comm=chrome next_pid=5418 next_prio=120' - ]; - assert.isTrue(FTraceImporter.canImport(lines.join('\n'))); - - var lines = [ - ' systrace.sh-5441 [001] d... 1031.091570: sched_wakeup: ' + - 'comm=debugd pid=4978 prio=120 success=1 target_cpu=000', - ' systrace.sh-5441 [001] d... 1031.091584: sched_switch: ' + - 'prev_comm=systrace.sh prev_pid=5441 prev_prio=120 prev_state=x ' + - '==> next_comm=chrome next_pid=5418 next_prio=120' - ]; - assert.isTrue(FTraceImporter.canImport(lines.join('\n'))); - }); - - test('importOneSequence', function() { - 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', - - ' SurfaceFlinger-178 [001] 4467.843536: sched_switch: ' + - 'prev_comm=SurfaceFlinger prev_pid=178 prev_prio=112 ' + - 'prev_state=S ==> next_comm=kworker/u:2 next_pid=2844 ' + - 'next_prio=120', - - ' kworker/u:2-2844 [001] 4467.843567: sched_switch: ' + - 'prev_comm=kworker/u:2 prev_pid=2844 prev_prio=120 ' + - 'prev_state=S ==> next_comm=swapper next_pid=0 next_prio=120' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var c = m.kernel.cpus[1]; - assert.equal(c.slices.length, 2); - - assert.equal(c.slices[0].title, 'SurfaceFlinger'); - assert.equal(c.slices[0].start, 4467843.475); - assert.closeTo(.536 - .475, c.slices[0].duration, 1e-5); - }); - - test('importOneSequenceWithSpacyThreadName', function() { - var lines = [ - ' <idle>-0 [001] 4467.843475: sched_switch: ' + - 'prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> ' + - 'next_comm=Surface Flinger next_pid=178 next_prio=112', - - 'Surface Flinger -178 [001] 4467.843536: sched_switch: ' + - 'prev_comm=Surface Flinger prev_pid=178 prev_prio=112 ' + - 'prev_state=S ==> next_comm=kworker/u:2 next_pid=2844 ' + - 'next_prio=120', - - ' kworker/u:2-2844 [001] 4467.843567: sched_switch: ' + - 'prev_comm=kworker/u:2 prev_pid=2844 prev_prio=120 ' + - 'prev_state=S ==> next_comm=swapper next_pid=0 next_prio=120' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var c = m.kernel.cpus[1]; - assert.equal(c.slices.length, 2); - - assert.equal(c.slices[0].title, 'Surface Flinger '); - assert.equal(c.slices[0].start, 4467843.475); - assert.closeTo(.536 - .475, c.slices[0].duration, 1e-5); - }); - - test('importWithNewline', function() { - var lines = [ - '' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - }); - - test('importSystraceHtml', function() { - var p = tr.b.getAsync( - '/test_data/trivial_systrace.html'); - return p.then(function(data) { - var m = newModel(data); - assert.isFalse(m.hasImportWarnings); - - assert.isDefined(m.processes[124]); - assert.isDefined(m.processes[360]); - - assert.isDefined(m.processes[124].counters['android.StatusBar']); - assert.equal(m.processes[124].counters['android.StatusBar'].numSamples, - 1); - assert.isDefined(m.processes[124].counters['android.VSYNC']); - assert.equal(2, m.processes[124].counters['android.VSYNC'].numSamples); - assert.isDefined(m.processes[360].counters['android.iq']); - assert.equal(1, m.processes[360].counters['android.iq'].numSamples); - }, function(err) { - throw err; - }); - }); - - test('importMultiTraceHtml', function() { - var lines = [ - '<!DoCTYPE hTml>', // check must be case insensitive - '<body>', - ' <div class="view">', - ' <\/div>', - ' <script class="trace-data" type="application/text">', - 'test1', - 'test2', - ' <\/script>', - ' <script class="trace-data" type="application/text">', - '# tracer: nop', - '#', - '# TASK-PID CPU# TIMESTAMP FUNCTION', - '# | | | | |', - ' hwc_eventmon-336 [000] 50260.929925: 0: C|124|VSYNC|1', - ' Binder_1-340 [000] 50260.935656: 0: C|124|StatusBar|1', - ' hwc_eventmon-336 [000] 50260.946573: 0: C|124|VSYNC|0', - ' InputReader-419 [000] 50262.538578: 0: C|360|iq|1', - ' <\/script>', - '<\/body>', - '<\/html>' - ]; - - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - assert.isDefined(m.processes[124]); - assert.isDefined(m.processes[360]); - - assert.isDefined(m.processes[124].counters['android.StatusBar']); - assert.equal(m.processes[124].counters['android.StatusBar'].numSamples, - 1); - assert.isDefined(m.processes[124].counters['android.VSYNC']); - assert.equal(2, m.processes[124].counters['android.VSYNC'].numSamples); - assert.isDefined(m.processes[360].counters['android.iq']); - assert.equal(1, m.processes[360].counters['android.iq'].numSamples); - }); - - test('clockSync', function() { - 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', - ' SurfaceFlinger-178 [001] 4467.843536: sched_switch: ' + - 'prev_comm=SurfaceFlinger prev_pid=178 prev_prio=112 ' + - 'prev_state=S ==> next_comm=kworker/u:2 next_pid=2844 ' + - 'next_prio=120', - ' kworker/u:2-2844 [001] 4467.843567: sched_switch: ' + - 'prev_comm=kworker/u:2 prev_pid=2844 prev_prio=120 ' + - 'prev_state=S ==> next_comm=swapper next_pid=0 ' + - 'next_prio=120', - ' kworker/u:2-2844 [001] 4467.843000: 0: ' + - 'trace_event_clock_sync: parent_ts=0.1' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var c = m.kernel.cpus[1]; - assert.equal(c.slices.length, 2); - - assert.closeTo( - (467.843475 - (467.843 - 0.1)) * 1000, - c.slices[0].start, - 1e-5); - }); - - test('clockSyncMarkWrite', function() { - 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' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var c = m.kernel.cpus[1]; - assert.equal(c.slices.length, 2); - - assert.closeTo((15180.978813 - 0) * 1000, c.slices[0].start, 1e-5); - - assert.strictEqual( - m.clockSyncManager.getModelTimeTransformer( - tr.model.ClockDomainId.LINUX_FTRACE_GLOBAL)(100), - 100); - assert.strictEqual( - m.clockSyncManager.getModelTimeTransformer( - tr.model.ClockDomainId.LINUX_CLOCK_MONOTONIC)(100), - 100); - }); - - test('clockSyncMarkWriteSecondIgnored', function() { - var lines = [ - 'systrace.sh-8182 [000] 15186.203900: tracing_mark_write: ' + - 'trace_event_clock_sync: parent_ts=0', - 'systrace.sh-8182 [000] 15187.203900: tracing_mark_write: ' + - 'trace_event_clock_sync: parent_ts=0' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - assert.strictEqual( - m.clockSyncManager.getModelTimeTransformer( - tr.model.ClockDomainId.LINUX_FTRACE_GLOBAL)(100), - 100); - assert.strictEqual( - m.clockSyncManager.getModelTimeTransformer( - tr.model.ClockDomainId.LINUX_CLOCK_MONOTONIC)(100), - 100); - }); - - test('tracingMarkWriteEOLCleanup', function() { - var lines = [ - 'systrace.sh-8182 [001] ...1 2068001.677892: tracing_mark_write: ' + - 'B|9304|test\\n\\', - 'systrace.sh-8182 [002] ...1 2068991.686415: tracing_mark_write: E\\n\\' - ]; - - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var c = m.processes[9304].threads[8182].sliceGroup; - assert.equal(c.slices.length, 1); - - assert.closeTo((2068001.677892 - 0) * 1000, c.slices[0].start, 1e-5); - assert.closeTo( - (2068991.686415 - 2068001.677892) * 1000, - c.slices[0].duration, - 1e-5); - }); - - test('cpuCount', function() { - 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 [000] 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' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - assert.equal(tr.b.dictionaryLength(m.kernel.cpus), 2); - assert.equal(m.kernel.bestGuessAtCpuCount, 2); - }); -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/gesture_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/gesture_parser.html deleted file mode 100644 index f2c3924867b..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/gesture_parser.html +++ /dev/null @@ -1,144 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses gesture events in the Linux event trace format. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses trace events generated by gesture library for touchpad. - * @constructor - */ - function GestureParser(importer) { - Parser.call(this, importer); - importer.registerEventHandler('tracing_mark_write:log', - GestureParser.prototype.logEvent.bind(this)); - importer.registerEventHandler('tracing_mark_write:SyncInterpret', - GestureParser.prototype.syncEvent.bind(this)); - importer.registerEventHandler('tracing_mark_write:HandleTimer', - GestureParser.prototype.timerEvent.bind(this)); - } - - GestureParser.prototype = { - __proto__: Parser.prototype, - - /** - * Parse events generate by gesture library. - * gestureOpenSlice and gestureCloseSlice are two common - * functions to store the begin time and end time for all - * events in gesture library - */ - gestureOpenSlice: function(title, ts, opt_args) { - var thread = this.importer.getOrCreatePseudoThread('gesture').thread; - thread.sliceGroup.beginSlice( - 'touchpad_gesture', title, ts, opt_args); - }, - - gestureCloseSlice: function(title, ts) { - var thread = this.importer.getOrCreatePseudoThread('gesture').thread; - if (thread.sliceGroup.openSliceCount) { - var slice = thread.sliceGroup.mostRecentlyOpenedPartialSlice; - if (slice.title != title) { - this.importer.model.importWarning({ - type: 'title_match_error', - message: 'Titles do not match. Title is ' + - slice.title + ' in openSlice, and is ' + - title + ' in endSlice' - }); - } else { - thread.sliceGroup.endSlice(ts); - } - } - }, - - /** - * For log events, events will come in pairs with a tag log: - * like this: - * tracing_mark_write: log: start: TimerLogOutputs - * tracing_mark_write: log: end: TimerLogOutputs - * which represent the start and the end time of certain log behavior - * Take these logs above for example, they are the start and end time - * of logging Output for HandleTimer function - */ - logEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var innerEvent = - /^\s*(\w+):\s*(\w+)$/.exec(eventBase.details); - switch (innerEvent[1]) { - case 'start': - this.gestureOpenSlice('GestureLog', ts, {name: innerEvent[2]}); - break; - case 'end': - this.gestureCloseSlice('GestureLog', ts); - } - return true; - }, - - /** - * For SyncInterpret events, events will come in pairs with - * a tag SyncInterpret: - * like this: - * tracing_mark_write: SyncInterpret: start: ClickWiggleFilterInterpreter - * tracing_mark_write: SyncInterpret: end: ClickWiggleFilterInterpreter - * which represent the start and the end time of SyncInterpret function - * inside the certain interpreter in the gesture library. - * Take the logs above for example, they are the start and end time - * of the SyncInterpret function inside ClickWiggleFilterInterpreter - */ - syncEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var innerEvent = /^\s*(\w+):\s*(\w+)$/.exec(eventBase.details); - switch (innerEvent[1]) { - case 'start': - this.gestureOpenSlice('SyncInterpret', ts, - {interpreter: innerEvent[2]}); - break; - case 'end': - this.gestureCloseSlice('SyncInterpret', ts); - } - return true; - }, - - /** - * For HandleTimer events, events will come in pairs with - * a tag HandleTimer: - * like this: - * tracing_mark_write: HandleTimer: start: LookaheadFilterInterpreter - * tracing_mark_write: HandleTimer: end: LookaheadFilterInterpreter - * which represent the start and the end time of HandleTimer function - * inside the certain interpreter in the gesture library. - * Take the logs above for example, they are the start and end time - * of the HandleTimer function inside LookaheadFilterInterpreter - */ - timerEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var innerEvent = /^\s*(\w+):\s*(\w+)$/.exec(eventBase.details); - switch (innerEvent[1]) { - case 'start': - this.gestureOpenSlice('HandleTimer', ts, - {interpreter: innerEvent[2]}); - break; - case 'end': - this.gestureCloseSlice('HandleTimer', ts); - } - return true; - } - }; - - Parser.register(GestureParser); - - return { - GestureParser: GestureParser - }; -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/gesture_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/gesture_parser_test.html deleted file mode 100644 index 002844dcd2e..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/gesture_parser_test.html +++ /dev/null @@ -1,213 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - function newModel(events) { - return tr.c.TestUtils.newModelWithEvents([events], { - shiftWorldToZero: false - }); - } - - test('gestureImport', function() { - var lines = [ - '<...>-1837 [000] ...1 875292.741648: tracing_mark_write: ' + - 'log: start: TimerLogOutputs', // 0 - '<...>-1837 [000] ...1 875292.741651: tracing_mark_write: ' + - 'log: end: TimerLogOutputs', - '<...>-1837 [000] ...1 875292.742796: tracing_mark_write: ' + - 'log: start: LogTimerCallback', - '<...>-1837 [000] ...1 875292.742802: tracing_mark_write: ' + - 'log: end: LogTimerCallback', - '<...>-1837 [000] ...1 875292.742805: tracing_mark_write: ' + - 'HandleTimer: start: LoggingFilterInterpreter', // 2 - '<...>-1837 [000] ...1 875292.742809: tracing_mark_write: ' + - 'HandleTimer: start: AppleTrackpadFilterInterpreter', - '<...>-1837 [000] ...1 875292.742814: tracing_mark_write: ' + - 'HandleTimer: start: Cr48ProfileSensorFilterInterpreter', - '<...>-1837 [000] ...1 875292.742818: tracing_mark_write: ' + - 'HandleTimer: start: T5R2CorrectingFilterInterpreter', - '<...>-1837 [000] ...1 875292.742822: tracing_mark_write: ' + - 'HandleTimer: start: StuckButtonInhibitorFilterInterpreter', - '<...>-1837 [000] ...1 875292.742825: tracing_mark_write: ' + - 'HandleTimer: start: IntegralGestureFilterInterpreter', - '<...>-1837 [000] ...1 875292.742829: tracing_mark_write: ' + - 'HandleTimer: start: ScalingFilterInterpreter', - '<...>-1837 [000] ...1 875292.742833: tracing_mark_write: ' + - 'HandleTimer: start: SplitCorrectingFilterInterpreter', - '<...>-1837 [000] ...1 875292.742836: tracing_mark_write: ' + - 'HandleTimer: start: AccelFilterInterpreter', - '<...>-1837 [000] ...1 875292.742840: tracing_mark_write: ' + - 'HandleTimer: start: SensorJumpFilterInterpreter', - '<...>-1837 [000] ...1 875292.742843: tracing_mark_write: ' + - 'HandleTimer: start: BoxFilterInterpreter', - '<...>-1837 [000] ...1 875292.742846: tracing_mark_write: ' + - 'HandleTimer: start: LookaheadFilterInterpreter', - '<...>-1837 [000] ...1 875292.742853: tracing_mark_write: ' + - 'SyncInterpret: start: IirFilterInterpreter', // 14 - '<...>-1837 [000] ...1 875292.742861: tracing_mark_write: ' + - 'SyncInterpret: start: PalmClassifyingFilterInterpreter', - '<...>-1837 [000] ...1 875292.742872: tracing_mark_write: ' + - 'SyncInterpret: start: ClickWiggleFilterInterpreter', - '<...>-1837 [000] ...1 875292.742881: tracing_mark_write: ' + - 'SyncInterpret: start: FlingStopFilterInterpreter', - '<...>-1837 [000] ...1 875292.742887: tracing_mark_write: ' + - 'SyncInterpret: start: ImmediateInterpreter', - '<...>-1837 [000] ...1 875292.742906: tracing_mark_write: ' + - 'SyncInterpret: end: ImmediateInterpreter', - '<...>-1837 [000] ...1 875292.742910: tracing_mark_write: ' + - 'SyncInterpret: end: FlingStopFilterInterpreter', - '<...>-1837 [000] ...1 875292.742914: tracing_mark_write: ' + - 'SyncInterpret: end: ClickWiggleFilterInterpreter', - '<...>-1837 [000] ...1 875292.742917: tracing_mark_write: ' + - 'SyncInterpret: end: PalmClassifyingFilterInterpreter', - '<...>-1837 [000] ...1 875292.742921: tracing_mark_write: ' + - 'SyncInterpret: end: IirFilterInterpreter', - '<...>-1837 [000] ...1 875292.742926: tracing_mark_write: ' + - 'HandleTimer: end: LookaheadFilterInterpreter', - '<...>-1837 [000] ...1 875292.742929: tracing_mark_write: ' + - 'HandleTimer: end: BoxFilterInterpreter', - '<...>-1837 [000] ...1 875292.742932: tracing_mark_write: ' + - 'HandleTimer: end: SensorJumpFilterInterpreter', - '<...>-1837 [000] ...1 875292.742937: tracing_mark_write: ' + - 'HandleTimer: end: AccelFilterInterpreter', - '<...>-1837 [000] ...1 875292.742940: tracing_mark_write: ' + - 'HandleTimer: end: SplitCorrectingFilterInterpreter', - '<...>-1837 [000] ...1 875292.742944: tracing_mark_write: ' + - 'HandleTimer: end: ScalingFilterInterpreter', - '<...>-1837 [000] ...1 875292.742949: tracing_mark_write: ' + - 'HandleTimer: end: IntegralGestureFilterInterpreter', - '<...>-1837 [000] ...1 875292.742952: tracing_mark_write: ' + - 'HandleTimer: end: StuckButtonInhibitorFilterInterpreter', - '<...>-1837 [000] ...1 875292.742956: tracing_mark_write: ' + - 'HandleTimer: end: T5R2CorrectingFilterInterpreter', - '<...>-1837 [000] ...1 875292.742959: tracing_mark_write: ' + - 'HandleTimer: end: Cr48ProfileSensorFilterInterpreter', - '<...>-1837 [000] ...1 875292.742962: tracing_mark_write: ' + - 'HandleTimer: end: AppleTrackpadFilterInterpreter', - '<...>-1837 [000] ...1 875292.742966: tracing_mark_write: ' + - 'HandleTimer: end: LoggingFilterInterpreter', - '<...>-1837 [000] ...1 875292.742969: tracing_mark_write: ' + - 'log: start: TimerLogOutputs', - '<...>-1837 [000] ...1 875292.742973: tracing_mark_write: ' + - 'log: end: TimerLogOutputs', - '<...>-1837 [000] ...1 875292.795219: tracing_mark_write: ' + - 'log: start: LogHardwareState', - '<...>-1837 [000] ...1 875292.795231: tracing_mark_write: ' + - 'log: end: LogHardwareState' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var gestureThread = threads[0]; - assert.equal(gestureThread.name, 'gesture'); - assert.equal(gestureThread.sliceGroup.length, 21); - assert.equal('touchpad_gesture', - gestureThread.sliceGroup.slices[0].category); - assert.equal('GestureLog', - gestureThread.sliceGroup.slices[0].title); - assert.equal('touchpad_gesture', - gestureThread.sliceGroup.slices[2].category); - assert.equal('HandleTimer', - gestureThread.sliceGroup.slices[2].title); - assert.equal('touchpad_gesture', - gestureThread.sliceGroup.slices[14].category); - assert.equal('SyncInterpret', - gestureThread.sliceGroup.slices[14].title); - }); - - test('unusualStart', function() { - var lines = [ - 'X-30368 [000] ...1 1819362.481867: tracing_mark_write: ' + - 'SyncInterpret: start: IirFilterInterpreter', - 'X-30368 [000] ...1 1819362.481881: tracing_mark_write: ' + - 'SyncInterpret: start: PalmClassifyingFilterInterpreter', - 'X-30368 [000] ...1 1819362.481894: tracing_mark_write: ' + - 'SyncInterpret: start: ClickWiggleFilterInterpreter', - 'X-30368 [000] ...1 1819362.481905: tracing_mark_write: ' + - 'SyncInterpret: start: FlingStopFilterInterpreter', - 'X-30368 [000] ...1 1819362.481912: tracing_mark_write: ' + - 'SyncInterpret: start: ImmediateInterpreter', - 'X-30368 [000] ...1 1819362.481933: tracing_mark_write: ' + - 'SyncInterpret: end: ImmediateInterpreter', - 'X-30368 [000] ...1 1819362.481938: tracing_mark_write: ' + - 'SyncInterpret: end: FlingStopFilterInterpreter', - 'X-30368 [000] ...1 1819362.481943: tracing_mark_write: ' + - 'SyncInterpret: end: ClickWiggleFilterInterpreter', - 'X-30368 [000] ...1 1819362.481947: tracing_mark_write: ' + - 'SyncInterpret: end: PalmClassifyingFilterInterpreter', - 'X-30368 [000] ...1 1819362.481952: tracing_mark_write: ' + - 'SyncInterpret: end: IirFilterInterpreter', - 'X-30368 [000] ...1 1819362.481958: tracing_mark_write: ' + - 'HandleTimer: end: LookaheadFilterInterpreter', - 'X-30368 [000] ...1 1819362.481962: tracing_mark_write: ' + - 'HandleTimer: end: BoxFilterInterpreter', - 'X-30368 [000] ...1 1819362.481967: tracing_mark_write: ' + - 'HandleTimer: end: SensorJumpFilterInterpreter', - 'X-30368 [000] ...1 1819362.481973: tracing_mark_write: ' + - 'HandleTimer: end: AccelFilterInterpreter', - 'X-30368 [000] ...1 1819362.481977: tracing_mark_write: ' + - 'HandleTimer: end: SplitCorrectingFilterInterpreter', - 'X-30368 [000] ...1 1819362.481982: tracing_mark_write: ' + - 'HandleTimer: end: ScalingFilterInterpreter', - 'X-30368 [000] ...1 1819362.481988: tracing_mark_write: ' + - 'HandleTimer: end: IntegralGestureFilterInterpreter', - 'X-30368 [000] ...1 1819362.481993: tracing_mark_write: ' + - 'HandleTimer: end: StuckButtonInhibitorFilterInterpreter', - 'X-30368 [000] ...1 1819362.481998: tracing_mark_write: ' + - 'HandleTimer: end: T5R2CorrectingFilterInterpreter', - 'X-30368 [000] ...1 1819362.482033: tracing_mark_write: ' + - 'HandleTimer: end: Cr48ProfileSensorFilterInterpreter', - 'X-30368 [000] ...1 1819362.482038: tracing_mark_write: ' + - 'HandleTimer: end: AppleTrackpadFilterInterpreter', - 'X-30368 [000] ...1 1819362.482043: tracing_mark_write: ' + - 'HandleTimer: end: LoggingFilterInterpreter', - 'X-30368 [000] ...1 1819362.482047: tracing_mark_write: ' + - 'log: start: TimerLogOutputs', - 'X-30368 [000] ...1 1819362.482053: tracing_mark_write: ' + - 'log: end: TimerLogOutputs' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - }); - - test('importError', function() { - var lines = [ - 'X-30368 [000] ...1 1819362.481912: tracing_mark_write: ' + - 'SyncInterpret: start: ImmediateInterpreter', - 'X-30368 [000] ...1 1819362.481958: tracing_mark_write: ' + - 'HandleTimer: end: LookaheadFilterInterpreter', - 'X-30368 [000] ...1 1819362.481962: tracing_mark_write: ' + - 'HandleTimer: end: BoxFilterInterpreter', - 'X-30368 [000] ...1 1819362.481967: tracing_mark_write: ' + - 'HandleTimer: end: SensorJumpFilterInterpreter', - 'X-30368 [000] ...1 1819362.481973: tracing_mark_write: ' + - 'HandleTimer: end: AccelFilterInterpreter', - 'X-30368 [000] ...1 1819362.481977: tracing_mark_write: ' + - 'HandleTimer: end: SplitCorrectingFilterInterpreter', - 'X-30368 [000] ...1 1819362.481982: tracing_mark_write: ' + - 'HandleTimer: end: ScalingFilterInterpreter', - 'X-30368 [000] ...1 1819362.481988: tracing_mark_write: ' + - 'HandleTimer: end: IntegralGestureFilterInterpreter' - ]; - var m = newModel(lines.join('\n')); - - assert.isTrue(m.hasImportWarnings); - assert.equal(m.importWarnings.length, 7); - }); -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/i915_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/i915_parser.html deleted file mode 100644 index 91c733a0e11..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/i915_parser.html +++ /dev/null @@ -1,371 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses i915 driver events in the Linux event trace format. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - var ColorScheme = tr.b.ColorScheme; - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses linux i915 trace events. - * @constructor - */ - function I915Parser(importer) { - Parser.call(this, importer); - - importer.registerEventHandler('i915_gem_object_create', - I915Parser.prototype.gemObjectCreateEvent.bind(this)); - importer.registerEventHandler('i915_gem_object_bind', - I915Parser.prototype.gemObjectBindEvent.bind(this)); - importer.registerEventHandler('i915_gem_object_unbind', - I915Parser.prototype.gemObjectBindEvent.bind(this)); - importer.registerEventHandler('i915_gem_object_change_domain', - I915Parser.prototype.gemObjectChangeDomainEvent.bind(this)); - importer.registerEventHandler('i915_gem_object_pread', - I915Parser.prototype.gemObjectPreadWriteEvent.bind(this)); - importer.registerEventHandler('i915_gem_object_pwrite', - I915Parser.prototype.gemObjectPreadWriteEvent.bind(this)); - importer.registerEventHandler('i915_gem_object_fault', - I915Parser.prototype.gemObjectFaultEvent.bind(this)); - importer.registerEventHandler('i915_gem_object_clflush', - // NB: reuse destroy handler - I915Parser.prototype.gemObjectDestroyEvent.bind(this)); - importer.registerEventHandler('i915_gem_object_destroy', - I915Parser.prototype.gemObjectDestroyEvent.bind(this)); - importer.registerEventHandler('i915_gem_ring_dispatch', - I915Parser.prototype.gemRingDispatchEvent.bind(this)); - importer.registerEventHandler('i915_gem_ring_flush', - I915Parser.prototype.gemRingFlushEvent.bind(this)); - importer.registerEventHandler('i915_gem_request', - I915Parser.prototype.gemRequestEvent.bind(this)); - importer.registerEventHandler('i915_gem_request_add', - I915Parser.prototype.gemRequestEvent.bind(this)); - importer.registerEventHandler('i915_gem_request_complete', - I915Parser.prototype.gemRequestEvent.bind(this)); - importer.registerEventHandler('i915_gem_request_retire', - I915Parser.prototype.gemRequestEvent.bind(this)); - importer.registerEventHandler('i915_gem_request_wait_begin', - I915Parser.prototype.gemRequestEvent.bind(this)); - importer.registerEventHandler('i915_gem_request_wait_end', - I915Parser.prototype.gemRequestEvent.bind(this)); - importer.registerEventHandler('i915_gem_ring_wait_begin', - I915Parser.prototype.gemRingWaitEvent.bind(this)); - importer.registerEventHandler('i915_gem_ring_wait_end', - I915Parser.prototype.gemRingWaitEvent.bind(this)); - importer.registerEventHandler('i915_reg_rw', - I915Parser.prototype.regRWEvent.bind(this)); - importer.registerEventHandler('i915_flip_request', - I915Parser.prototype.flipEvent.bind(this)); - importer.registerEventHandler('i915_flip_complete', - I915Parser.prototype.flipEvent.bind(this)); - importer.registerEventHandler('intel_gpu_freq_change', - I915Parser.prototype.gpuFrequency.bind(this)); - } - - I915Parser.prototype = { - __proto__: Parser.prototype, - - i915FlipOpenSlice: function(ts, obj, plane) { - // use i915_flip_obj_plane? - var kthread = this.importer.getOrCreatePseudoThread('i915_flip'); - kthread.openSliceTS = ts; - kthread.openSlice = 'flip:' + obj + '/' + plane; - }, - - i915FlipCloseSlice: function(ts, args) { - var kthread = this.importer.getOrCreatePseudoThread('i915_flip'); - if (kthread.openSlice) { - var slice = new tr.model.Slice('', kthread.openSlice, - ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice), - kthread.openSliceTS, - args, - ts - kthread.openSliceTS); - - kthread.thread.sliceGroup.pushSlice(slice); - } - kthread.openSlice = undefined; - }, - - i915GemObjectSlice: function(ts, eventName, obj, args) { - var kthread = this.importer.getOrCreatePseudoThread('i915_gem'); - kthread.openSlice = eventName + ':' + obj; - var slice = new tr.model.Slice('', kthread.openSlice, - ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice), - ts, args, 0); - - kthread.thread.sliceGroup.pushSlice(slice); - }, - - i915GemRingSlice: function(ts, eventName, dev, ring, args) { - var kthread = this.importer.getOrCreatePseudoThread('i915_gem_ring'); - kthread.openSlice = eventName + ':' + dev + '.' + ring; - var slice = new tr.model.Slice('', kthread.openSlice, - ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice), - ts, args, 0); - - kthread.thread.sliceGroup.pushSlice(slice); - }, - - i915RegSlice: function(ts, eventName, reg, args) { - var kthread = this.importer.getOrCreatePseudoThread('i915_reg'); - kthread.openSlice = eventName + ':' + reg; - var slice = new tr.model.Slice('', kthread.openSlice, - ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice), - ts, args, 0); - - kthread.thread.sliceGroup.pushSlice(slice); - }, - - i915FreqChangeSlice: function(ts, eventName, args) { - var kthread = this.importer.getOrCreatePseudoThread('i915_gpu_freq'); - kthread.openSlice = eventName; - var slice = new tr.model.Slice('', kthread.openSlice, - ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice), - ts, args, 0); - - kthread.thread.sliceGroup.pushSlice(slice); - }, - - /** - * Parses i915 driver events and sets up state in the importer. - */ - gemObjectCreateEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /obj=(\w+), size=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - var obj = event[1]; - var size = parseInt(event[2]); - this.i915GemObjectSlice(ts, eventName, obj, - { - obj: obj, - size: size - }); - return true; - }, - - gemObjectBindEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - // TODO(sleffler) mappable - var event = /obj=(\w+), offset=(\w+), size=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - var obj = event[1]; - var offset = event[2]; - var size = parseInt(event[3]); - this.i915ObjectGemSlice(ts, eventName + ':' + obj, - { - obj: obj, - offset: offset, - size: size - }); - return true; - }, - - gemObjectChangeDomainEvent: function(eventName, cpuNumber, pid, ts, - eventBase) { - var event = /obj=(\w+), read=(\w+=>\w+), write=(\w+=>\w+)/ - .exec(eventBase.details); - if (!event) - return false; - - var obj = event[1]; - var read = event[2]; - var write = event[3]; - this.i915GemObjectSlice(ts, eventName, obj, - { - obj: obj, - read: read, - write: write - }); - return true; - }, - - gemObjectPreadWriteEvent: function(eventName, cpuNumber, pid, ts, - eventBase) { - var event = /obj=(\w+), offset=(\d+), len=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - var obj = event[1]; - var offset = parseInt(event[2]); - var len = parseInt(event[3]); - this.i915GemObjectSlice(ts, eventName, obj, - { - obj: obj, - offset: offset, - len: len - }); - return true; - }, - - gemObjectFaultEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - // TODO(sleffler) writable - var event = /obj=(\w+), (\w+) index=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - var obj = event[1]; - var type = event[2]; - var index = parseInt(event[3]); - this.i915GemObjectSlice(ts, eventName, obj, - { - obj: obj, - type: type, - index: index - }); - return true; - }, - - gemObjectDestroyEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /obj=(\w+)/.exec(eventBase.details); - if (!event) - return false; - - var obj = event[1]; - this.i915GemObjectSlice(ts, eventName, obj, - { - obj: obj - }); - return true; - }, - - gemRingDispatchEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - var dev = parseInt(event[1]); - var ring = parseInt(event[2]); - var seqno = parseInt(event[3]); - this.i915GemRingSlice(ts, eventName, dev, ring, - { - dev: dev, - ring: ring, - seqno: seqno - }); - return true; - }, - - gemRingFlushEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /dev=(\d+), ring=(\w+), invalidate=(\w+), flush=(\w+)/ - .exec(eventBase.details); - if (!event) - return false; - - var dev = parseInt(event[1]); - var ring = parseInt(event[2]); - var invalidate = event[3]; - var flush = event[4]; - this.i915GemRingSlice(ts, eventName, dev, ring, - { - dev: dev, - ring: ring, - invalidate: invalidate, - flush: flush - }); - return true; - }, - - gemRequestEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - var dev = parseInt(event[1]); - var ring = parseInt(event[2]); - var seqno = parseInt(event[3]); - this.i915GemRingSlice(ts, eventName, dev, ring, - { - dev: dev, - ring: ring, - seqno: seqno - }); - return true; - }, - - gemRingWaitEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /dev=(\d+), ring=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - var dev = parseInt(event[1]); - var ring = parseInt(event[2]); - this.i915GemRingSlice(ts, eventName, dev, ring, - { - dev: dev, - ring: ring - }); - return true; - }, - - regRWEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /(\w+) reg=(\w+), len=(\d+), val=(\(\w+, \w+\))/ - .exec(eventBase.details); - if (!event) - return false; - - var rw = event[1]; - var reg = event[2]; - var len = event[3]; - var data = event[3]; - this.i915RegSlice(ts, rw, reg, - { - rw: rw, - reg: reg, - len: len, - data: data - }); - return true; - }, - - flipEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /plane=(\d+), obj=(\w+)/.exec(eventBase.details); - if (!event) - return false; - - var plane = parseInt(event[1]); - var obj = event[2]; - if (eventName == 'i915_flip_request') - this.i915FlipOpenSlice(ts, obj, plane); - else - this.i915FlipCloseSlice(ts, - { - obj: obj, - plane: plane - }); - return true; - }, - - gpuFrequency: function(eventName, cpuNumver, pid, ts, eventBase) { - var event = /new_freq=(\d+)/.exec(eventBase.details); - if (!event) - return false; - var freq = parseInt(event[1]); - - this.i915FreqChangeSlice(ts, eventName, { - freq: freq - }); - return true; - } - }; - - Parser.register(I915Parser); - - return { - I915Parser: I915Parser - }; -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/i915_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/i915_parser_test.html deleted file mode 100644 index cc62910919f..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/i915_parser_test.html +++ /dev/null @@ -1,105 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - test('i915Import', function() { - var lines = [ - // NB: spliced from different traces; mismatched timestamps don't matter - ' chrome-1223 [000] 2784.773556: i915_gem_object_pwrite: ' + - 'obj=ffff88013f13fc00, offset=0, len=2984', - ' chrome-1539 [000] 18420.677750: ' + - 'i915_gem_object_change_domain: ' + - 'obj=ffff8800a88d1400, read=44=>40, write=00=>40', - ' chrome-1539 [000] 18420.677759: i915_gem_object_fault: ' + - 'obj=ffff8800a88d1400, GTT index=0 , writable', - ' X-964 [000] 2784.774864: i915_flip_request: ' + - 'plane=0, obj=ffff88013f0b9a00', - ' <idle>-0 [000] 2784.788644: i915_flip_complete: ' + - 'plane=0, obj=ffff88013f0b9a00', - ' chrome-1539 [001] 18420.681687: i915_gem_request_retire: ' + - 'dev=0, ring=1, seqno=1178152', - ' chrome-1539 [000] 18422.955688: i915_gem_request_add: ' + - 'dev=0, ring=1, seqno=1178364', - ' cat-21833 [000] 18422.956832: i915_gem_request_complete: ' + - 'dev=0, ring=1, seqno=1178364', - ' X-1012 [001] 18420.682511: i915_gem_request_wait_begin: ' + - 'dev=0, ring=4, seqno=1178156', - ' X-1012 [000] 18422.765707: i915_gem_request_wait_end: ' + - 'dev=0, ring=4, seqno=1178359', - ' chrome-1539 [000] 18422.955655: i915_gem_ring_flush: ' + - 'dev=0, ring=1, invalidate=001e, flush=0040', - ' chrome-1539 [000] 18422.955660: i915_gem_ring_dispatch: ' + - 'dev=0, ring=1, seqno=1178364', - ' chrome-1539 [000] 18420.677772: i915_reg_rw: ' + - 'write reg=0x100030, len=8, val=(0xfca9001, 0xfce8007)', - ' kworker/u16:2-13998 [005] 1577664.436065: ' + - 'intel_gpu_freq_change: new_freq=350' - - ]; - var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], { - shiftWorldToZero: false - }); - assert.isFalse(m.hasImportWarnings); - - var i915GemThread = undefined; - var i915FlipThread = undefined; - var i915GemRingThread = undefined; - var i915RegThread = undefined; - var i915GpuFreqThread = undefined; - m.getAllThreads().forEach(function(t) { - switch (t.name) { - case 'i915_gem': - i915GemThread = t; - break; - case 'i915_flip': - i915FlipThread = t; - break; - case 'i915_gem_ring': - i915GemRingThread = t; - break; - case 'i915_reg': - i915RegThread = t; - break; - case 'i915_gpu_freq': - i915GpuFreqThread = t; - break; - default: - throw new unittest.TestError('Unexpected thread named ' + t.name); - } - }); - assert.isDefined(i915GemThread); - assert.isDefined(i915FlipThread); - assert.isDefined(i915GemRingThread); - assert.isDefined(i915RegThread); - assert.isDefined(i915GpuFreqThread); - - assert.equal(i915GemThread.sliceGroup.length, 3); - - assert.equal(i915FlipThread.sliceGroup.length, 1); - - assert.closeTo( - 2784.774864 * 1000.0, - i915FlipThread.sliceGroup.slices[0].start, - 1e-5); - assert.closeTo( - (2784.788644 - 2784.774864) * 1000.0, - i915FlipThread.sliceGroup.slices[0].duration, - 1e-5); - - assert.equal(i915GemRingThread.sliceGroup.length, 7); - assert.equal(i915RegThread.sliceGroup.length, 1); - assert.equal(i915GpuFreqThread.sliceGroup.length, 1); - }); -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/irq_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/irq_parser.html deleted file mode 100644 index 24903ae3133..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/irq_parser.html +++ /dev/null @@ -1,184 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2014 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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses drm driver events in the Linux event trace format. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - - var ColorScheme = tr.b.ColorScheme; - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses linux irq trace events. - * @constructor - */ - function IrqParser(importer) { - Parser.call(this, importer); - - importer.registerEventHandler('irq_handler_entry', - IrqParser.prototype.irqHandlerEntryEvent.bind(this)); - importer.registerEventHandler('irq_handler_exit', - IrqParser.prototype.irqHandlerExitEvent.bind(this)); - importer.registerEventHandler('softirq_raise', - IrqParser.prototype.softirqRaiseEvent.bind(this)); - importer.registerEventHandler('softirq_entry', - IrqParser.prototype.softirqEntryEvent.bind(this)); - importer.registerEventHandler('softirq_exit', - IrqParser.prototype.softirqExitEvent.bind(this)); - importer.registerEventHandler('ipi_entry', - IrqParser.prototype.ipiEntryEvent.bind(this)); - importer.registerEventHandler('ipi_exit', - IrqParser.prototype.ipiExitEvent.bind(this)); - } - - // Matches the irq_handler_entry record - var irqHandlerEntryRE = /irq=(\d+) name=(.+)/; - - // Matches the irq_handler_exit record - var irqHandlerExitRE = /irq=(\d+) ret=(.+)/; - - // Matches the softirq_raise record - var softirqRE = /vec=(\d+) \[action=(.+)\]/; - - // Matches the ipi_exit_ - var ipiHandlerExitRE = /\((.+)\)/; - - IrqParser.prototype = { - __proto__: Parser.prototype, - - /** - * Parses irq events and sets up state in the mporter. - */ - irqHandlerEntryEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = irqHandlerEntryRE.exec(eventBase.details); - if (!event) - return false; - - var irq = parseInt(event[1]); - var name = event[2]; - - var thread = this.importer.getOrCreatePseudoThread( - 'irqs cpu ' + cpuNumber); - thread.lastEntryTs = ts; - thread.irqName = name; - - return true; - }, - - irqHandlerExitEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = irqHandlerExitRE.exec(eventBase.details); - if (!event) - return false; - - var irq = parseInt(event[1]); - var ret = event[2]; - var thread = this.importer.getOrCreatePseudoThread( - 'irqs cpu ' + cpuNumber); - - if (thread.lastEntryTs !== undefined) { - var duration = ts - thread.lastEntryTs; - var slice = new tr.model.Slice( - '', - 'IRQ (' + thread.irqName + ')', - ColorScheme.getColorIdForGeneralPurposeString(event[1]), - thread.lastEntryTs, { ret: ret }, - duration); - thread.thread.sliceGroup.pushSlice(slice); - } - thread.lastEntryTs = undefined; - thread.irqName = undefined; - return true; - }, - - softirqRaiseEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - return true; - }, - - softirqEntryEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = softirqRE.exec(eventBase.details); - if (!event) - return false; - - var action = event[2]; - var thread = this.importer.getOrCreatePseudoThread( - 'softirq cpu ' + cpuNumber); - thread.lastEntryTs = ts; - - return true; - }, - - softirqExitEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = softirqRE.exec(eventBase.details); - if (!event) - return false; - - var vec = parseInt(event[1]); - var action = event[2]; - var thread = this.importer.getOrCreatePseudoThread( - 'softirq cpu ' + cpuNumber); - - if (thread.lastEntryTs !== undefined) { - var duration = ts - thread.lastEntryTs; - var slice = new tr.model.Slice( - '', action, - ColorScheme.getColorIdForGeneralPurposeString(event[1]), - thread.lastEntryTs, { vec: vec }, - duration); - thread.thread.sliceGroup.pushSlice(slice); - } - thread.lastEntryTs = undefined; - return true; - }, - /** - * Parses ipi events and sets up state in the mporter. - */ - ipiEntryEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var thread = this.importer.getOrCreatePseudoThread( - 'irqs cpu ' + cpuNumber); - thread.lastEntryTs = ts; - - return true; - }, - - ipiExitEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = ipiHandlerExitRE.exec(eventBase.details); - if (!event) - return false; - - var ipiName = event[1]; - var thread = this.importer.getOrCreatePseudoThread( - 'irqs cpu ' + cpuNumber); - - if (thread.lastEntryTs !== undefined) { - var duration = ts - thread.lastEntryTs; - var slice = new tr.model.Slice( - '', - 'IPI (' + ipiName + ')', - ColorScheme.getColorIdForGeneralPurposeString(ipiName), - thread.lastEntryTs, - {}, - duration); - thread.thread.sliceGroup.pushSlice(slice); - } - thread.lastEntryTs = undefined; - return true; - } - }; - - Parser.register(IrqParser); - - return { - IrqParser: IrqParser - }; -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/irq_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/irq_parser_test.html deleted file mode 100644 index 647bd821e73..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/irq_parser_test.html +++ /dev/null @@ -1,51 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - test('irqImport', function() { - var lines = [ - ' kworker/u4:1-31907 (31907) [001] d.h3 14063.748288: ' + - 'irq_handler_entry: irq=27 name=arch_timer', - ' kworker/u4:1-31907 (31907) [001] dNh3 14063.748384: ' + - 'irq_handler_exit: irq=27 ret=handled', - ' kworker/u4:2-31908 (31908) [000] ..s3 14063.477231: ' + - 'softirq_entry: vec=9 [action=RCU]', - ' kworker/u4:2-31908 (31908) [000] ..s3 14063.477246: ' + - 'softirq_exit: vec=9 [action=RCU]', - ' RenderThread-2978 ( 2794) [002] dN.1 62828.421805: ' + - 'ipi_entry: (Rescheduling interrupts)', - ' RenderThread-2978 ( 2794) [002] dN.1 62828.421809: ' + - 'ipi_exit: (Rescheduling interrupts)' - ]; - var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], { - shiftWorldToZero: false - }); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 3); - - var threads = m.findAllThreadsNamed('irqs cpu 1'); - assert.equal(threads.length, 1); - assert.equal(threads[0].sliceGroup.length, 1); - - var threads = m.findAllThreadsNamed('softirq cpu 0'); - assert.equal(threads.length, 1); - assert.equal(threads[0].sliceGroup.length, 1); - - var threads = m.findAllThreadsNamed('irqs cpu 2'); - assert.equal(threads.length, 1); - assert.equal(threads[0].sliceGroup.length, 1); - }); -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/kfunc_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/kfunc_parser.html deleted file mode 100644 index 72dbc71e512..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/kfunc_parser.html +++ /dev/null @@ -1,113 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses graph_ent and graph_ret events that were inserted by - * the Linux kernel's function graph trace. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - - var LinuxPerfParser = tr.e.importer.linux_perf.Parser; - - /** - * Parses graph_ent and graph_ret events that were inserted by the Linux - * kernel's function graph trace. - * @constructor - */ - function KernelFuncParser(importer) { - LinuxPerfParser.call(this, importer); - - importer.registerEventHandler('graph_ent', - KernelFuncParser.prototype.traceKernelFuncEnterEvent. - bind(this)); - importer.registerEventHandler('graph_ret', - KernelFuncParser.prototype.traceKernelFuncReturnEvent. - bind(this)); - - this.model_ = importer.model_; - this.ppids_ = {}; - } - - var TestExports = {}; - - var funcEnterRE = new RegExp('func=(.+)'); - TestExports.funcEnterRE = funcEnterRE; - - KernelFuncParser.prototype = { - __proto__: LinuxPerfParser.prototype, - - traceKernelFuncEnterEvent: function(eventName, cpuNumber, pid, ts, - eventBase) { - var eventData = funcEnterRE.exec(eventBase.details); - if (!eventData) - return false; - - if (eventBase.tgid === undefined) { - return false; - } - - var tgid = parseInt(eventBase.tgid); - var name = eventData[1]; - var thread = this.model_.getOrCreateProcess(tgid) - .getOrCreateThread(pid); - thread.name = eventBase.threadName; - - var slices = thread.kernelSliceGroup; - if (!slices.isTimestampValidForBeginOrEnd(ts)) { - this.model_.importWarning({ - type: 'parse_error', - message: 'Timestamps are moving backward.' - }); - return false; - } - - var slice = slices.beginSlice(null, name, ts, {}); - - return true; - }, - - traceKernelFuncReturnEvent: function(eventName, cpuNumber, pid, ts, - eventBase) { - if (eventBase.tgid === undefined) { - return false; - } - - var tgid = parseInt(eventBase.tgid); - var thread = this.model_.getOrCreateProcess(tgid) - .getOrCreateThread(pid); - thread.name = eventBase.threadName; - - var slices = thread.kernelSliceGroup; - if (!slices.isTimestampValidForBeginOrEnd(ts)) { - this.model_.importWarning({ - type: 'parse_error', - message: 'Timestamps are moving backward.' - }); - return false; - } - - if (slices.openSliceCount > 0) { - slices.endSlice(ts); - } - - return true; - } - }; - - LinuxPerfParser.register(KernelFuncParser); - - return { - KernelFuncParser: KernelFuncParser - }; -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/kfunc_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/kfunc_parser_test.html deleted file mode 100644 index 5d7dfd67526..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/kfunc_parser_test.html +++ /dev/null @@ -1,60 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - test('kernelFunctionParser', function() { - var lines = [ - 'Binder_2-127 ( 127) [001] .... 3431.906759: graph_ent: func=sys_write', - 'Binder_2-127 ( 127) [001] .... 3431.906769: graph_ret: func=sys_write', - 'Binder_2-127 ( 127) [001] .... 3431.906785: graph_ent: func=sys_write', - 'Binder_2-127 ( 127) [001] ...1 3431.906798: tracing_mark_write: B|' + - '127|dequeueBuffer', - 'Binder_2-127 ( 127) [001] .... 3431.906802: graph_ret: func=sys_write', - 'Binder_2-127 ( 127) [001] .... 3431.906842: graph_ent: func=sys_write', - 'Binder_2-127 ( 127) [001] ...1 3431.906849: tracing_mark_write: E', - 'Binder_2-127 ( 127) [001] .... 3431.906853: graph_ret: func=sys_write', - 'Binder_2-127 ( 127) [001] .... 3431.906896: graph_ent: func=sys_write', - 'Binder_2-127 ( 127) [001] .... 3431.906906: graph_ret: func=sys_write' - ]; - var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], { - shiftWorldToZero: false - }); - assert.isFalse(m.hasImportWarnings); - - var process = m.processes[127]; - assert.isDefined(process); - - var thread = process.threads[127]; - assert.isDefined(thread); - - var slices = thread.sliceGroup.slices; - assert.equal(thread.sliceGroup.length, 7); - - // Slice 0 is an un-split sys_write - assert.equal(slices[0].title, 'sys_write'); - - // Slices 1 & 3 are a split sys_write - assert.equal(slices[1].title, 'sys_write'); - assert.equal(slices[2].title, 'dequeueBuffer'); - assert.equal(slices[3].title, 'sys_write (cont.)'); - - // Slices 4 & 5 are a split sys_write with the dequeueBuffer in between - assert.equal(slices[4].title, 'sys_write'); - assert.equal(slices[5].title, 'sys_write (cont.)'); - - // Slice 6 is another un-split sys_write - assert.equal(slices[6].title, 'sys_write'); - }); -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/mali_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/mali_parser.html deleted file mode 100644 index 0516805f740..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/mali_parser.html +++ /dev/null @@ -1,568 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses Mali DDK/kernel events in the Linux event trace format. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - - var ColorScheme = tr.b.ColorScheme; - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses Mali DDK/kernel trace events. - * @constructor - */ - function MaliParser(importer) { - Parser.call(this, importer); - - // kernel DVFS events - importer.registerEventHandler('mali_dvfs_event', - MaliParser.prototype.dvfsEventEvent.bind(this)); - importer.registerEventHandler('mali_dvfs_set_clock', - MaliParser.prototype.dvfsSetClockEvent.bind(this)); - importer.registerEventHandler('mali_dvfs_set_voltage', - MaliParser.prototype.dvfsSetVoltageEvent.bind(this)); - - // kernel Mali hw counter events - this.addJMCounter('mali_hwc_MESSAGES_SENT', 'Messages Sent'); - this.addJMCounter('mali_hwc_MESSAGES_RECEIVED', 'Messages Received'); - this.addJMCycles('mali_hwc_GPU_ACTIVE', 'GPU Active'); - this.addJMCycles('mali_hwc_IRQ_ACTIVE', 'IRQ Active'); - - for (var i = 0; i < 7; i++) { - var jobStr = 'JS' + i; - var jobHWCStr = 'mali_hwc_' + jobStr; - this.addJMCounter(jobHWCStr + '_JOBS', jobStr + ' Jobs'); - this.addJMCounter(jobHWCStr + '_TASKS', jobStr + ' Tasks'); - this.addJMCycles(jobHWCStr + '_ACTIVE', jobStr + ' Active'); - this.addJMCycles(jobHWCStr + '_WAIT_READ', jobStr + ' Wait Read'); - this.addJMCycles(jobHWCStr + '_WAIT_ISSUE', jobStr + ' Wait Issue'); - this.addJMCycles(jobHWCStr + '_WAIT_DEPEND', jobStr + ' Wait Depend'); - this.addJMCycles(jobHWCStr + '_WAIT_FINISH', jobStr + ' Wait Finish'); - } - - this.addTilerCounter('mali_hwc_TRIANGLES', 'Triangles'); - this.addTilerCounter('mali_hwc_QUADS', 'Quads'); - this.addTilerCounter('mali_hwc_POLYGONS', 'Polygons'); - this.addTilerCounter('mali_hwc_POINTS', 'Points'); - this.addTilerCounter('mali_hwc_LINES', 'Lines'); - this.addTilerCounter('mali_hwc_VCACHE_HIT', 'VCache Hit'); - this.addTilerCounter('mali_hwc_VCACHE_MISS', 'VCache Miss'); - this.addTilerCounter('mali_hwc_FRONT_FACING', 'Front Facing'); - this.addTilerCounter('mali_hwc_BACK_FACING', 'Back Facing'); - this.addTilerCounter('mali_hwc_PRIM_VISIBLE', 'Prim Visible'); - this.addTilerCounter('mali_hwc_PRIM_CULLED', 'Prim Culled'); - this.addTilerCounter('mali_hwc_PRIM_CLIPPED', 'Prim Clipped'); - - this.addTilerCounter('mali_hwc_WRBUF_HIT', 'Wrbuf Hit'); - this.addTilerCounter('mali_hwc_WRBUF_MISS', 'Wrbuf Miss'); - this.addTilerCounter('mali_hwc_WRBUF_LINE', 'Wrbuf Line'); - this.addTilerCounter('mali_hwc_WRBUF_PARTIAL', 'Wrbuf Partial'); - this.addTilerCounter('mali_hwc_WRBUF_STALL', 'Wrbuf Stall'); - - this.addTilerCycles('mali_hwc_ACTIVE', 'Tiler Active'); - this.addTilerCycles('mali_hwc_INDEX_WAIT', 'Index Wait'); - this.addTilerCycles('mali_hwc_INDEX_RANGE_WAIT', 'Index Range Wait'); - this.addTilerCycles('mali_hwc_VERTEX_WAIT', 'Vertex Wait'); - this.addTilerCycles('mali_hwc_PCACHE_WAIT', 'Pcache Wait'); - this.addTilerCycles('mali_hwc_WRBUF_WAIT', 'Wrbuf Wait'); - this.addTilerCycles('mali_hwc_BUS_READ', 'Bus Read'); - this.addTilerCycles('mali_hwc_BUS_WRITE', 'Bus Write'); - - this.addTilerCycles('mali_hwc_TILER_UTLB_STALL', 'Tiler UTLB Stall'); - this.addTilerCycles('mali_hwc_TILER_UTLB_HIT', 'Tiler UTLB Hit'); - - this.addFragCycles('mali_hwc_FRAG_ACTIVE', 'Active'); - /* NB: don't propagate spelling mistakes to labels */ - this.addFragCounter('mali_hwc_FRAG_PRIMATIVES', 'Primitives'); - this.addFragCounter('mali_hwc_FRAG_PRIMATIVES_DROPPED', - 'Primitives Dropped'); - this.addFragCycles('mali_hwc_FRAG_CYCLE_DESC', 'Descriptor Processing'); - this.addFragCycles('mali_hwc_FRAG_CYCLES_PLR', 'PLR Processing??'); - this.addFragCycles('mali_hwc_FRAG_CYCLES_VERT', 'Vertex Processing'); - this.addFragCycles('mali_hwc_FRAG_CYCLES_TRISETUP', 'Triangle Setup'); - this.addFragCycles('mali_hwc_FRAG_CYCLES_RAST', 'Rasterization???'); - this.addFragCounter('mali_hwc_FRAG_THREADS', 'Threads'); - this.addFragCounter('mali_hwc_FRAG_DUMMY_THREADS', 'Dummy Threads'); - this.addFragCounter('mali_hwc_FRAG_QUADS_RAST', 'Quads Rast'); - this.addFragCounter('mali_hwc_FRAG_QUADS_EZS_TEST', 'Quads EZS Test'); - this.addFragCounter('mali_hwc_FRAG_QUADS_EZS_KILLED', 'Quads EZS Killed'); - this.addFragCounter('mali_hwc_FRAG_QUADS_LZS_TEST', 'Quads LZS Test'); - this.addFragCounter('mali_hwc_FRAG_QUADS_LZS_KILLED', 'Quads LZS Killed'); - this.addFragCycles('mali_hwc_FRAG_CYCLE_NO_TILE', 'No Tiles'); - this.addFragCounter('mali_hwc_FRAG_NUM_TILES', 'Tiles'); - this.addFragCounter('mali_hwc_FRAG_TRANS_ELIM', 'Transactions Eliminated'); - - this.addComputeCycles('mali_hwc_COMPUTE_ACTIVE', 'Active'); - this.addComputeCounter('mali_hwc_COMPUTE_TASKS', 'Tasks'); - this.addComputeCounter('mali_hwc_COMPUTE_THREADS', 'Threads Started'); - this.addComputeCycles('mali_hwc_COMPUTE_CYCLES_DESC', - 'Waiting for Descriptors'); - - this.addTripipeCycles('mali_hwc_TRIPIPE_ACTIVE', 'Active'); - - this.addArithCounter('mali_hwc_ARITH_WORDS', 'Instructions (/Pipes)'); - this.addArithCycles('mali_hwc_ARITH_CYCLES_REG', - 'Reg scheduling stalls (/Pipes)'); - this.addArithCycles('mali_hwc_ARITH_CYCLES_L0', - 'L0 cache miss stalls (/Pipes)'); - this.addArithCounter('mali_hwc_ARITH_FRAG_DEPEND', - 'Frag dep check failures (/Pipes)'); - - this.addLSCounter('mali_hwc_LS_WORDS', 'Instruction Words Completed'); - this.addLSCounter('mali_hwc_LS_ISSUES', 'Full Pipeline Issues'); - this.addLSCounter('mali_hwc_LS_RESTARTS', 'Restarts (unpairable insts)'); - this.addLSCounter('mali_hwc_LS_REISSUES_MISS', - 'Pipeline reissue (cache miss/uTLB)'); - this.addLSCounter('mali_hwc_LS_REISSUES_VD', - 'Pipeline reissue (varying data)'); - /* TODO(sleffler) fix kernel event typo */ - this.addLSCounter('mali_hwc_LS_REISSUE_ATTRIB_MISS', - 'Pipeline reissue (attribute cache miss)'); - this.addLSCounter('mali_hwc_LS_REISSUE_NO_WB', 'Writeback not used'); - - this.addTexCounter('mali_hwc_TEX_WORDS', 'Words'); - this.addTexCounter('mali_hwc_TEX_BUBBLES', 'Bubbles'); - this.addTexCounter('mali_hwc_TEX_WORDS_L0', 'Words L0'); - this.addTexCounter('mali_hwc_TEX_WORDS_DESC', 'Words Desc'); - this.addTexCounter('mali_hwc_TEX_THREADS', 'Threads'); - this.addTexCounter('mali_hwc_TEX_RECIRC_FMISS', 'Recirc due to Full Miss'); - this.addTexCounter('mali_hwc_TEX_RECIRC_DESC', 'Recirc due to Desc Miss'); - this.addTexCounter('mali_hwc_TEX_RECIRC_MULTI', 'Recirc due to Multipass'); - this.addTexCounter('mali_hwc_TEX_RECIRC_PMISS', - 'Recirc due to Partial Cache Miss'); - this.addTexCounter('mali_hwc_TEX_RECIRC_CONF', - 'Recirc due to Cache Conflict'); - - this.addLSCCounter('mali_hwc_LSC_READ_HITS', 'Read Hits'); - this.addLSCCounter('mali_hwc_LSC_READ_MISSES', 'Read Misses'); - this.addLSCCounter('mali_hwc_LSC_WRITE_HITS', 'Write Hits'); - this.addLSCCounter('mali_hwc_LSC_WRITE_MISSES', 'Write Misses'); - this.addLSCCounter('mali_hwc_LSC_ATOMIC_HITS', 'Atomic Hits'); - this.addLSCCounter('mali_hwc_LSC_ATOMIC_MISSES', 'Atomic Misses'); - this.addLSCCounter('mali_hwc_LSC_LINE_FETCHES', 'Line Fetches'); - this.addLSCCounter('mali_hwc_LSC_DIRTY_LINE', 'Dirty Lines'); - this.addLSCCounter('mali_hwc_LSC_SNOOPS', 'Snoops'); - - this.addAXICounter('mali_hwc_AXI_TLB_STALL', 'Address channel stall'); - this.addAXICounter('mali_hwc_AXI_TLB_MISS', 'Cache Miss'); - this.addAXICounter('mali_hwc_AXI_TLB_TRANSACTION', 'Transactions'); - this.addAXICounter('mali_hwc_LS_TLB_MISS', 'LS Cache Miss'); - this.addAXICounter('mali_hwc_LS_TLB_HIT', 'LS Cache Hit'); - this.addAXICounter('mali_hwc_AXI_BEATS_READ', 'Read Beats'); - this.addAXICounter('mali_hwc_AXI_BEATS_WRITE', 'Write Beats'); - - this.addMMUCounter('mali_hwc_MMU_TABLE_WALK', 'Page Table Walks'); - this.addMMUCounter('mali_hwc_MMU_REPLAY_MISS', - 'Cache Miss from Replay Buffer'); - this.addMMUCounter('mali_hwc_MMU_REPLAY_FULL', 'Replay Buffer Full'); - this.addMMUCounter('mali_hwc_MMU_NEW_MISS', 'Cache Miss on New Request'); - this.addMMUCounter('mali_hwc_MMU_HIT', 'Cache Hit'); - - this.addMMUCycles('mali_hwc_UTLB_STALL', 'UTLB Stalled'); - this.addMMUCycles('mali_hwc_UTLB_REPLAY_MISS', 'UTLB Replay Miss'); - this.addMMUCycles('mali_hwc_UTLB_REPLAY_FULL', 'UTLB Replay Full'); - this.addMMUCycles('mali_hwc_UTLB_NEW_MISS', 'UTLB New Miss'); - this.addMMUCycles('mali_hwc_UTLB_HIT', 'UTLB Hit'); - - this.addL2Counter('mali_hwc_L2_READ_BEATS', 'Read Beats'); - this.addL2Counter('mali_hwc_L2_WRITE_BEATS', 'Write Beats'); - this.addL2Counter('mali_hwc_L2_ANY_LOOKUP', 'Any Lookup'); - this.addL2Counter('mali_hwc_L2_READ_LOOKUP', 'Read Lookup'); - this.addL2Counter('mali_hwc_L2_SREAD_LOOKUP', 'Shareable Read Lookup'); - this.addL2Counter('mali_hwc_L2_READ_REPLAY', 'Read Replayed'); - this.addL2Counter('mali_hwc_L2_READ_SNOOP', 'Read Snoop'); - this.addL2Counter('mali_hwc_L2_READ_HIT', 'Read Cache Hit'); - this.addL2Counter('mali_hwc_L2_CLEAN_MISS', 'CleanUnique Miss'); - this.addL2Counter('mali_hwc_L2_WRITE_LOOKUP', 'Write Lookup'); - this.addL2Counter('mali_hwc_L2_SWRITE_LOOKUP', 'Shareable Write Lookup'); - this.addL2Counter('mali_hwc_L2_WRITE_REPLAY', 'Write Replayed'); - this.addL2Counter('mali_hwc_L2_WRITE_SNOOP', 'Write Snoop'); - this.addL2Counter('mali_hwc_L2_WRITE_HIT', 'Write Cache Hit'); - this.addL2Counter('mali_hwc_L2_EXT_READ_FULL', 'ExtRD with BIU Full'); - this.addL2Counter('mali_hwc_L2_EXT_READ_HALF', 'ExtRD with BIU >1/2 Full'); - this.addL2Counter('mali_hwc_L2_EXT_WRITE_FULL', 'ExtWR with BIU Full'); - this.addL2Counter('mali_hwc_L2_EXT_WRITE_HALF', 'ExtWR with BIU >1/2 Full'); - - this.addL2Counter('mali_hwc_L2_EXT_READ', 'External Read (ExtRD)'); - this.addL2Counter('mali_hwc_L2_EXT_READ_LINE', 'ExtRD (linefill)'); - this.addL2Counter('mali_hwc_L2_EXT_WRITE', 'External Write (ExtWR)'); - this.addL2Counter('mali_hwc_L2_EXT_WRITE_LINE', 'ExtWR (linefill)'); - this.addL2Counter('mali_hwc_L2_EXT_WRITE_SMALL', 'ExtWR (burst size <64B)'); - this.addL2Counter('mali_hwc_L2_EXT_BARRIER', 'External Barrier'); - this.addL2Counter('mali_hwc_L2_EXT_AR_STALL', 'Address Read stalls'); - this.addL2Counter('mali_hwc_L2_EXT_R_BUF_FULL', - 'Response Buffer full stalls'); - this.addL2Counter('mali_hwc_L2_EXT_RD_BUF_FULL', - 'Read Data Buffer full stalls'); - this.addL2Counter('mali_hwc_L2_EXT_R_RAW', 'RAW hazard stalls'); - this.addL2Counter('mali_hwc_L2_EXT_W_STALL', 'Write Data stalls'); - this.addL2Counter('mali_hwc_L2_EXT_W_BUF_FULL', 'Write Data Buffer full'); - this.addL2Counter('mali_hwc_L2_EXT_R_W_HAZARD', 'WAW or WAR hazard stalls'); - this.addL2Counter('mali_hwc_L2_TAG_HAZARD', 'Tag hazard replays'); - this.addL2Cycles('mali_hwc_L2_SNOOP_FULL', 'Snoop buffer full'); - this.addL2Cycles('mali_hwc_L2_REPLAY_FULL', 'Replay buffer full'); - - // DDK events (from X server) - importer.registerEventHandler('tracing_mark_write:mali_driver', - MaliParser.prototype.maliDDKEvent.bind(this)); - - this.model_ = importer.model_; - } - - MaliParser.prototype = { - __proto__: Parser.prototype, - - maliDDKOpenSlice: function(pid, tid, ts, func, blockinfo) { - var thread = this.importer.model_.getOrCreateProcess(pid) - .getOrCreateThread(tid); - var funcArgs = /^([\w\d_]*)(?:\(\))?:?\s*(.*)$/.exec(func); - thread.sliceGroup.beginSlice('gpu-driver', funcArgs[1], ts, - { 'args': funcArgs[2], - 'blockinfo': blockinfo }); - }, - - maliDDKCloseSlice: function(pid, tid, ts, args, blockinfo) { - var thread = this.importer.model_.getOrCreateProcess(pid) - .getOrCreateThread(tid); - if (!thread.sliceGroup.openSliceCount) { - // Discard unmatched ends. - return; - } - thread.sliceGroup.endSlice(ts); - }, - - /** - * Deduce the format of Mali perf events. - * - * @return {RegExp} the regular expression for parsing data when the format - * is recognized; otherwise null. - */ - autoDetectLineRE: function(line) { - // Matches Mali perf events with thread info - var lineREWithThread = - /^\s*\(([\w\-]*)\)\s*(\w+):\s*([\w\\\/\.\-]*@\d*):?\s*(.*)$/; - if (lineREWithThread.test(line)) - return lineREWithThread; - - // Matches old-style Mali perf events - var lineRENoThread = /^s*()(\w+):\s*([\w\\\/.\-]*):?\s*(.*)$/; - if (lineRENoThread.test(line)) - return lineRENoThread; - return null; - }, - - lineRE: null, - - /** - * Parses maliDDK events and sets up state in the importer. - * events will come in pairs with a cros_trace_print_enter - * like this (line broken here for formatting): - * - * tracing_mark_write: mali_driver: (mali-012345) cros_trace_print_enter: \ - * gles/src/texture/mali_gles_texture_slave.c@1505: gles2_texturep_upload - * - * and a cros_trace_print_exit like this: - * - * tracing_mark_write: mali_driver: (mali-012345) cros_trace_print_exit: \ - * gles/src/texture/mali_gles_texture_slave.c@1505: - */ - maliDDKEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - if (this.lineRE == null) { - this.lineRE = this.autoDetectLineRE(eventBase.details); - if (this.lineRE == null) - return false; - } - var maliEvent = this.lineRE.exec(eventBase.details); - // Old-style Mali perf events have no thread id, so make one. - var tid = (maliEvent[1] === '' ? 'mali' : maliEvent[1]); - switch (maliEvent[2]) { - case 'cros_trace_print_enter': - this.maliDDKOpenSlice(pid, tid, ts, maliEvent[4], - maliEvent[3]); - break; - case 'cros_trace_print_exit': - this.maliDDKCloseSlice(pid, tid, ts, [], maliEvent[3]); - } - return true; - }, - - /* - * Kernel event support. - */ - - dvfsSample: function(counterName, seriesName, ts, s) { - var value = parseInt(s); - var counter = this.model_.kernel. - getOrCreateCounter('DVFS', counterName); - if (counter.numSeries === 0) { - counter.addSeries(new tr.model.CounterSeries(seriesName, - ColorScheme.getColorIdForGeneralPurposeString(counter.name))); - } - counter.series.forEach(function(series) { - series.addCounterSample(ts, value); - }); - }, - - dvfsEventEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /utilization=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - this.dvfsSample('DVFS Utilization', 'utilization', ts, event[1]); - return true; - }, - - dvfsSetClockEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /frequency=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - this.dvfsSample('DVFS Frequency', 'frequency', ts, event[1]); - return true; - }, - - dvfsSetVoltageEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /voltage=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - this.dvfsSample('DVFS Voltage', 'voltage', ts, event[1]); - return true; - }, - - hwcSample: function(cat, counterName, seriesName, ts, eventBase) { - var event = /val=(\d+)/.exec(eventBase.details); - if (!event) - return false; - var value = parseInt(event[1]); - - var counter = this.model_.kernel. - getOrCreateCounter(cat, counterName); - if (counter.numSeries === 0) { - counter.addSeries(new tr.model.CounterSeries(seriesName, - ColorScheme.getColorIdForGeneralPurposeString(counter.name))); - } - counter.series.forEach(function(series) { - series.addCounterSample(ts, value); - }); - return true; - }, - - /* - * Job Manager block counters. - */ - jmSample: function(ctrName, seriesName, ts, eventBase) { - return this.hwcSample('mali:jm', 'JM: ' + ctrName, seriesName, ts, - eventBase); - }, - addJMCounter: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.jmSample(hwcTitle, 'count', ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - addJMCycles: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.jmSample(hwcTitle, 'cycles', ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - - /* - * Tiler block counters. - */ - tilerSample: function(ctrName, seriesName, ts, eventBase) { - return this.hwcSample('mali:tiler', 'Tiler: ' + ctrName, seriesName, - ts, eventBase); - }, - addTilerCounter: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.tilerSample(hwcTitle, 'count', ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - addTilerCycles: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.tilerSample(hwcTitle, 'cycles', ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - - /* - * Fragment counters. - */ - fragSample: function(ctrName, seriesName, ts, eventBase) { - return this.hwcSample('mali:fragment', 'Fragment: ' + ctrName, - seriesName, ts, eventBase); - }, - addFragCounter: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.fragSample(hwcTitle, 'count', ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - addFragCycles: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.fragSample(hwcTitle, 'cycles', ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - - /* - * Compute counters. - */ - computeSample: function(ctrName, seriesName, ts, eventBase) { - return this.hwcSample('mali:compute', 'Compute: ' + ctrName, - seriesName, ts, eventBase); - }, - addComputeCounter: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.computeSample(hwcTitle, 'count', ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - addComputeCycles: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.computeSample(hwcTitle, 'cycles', ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - - /* - * Tripipe counters. - */ - addTripipeCycles: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.hwcSample('mali:shader', 'Tripipe: ' + hwcTitle, 'cycles', - ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - - /* - * Arith counters. - */ - arithSample: function(ctrName, seriesName, ts, eventBase) { - return this.hwcSample('mali:arith', 'Arith: ' + ctrName, seriesName, ts, - eventBase); - }, - addArithCounter: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.arithSample(hwcTitle, 'count', ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - addArithCycles: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.arithSample(hwcTitle, 'cycles', ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - - /* - * Load/Store counters. - */ - addLSCounter: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.hwcSample('mali:ls', 'LS: ' + hwcTitle, 'count', ts, - eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - - /* - * Texture counters. - */ - textureSample: function(ctrName, seriesName, ts, eventBase) { - return this.hwcSample('mali:texture', 'Texture: ' + ctrName, - seriesName, ts, eventBase); - }, - addTexCounter: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.textureSample(hwcTitle, 'count', ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - - /* - * LSC counters. - */ - addLSCCounter: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.hwcSample('mali:lsc', 'LSC: ' + hwcTitle, 'count', ts, - eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - - /* - * TLB counters. - */ - addAXICounter: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.hwcSample('mali:axi', 'AXI: ' + hwcTitle, 'count', ts, - eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - - /* - * MMU counters. - */ - mmuSample: function(ctrName, seriesName, ts, eventBase) { - return this.hwcSample('mali:mmu', 'MMU: ' + ctrName, seriesName, ts, - eventBase); - }, - addMMUCounter: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.mmuSample(hwcTitle, 'count', ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - addMMUCycles: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.mmuSample(hwcTitle, 'cycles', ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - - /* - * L2 counters. - */ - l2Sample: function(ctrName, seriesName, ts, eventBase) { - return this.hwcSample('mali:l2', 'L2: ' + ctrName, seriesName, ts, - eventBase); - }, - addL2Counter: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.l2Sample(hwcTitle, 'count', ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - }, - addL2Cycles: function(hwcEventName, hwcTitle) { - function handler(eventName, cpuNumber, pid, ts, eventBase) { - return this.l2Sample(hwcTitle, 'cycles', ts, eventBase); - } - this.importer.registerEventHandler(hwcEventName, handler.bind(this)); - } - }; - - Parser.register(MaliParser); - - return { - MaliParser: MaliParser - }; -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/mali_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/mali_parser_test.html deleted file mode 100644 index be19c73896f..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/mali_parser_test.html +++ /dev/null @@ -1,485 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - function newModel(events) { - return tr.c.TestUtils.newModelWithEvents([events], { - shiftWorldToZero: false - }); - } - - test('maliDDKImport', function() { - var linesNoThread = [ - // Row 1 open - ' chrome-1780 [001] ...1 28.562633: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_enter: ' + - 'gles/src/dispatch/mali_gles_dispatch_entrypoints.c992: ' + - 'glTexSubImage2D', - // Row 2 open - ' chrome-1780 [001] ...1 28.562655: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_enter: ' + - 'gles/src/texture/mali_gles_texture_api.c996: ' + - 'gles_texture_tex_sub_image_2d', - // Row 3 open - ' chrome-1780 [001] ...1 28.562671: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_enter: ' + - 'gles/src/texture/mali_gles_texture_slave.c295: ' + - 'gles_texturep_slave_map_master', - // Row 3 close - ' chrome-1780 [001] ...1 28.562684: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_exit: ' + - 'gles/src/texture/mali_gles_texture_slave.c295: ', - // Row 3 open - ' chrome-1780 [001] ...1 28.562700: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_enter: ' + - 'gles/src/texture/mali_gles_texture_slave.c1505: ' + - 'gles2_texturep_upload_2d', - // Row 4 open - ' chrome-1780 [001] ...1 28.562726: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_enter: ' + - 'gles/src/texture/mali_gles_texture_slave.c1612: ' + - 'gles2_texturep_upload_2d: pixel array: wait for dependencies', - // Row 5 open - ' chrome-1780 [001] ...1 28.562742: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_enter: ' + - 'cobj/src/mali_cobj_surface_operations.c1693: ' + - 'cobj_convert_pixels_to_surface', - // Row 6 open - ' chrome-1780 [001] ...1 28.562776: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_enter: ' + - 'cobj/src/mali_cobj_surface_operations.c1461: ' + - 'cobj_convert_pixels', - // Row 7 open - ' chrome-1780 [001] ...1 28.562791: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_enter: ' + - 'cobj/src/mali_cobj_surface_operations.c1505: ' + - 'cobj_convert_pixels: fast-path linear copy', - // Row 8 open - ' chrome-1780 [001] ...1 28.562808: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_enter: ' + - 'cobj/src/mali_cobj_surface_operations.c1511: ' + - 'cobj_convert_pixels: reorder-only', - // Row 8 close - ' chrome-1780 [001] ...1 28.563383: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_exit: ' + - 'cobj/src/mali_cobj_surface_operations.c1511', - // Row 7 close - ' chrome-1780 [001] ...1 28.563397: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_exit: ' + - 'cobj/src/mali_cobj_surface_operations.c1505', - // Row 6 close - ' chrome-1780 [001] ...1 28.563409: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_exit: ' + - 'cobj/src/mali_cobj_surface_operations.c1461', - // Row 5 close - ' chrome-1780 [001] ...1 28.563438: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_exit: ' + - 'cobj/src/mali_cobj_surface_operations.c1693', - // Row 4 close - ' chrome-1780 [001] ...1 28.563451: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_exit: ' + - 'gles/src/texture/mali_gles_texture_slave.c1612', - // Row 3 close - ' chrome-1780 [001] ...1 28.563462: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_exit: ' + - 'gles/src/texture/mali_gles_texture_slave.c1505', - // Row 2 close - ' chrome-1780 [001] ...1 28.563475: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_exit: ' + - 'gles/src/texture/mali_gles_texture_api.c996', - // Row 1 close - ' chrome-1780 [001] ...1 28.563486: tracing_mark_write: ' + - 'mali_driver: cros_trace_print_exit: ' + - 'gles/src/dispatch/mali_gles_dispatch_entrypoints.c992' - ]; - - var linesWithThread = [ - // Row 1 open - ' chrome-1780 [001] ...1 28.562633: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' + - 'gles/src/dispatch/mali_gles_dispatch_entrypoints.c@992: ' + - 'glTexSubImage2D', - // Row 2 open - ' chrome-1780 [001] ...1 28.562655: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' + - 'gles/src/texture/mali_gles_texture_api.c@996: ' + - 'gles_texture_tex_sub_image_2d', - // Row 3 open - ' chrome-1780 [001] ...1 28.562671: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' + - 'gles/src/texture/mali_gles_texture_slave.c@295: ' + - 'gles_texturep_slave_map_master', - // Row 3 close - ' chrome-1780 [001] ...1 28.562684: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' + - 'gles/src/texture/mali_gles_texture_slave.c@295: ', - // Row 3 open - ' chrome-1780 [001] ...1 28.562700: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' + - 'gles/src/texture/mali_gles_texture_slave.c@1505: ' + - 'gles2_texturep_upload_2d', - // Row 4 open - ' chrome-1780 [001] ...1 28.562726: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' + - 'gles/src/texture/mali_gles_texture_slave.c@1612: ' + - 'gles2_texturep_upload_2d: pixel array: wait for dependencies', - // Row 5 open - ' chrome-1780 [001] ...1 28.562742: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' + - 'cobj/src/mali_cobj_surface_operations.c@1693: ' + - 'cobj_convert_pixels_to_surface', - // Row 6 open - ' chrome-1780 [001] ...1 28.562776: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' + - 'cobj/src/mali_cobj_surface_operations.c@1461: ' + - 'cobj_convert_pixels', - // Row 7 open - ' chrome-1780 [001] ...1 28.562791: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' + - 'cobj/src/mali_cobj_surface_operations.c@1505: ' + - 'cobj_convert_pixels: fast-path linear copy', - // Row 8 open - ' chrome-1780 [001] ...1 28.562808: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' + - 'cobj/src/mali_cobj_surface_operations.c@1511: ' + - 'cobj_convert_pixels: reorder-only', - // Row 8 close - ' chrome-1780 [001] ...1 28.563383: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' + - 'cobj/src/mali_cobj_surface_operations.c@1511', - // Row 7 close - ' chrome-1780 [001] ...1 28.563397: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' + - 'cobj/src/mali_cobj_surface_operations.c@1505', - // Row 6 close - ' chrome-1780 [001] ...1 28.563409: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' + - 'cobj/src/mali_cobj_surface_operations.c@1461', - // Row 5 close - ' chrome-1780 [001] ...1 28.563438: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' + - 'cobj/src/mali_cobj_surface_operations.c@1693', - // Row 4 close - ' chrome-1780 [001] ...1 28.563451: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' + - 'gles/src/texture/mali_gles_texture_slave.c@1612', - // Row 3 close - ' chrome-1780 [001] ...1 28.563462: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' + - 'gles/src/texture/mali_gles_texture_slave.c@1505', - // Row 2 close - ' chrome-1780 [001] ...1 28.563475: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' + - 'gles/src/texture/mali_gles_texture_api.c@996', - // Row 1 close - ' chrome-1780 [001] ...1 28.563486: tracing_mark_write: ' + - 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' + - 'gles/src/dispatch/mali_gles_dispatch_entrypoints.c@992' - ]; - var traceNoThread = newModel(linesNoThread.join('\n')); - var traceWithThread = newModel(linesWithThread.join('\n')); - assert.isFalse(traceNoThread.hasImportWarnings); - assert.isFalse(traceWithThread.hasImportWarnings); - - var threadsNoThread = traceNoThread.getAllThreads(); - var threadsWithThread = traceWithThread.getAllThreads(); - assert.equal(threadsNoThread.length, 1); - assert.equal(threadsWithThread.length, 1); - - var maliThreadNoThread = threadsNoThread[0]; - var maliThreadWithThread = threadsWithThread[0]; - assert.equal(maliThreadNoThread.tid, 'mali'); - assert.equal(maliThreadWithThread.tid, 'mali-1878934320'); - assert.equal(maliThreadNoThread.sliceGroup.length, 9); - assert.equal(maliThreadWithThread.sliceGroup.length, 9); - }); - - test('DVFSFrequencyImport', function() { - var lines = [ - ' kworker/u:0-5 [001] .... 1174.839552: mali_dvfs_set_clock: ' + - 'frequency=266', - ' kworker/u:0-5 [000] .... 1183.840486: mali_dvfs_set_clock: ' + - 'frequency=400' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var counters = m.getAllCounters(); - assert.equal(counters.length, 1); - - var c0 = counters[0]; - assert.equal(c0.name, 'DVFS Frequency'); - assert.equal(c0.series[0].samples.length, 2); - }); - - test('DVFSVoltageImport', function() { - var lines = [ - ' kworker/u:0-5 [001] .... 1174.839562: mali_dvfs_set_voltage: ' + - 'voltage=937500', - ' kworker/u:0-5 [000] .... 1183.840009: mali_dvfs_set_voltage: ' + - 'voltage=1100000' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var counters = m.getAllCounters(); - assert.equal(counters.length, 1); - - var c0 = counters[0]; - assert.equal(c0.name, 'DVFS Voltage'); - assert.equal(c0.series[0].samples.length, 2); - }); - - test('DVFSUtilizationImport', function() { - var lines = [ - ' kworker/u:0-5 [001] .... 1174.839552: mali_dvfs_event: ' + - 'utilization=7', - ' kworker/u:0-5 [000] .... 1183.840486: mali_dvfs_event: ' + - 'utilization=37' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var counters = m.getAllCounters(); - assert.equal(counters.length, 1); - - var c0 = counters[0]; - assert.equal(c0.name, 'DVFS Utilization'); - assert.equal(c0.series[0].samples.length, 2); - }); - - test('maliHWCImport', function() { - var lines = [ - ' kworker/u:0-5 [000] .... 78.896588: ' + - 'mali_hwc_ACTIVE: val=238', - ' kworker/u:0-5 [000] .... 79.046889: ' + - 'mali_hwc_ARITH_CYCLES_L0: val=1967', - ' kworker/u:0-5 [000] .... 79.046888: ' + - 'mali_hwc_ARITH_CYCLES_REG: val=136', - ' kworker/u:0-5 [000] .... 79.046890: ' + - 'mali_hwc_ARITH_FRAG_DEPEND: val=19676', - ' kworker/u:0-5 [000] .... 79.046886: ' + - 'mali_hwc_ARITH_WORDS: val=255543', - ' kworker/u:0-5 [000] .... 79.046920: ' + - 'mali_hwc_AXI_BEATS_READ: val=257053', - ' kworker/u:0-5 [000] .... 78.896594: ' + - 'mali_hwc_AXI_TLB_STALL: val=1', - ' kworker/u:0-5 [000] .... 78.946646: ' + - 'mali_hwc_AXI_TLB_TRANSACTION: val=4', - ' kworker/u:0-5 [000] .... 79.046853: ' + - 'mali_hwc_BACK_FACING: val=104', - ' kworker/u:0-5 [000] .... 79.046880: ' + - 'mali_hwc_COMPUTE_ACTIVE: val=17462', - ' kworker/u:0-5 [000] .... 79.046884: ' + - 'mali_hwc_COMPUTE_CYCLES_DESC: val=3933', - ' kworker/u:0-5 [000] .... 79.046881: ' + - 'mali_hwc_COMPUTE_TASKS: val=15', - ' kworker/u:0-5 [000] .... 79.046883: ' + - 'mali_hwc_COMPUTE_THREADS: val=60', - ' kworker/u:0-5 [000] .... 79.046860: ' + - 'mali_hwc_FRAG_ACTIVE: val=690986', - ' kworker/u:0-5 [000] .... 79.046864: ' + - 'mali_hwc_FRAG_CYCLE_DESC: val=13980', - ' kworker/u:0-5 [000] .... 79.046876: ' + - 'mali_hwc_FRAG_CYCLE_NO_TILE: val=3539', - ' kworker/u:0-5 [000] .... 79.046865: ' + - 'mali_hwc_FRAG_CYCLES_PLR: val=1499', - ' kworker/u:0-5 [000] .... 79.046869: ' + - 'mali_hwc_FRAG_CYCLES_RAST: val=1999', - ' kworker/u:0-5 [000] .... 79.046868: ' + - 'mali_hwc_FRAG_CYCLES_TRISETUP: val=22353', - ' kworker/u:0-5 [000] .... 79.046867: ' + - 'mali_hwc_FRAG_CYCLES_VERT: val=20763', - ' kworker/u:0-5 [000] .... 79.046872: ' + - 'mali_hwc_FRAG_DUMMY_THREADS: val=1968', - ' kworker/u:0-5 [000] .... 79.046877: ' + - 'mali_hwc_FRAG_NUM_TILES: val=1840', - ' kworker/u:0-5 [000] .... 79.046862: ' + - 'mali_hwc_FRAG_PRIMATIVES: val=3752', - ' kworker/u:0-5 [000] .... 79.046863: ' + - 'mali_hwc_FRAG_PRIMATIVES_DROPPED: val=18', - ' kworker/u:0-5 [000] .... 79.046874: ' + - 'mali_hwc_FRAG_QUADS_EZS_TEST: val=117925', - ' kworker/u:0-5 [000] .... 79.046873: ' + - 'mali_hwc_FRAG_QUADS_RAST: val=117889', - ' kworker/u:0-5 [000] .... 79.046870: ' + - 'mali_hwc_FRAG_THREADS: val=471507', - ' kworker/u:0-5 [000] .... 79.046879: ' + - 'mali_hwc_FRAG_TRANS_ELIM: val=687', - ' kworker/u:0-5 [000] .... 80.315162: ' + - 'mali_hwc_FRONT_FACING: val=56', - ' kworker/u:0-5 [000] .... 78.896582: ' + - 'mali_hwc_GPU_ACTIVE: val=1316', - ' kworker/u:0-5 [000] .... 78.896584: ' + - 'mali_hwc_IRQ_ACTIVE: val=17', - ' kworker/u:0-5 [000] .... 79.046834: ' + - 'mali_hwc_JS0_ACTIVE: val=709444', - ' kworker/u:0-5 [000] .... 79.046831: ' + - 'mali_hwc_JS0_JOBS: val=2', - ' kworker/u:0-5 [000] .... 79.046832: ' + - 'mali_hwc_JS0_TASKS: val=7263', - ' kworker/u:0-5 [000] .... 79.046836: ' + - 'mali_hwc_JS0_WAIT_DEPEND: val=665876', - ' kworker/u:0-5 [000] .... 79.046835: ' + - 'mali_hwc_JS0_WAIT_ISSUE: val=910', - ' kworker/u:0-5 [000] .... 79.046840: ' + - 'mali_hwc_JS1_ACTIVE: val=153980', - ' kworker/u:0-5 [000] .... 79.046838: ' + - 'mali_hwc_JS1_JOBS: val=133', - ' kworker/u:0-5 [000] .... 79.046839: ' + - 'mali_hwc_JS1_TASKS: val=128', - ' kworker/u:0-5 [000] .... 79.046843: ' + - 'mali_hwc_JS1_WAIT_FINISH: val=74404', - ' kworker/u:0-5 [000] .... 79.046842: ' + - 'mali_hwc_JS1_WAIT_ISSUE: val=10146', - ' kworker/u:0-5 [000] .... 78.896603: ' + - 'mali_hwc_L2_ANY_LOOKUP: val=22', - ' kworker/u:0-5 [000] .... 79.046942: ' + - 'mali_hwc_L2_CLEAN_MISS: val=116', - ' kworker/u:0-5 [000] .... 79.063515: ' + - 'mali_hwc_L2_EXT_AR_STALL: val=9', - ' kworker/u:0-5 [000] .... 78.963384: ' + - 'mali_hwc_L2_EXT_BARRIER: val=1', - ' kworker/u:0-5 [000] .... 79.063516: ' + - 'mali_hwc_L2_EXT_R_BUF_FULL: val=43', - ' kworker/u:0-5 [000] .... 78.896611: ' + - 'mali_hwc_L2_EXT_READ: val=4', - ' kworker/u:0-5 [000] .... 78.896612: ' + - 'mali_hwc_L2_EXT_READ_LINE: val=4', - ' kworker/u:0-5 [000] .... 79.046956: ' + - 'mali_hwc_L2_EXT_R_RAW: val=1', - ' kworker/u:0-5 [000] .... 79.063518: ' + - 'mali_hwc_L2_EXT_R_W_HAZARD: val=15', - ' kworker/u:0-5 [000] .... 78.963381: ' + - 'mali_hwc_L2_EXT_WRITE: val=25', - ' kworker/u:0-5 [000] .... 79.046952: ' + - 'mali_hwc_L2_EXT_WRITE_LINE: val=63278', - ' kworker/u:0-5 [000] .... 78.963382: ' + - 'mali_hwc_L2_EXT_WRITE_SMALL: val=1', - ' kworker/u:0-5 [000] .... 79.814532: ' + - 'mali_hwc_L2_EXT_W_STALL: val=9', - ' kworker/u:0-5 [000] .... 78.896602: ' + - 'mali_hwc_L2_READ_BEATS: val=16', - ' kworker/u:0-5 [000] .... 78.896607: ' + - 'mali_hwc_L2_READ_HIT: val=11', - ' kworker/u:0-5 [000] .... 78.896604: ' + - 'mali_hwc_L2_READ_LOOKUP: val=19', - ' kworker/u:0-5 [000] .... 78.896606: ' + - 'mali_hwc_L2_READ_REPLAY: val=2', - ' kworker/u:0-5 [000] .... 79.046940: ' + - 'mali_hwc_L2_READ_SNOOP: val=24', - ' kworker/u:0-5 [000] .... 79.046959: ' + - 'mali_hwc_L2_REPLAY_FULL: val=6629', - ' kworker/u:0-5 [000] .N.. 80.565684: ' + - 'mali_hwc_L2_SNOOP_FULL: val=5', - ' kworker/u:0-5 [000] .... 79.046937: ' + - 'mali_hwc_L2_SREAD_LOOKUP: val=241', - ' kworker/u:0-5 [000] .... 79.046944: ' + - 'mali_hwc_L2_SWRITE_LOOKUP: val=133', - ' kworker/u:0-5 [000] .... 78.896614: ' + - 'mali_hwc_L2_TAG_HAZARD: val=4', - ' kworker/u:0-5 [000] .... 78.963368: ' + - 'mali_hwc_L2_WRITE_BEATS: val=96', - ' kworker/u:0-5 [000] .... 79.046947: ' + - 'mali_hwc_L2_WRITE_HIT: val=78265', - ' kworker/u:0-5 [000] .... 78.896608: ' + - 'mali_hwc_L2_WRITE_LOOKUP: val=3', - ' kworker/u:0-5 [000] .... 79.046946: ' + - 'mali_hwc_L2_WRITE_REPLAY: val=15879', - ' kworker/u:0-5 [000] .... 79.046912: ' + - 'mali_hwc_LSC_LINE_FETCHES: val=15', - ' kworker/u:0-5 [000] .... 79.046909: ' + - 'mali_hwc_LSC_READ_HITS: val=2961', - ' kworker/u:0-5 [000] .... 79.046911: ' + - 'mali_hwc_LSC_READ_MISSES: val=22', - ' kworker/u:0-5 [000] .... 79.046914: ' + - 'mali_hwc_LSC_SNOOPS: val=10', - ' kworker/u:0-5 [000] .... 79.046893: ' + - 'mali_hwc_LS_ISSUES: val=524219', - ' kworker/u:0-5 [000] .... 79.046894: ' + - 'mali_hwc_LS_REISSUES_MISS: val=439', - ' kworker/u:0-5 [000] .... 79.046895: ' + - 'mali_hwc_LS_REISSUES_VD: val=52007', - ' kworker/u:0-5 [000] .... 79.046919: ' + - 'mali_hwc_LS_TLB_HIT: val=3043', - ' kworker/u:0-5 [000] .... 79.046918: ' + - 'mali_hwc_LS_TLB_MISS: val=5', - ' kworker/u:0-5 [000] .... 79.046891: ' + - 'mali_hwc_LS_WORDS: val=471514', - ' kworker/u:0-5 [000] .... 79.046925: ' + - 'mali_hwc_MMU_HIT: val=771', - ' kworker/u:0-5 [000] .... 79.046924: ' + - 'mali_hwc_MMU_NEW_MISS: val=494', - ' kworker/u:0-5 [000] .... 79.046922: ' + - 'mali_hwc_MMU_REPLAY_MISS: val=841', - ' kworker/u:0-5 [000] .... 79.046921: ' + - 'mali_hwc_MMU_TABLE_WALK: val=3119', - ' kworker/u:0-5 [000] .... 79.046848: ' + - 'mali_hwc_POINTS: val=5', - ' kworker/u:0-5 [000] .... 79.046856: ' + - 'mali_hwc_PRIM_CLIPPED: val=70', - ' kworker/u:0-5 [000] .... 79.046855: ' + - 'mali_hwc_PRIM_CULLED: val=26', - ' kworker/u:0-5 [000] .... 79.046854: ' + - 'mali_hwc_PRIM_VISIBLE: val=109', - ' kworker/u:0-5 [000] .... 79.046898: ' + - 'mali_hwc_TEX_BUBBLES: val=24874', - ' kworker/u:0-5 [000] .... 79.046905: ' + - 'mali_hwc_TEX_RECIRC_DESC: val=5937', - ' kworker/u:0-5 [000] .... 79.046904: ' + - 'mali_hwc_TEX_RECIRC_FMISS: val=209450', - ' kworker/u:0-5 [000] .... 78.896592: ' + - 'mali_hwc_TEX_RECIRC_MULTI: val=238', - ' kworker/u:0-5 [000] .... 79.046908: ' + - 'mali_hwc_TEX_RECIRC_PMISS: val=9672', - ' kworker/u:0-5 [000] .... 79.046903: ' + - 'mali_hwc_TEX_THREADS: val=660900', - ' kworker/u:0-5 [000] .... 79.046897: ' + - 'mali_hwc_TEX_WORDS: val=471193', - ' kworker/u:0-5 [000] .... 79.046901: ' + - 'mali_hwc_TEX_WORDS_DESC: val=707', - ' kworker/u:0-5 [000] .... 79.046900: ' + - 'mali_hwc_TEX_WORDS_L0: val=32', - ' kworker/u:0-5 [000] .... 79.046846: ' + - 'mali_hwc_TRIANGLES: val=130', - ' kworker/u:0-5 [000] .... 79.046885: ' + - 'mali_hwc_TRIPIPE_ACTIVE: val=691001', - ' kworker/u:0-5 [000] .... 78.896600: ' + - 'mali_hwc_UTLB_NEW_MISS: val=6', - ' kworker/u:0-5 [000] .... 78.896599: ' + - 'mali_hwc_UTLB_REPLAY_FULL: val=248', - ' kworker/u:0-5 [000] .... 78.896597: ' + - 'mali_hwc_UTLB_REPLAY_MISS: val=1', - ' kworker/u:0-5 [000] .... 78.896596: ' + - 'mali_hwc_UTLB_STALL: val=1', - ' kworker/u:0-5 [000] .... 79.046850: ' + - 'mali_hwc_VCACHE_HIT: val=311', - ' kworker/u:0-5 [000] .... 79.046851: ' + - 'mali_hwc_VCACHE_MISS: val=70' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var counters = m.getAllCounters(); - assert.equal(counters.length, 103); - - // all counters should have 1 sample - for (var tI = 0; tI < counters.length; tI++) { - var counter = counters[tI]; - assert.equal(counter.series[0].samples.length, 1); - } - // TODO(sleffler) verify counter names? (not sure if it's worth the effort) - }); -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/memreclaim_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/memreclaim_parser.html deleted file mode 100644 index c4b7f57f844..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/memreclaim_parser.html +++ /dev/null @@ -1,155 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses drm driver events in the Linux event trace format. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses linux vmscan trace events. - * @constructor - */ - function MemReclaimParser(importer) { - Parser.call(this, importer); - - importer.registerEventHandler('mm_vmscan_kswapd_wake', - MemReclaimParser.prototype.kswapdWake.bind(this)); - importer.registerEventHandler('mm_vmscan_kswapd_sleep', - MemReclaimParser.prototype.kswapdSleep.bind(this)); - importer.registerEventHandler('mm_vmscan_direct_reclaim_begin', - MemReclaimParser.prototype.reclaimBegin.bind(this)); - importer.registerEventHandler('mm_vmscan_direct_reclaim_end', - MemReclaimParser.prototype.reclaimEnd.bind(this)); - } - - // Matches the mm_vmscan_kswapd_wake record - // mm_vmscan_kswapd_wake: nid=%d order=%d - var kswapdWakeRE = /nid=(\d+) order=(\d+)/; - - // Matches the mm_vmscan_kswapd_sleep record - // mm_vmscan_kswapd_sleep: order=%d - var kswapdSleepRE = /nid=(\d+)/; - - // Matches the mm_vmscan_direct_reclaim_begin record - // mm_vmscan_direct_reclaim_begin: order=%d may_writepage=%d gfp_flags=%s - var reclaimBeginRE = /order=(\d+) may_writepage=\d+ gfp_flags=(.+)/; - - // Matches the mm_vmscan_direct_reclaim_end record - // mm_vmscan_direct_reclaim_end: nr_reclaimed=%lu - var reclaimEndRE = /nr_reclaimed=(\d+)/; - - MemReclaimParser.prototype = { - __proto__: Parser.prototype, - - /** - * Parses memreclaim events and sets up state in the importer. - */ - kswapdWake: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = kswapdWakeRE.exec(eventBase.details); - if (!event) - return false; - - var tgid = parseInt(eventBase.tgid); - - var nid = parseInt(event[1]); - var order = parseInt(event[2]); - - var kthread = this.importer.getOrCreateKernelThread( - eventBase.threadName, tgid, pid); - - if (kthread.openSliceTS) { - if (order > kthread.order) { - kthread.order = order; - } - } else { - kthread.openSliceTS = ts; - kthread.order = order; - } - return true; - }, - - kswapdSleep: function(eventName, cpuNumber, pid, ts, eventBase) { - var tgid = parseInt(eventBase.tgid); - - var kthread = this.importer.getOrCreateKernelThread( - eventBase.threadName, tgid, pid); - - if (kthread.openSliceTS) { - - kthread.thread.sliceGroup.pushCompleteSlice( - 'memreclaim', eventBase.threadName, kthread.openSliceTS, - ts - kthread.openSliceTS, 0, 0, - { - order: kthread.order - }); - } - kthread.openSliceTS = undefined; - kthread.order = undefined; - return true; - }, - - reclaimBegin: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = reclaimBeginRE.exec(eventBase.details); - if (!event) - return false; - - var order = parseInt(event[1]); - var gfp = event[2]; - var tgid = parseInt(eventBase.tgid); - - var kthread = this.importer.getOrCreateKernelThread( - eventBase.threadName, tgid, pid); - - kthread.openSliceTS = ts; - kthread.order = order; - kthread.gfp = gfp; - return true; - }, - - reclaimEnd: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = reclaimEndRE.exec(eventBase.details); - if (!event) - return false; - - var nr_reclaimed = parseInt(event[1]); - var tgid = parseInt(eventBase.tgid); - - var kthread = this.importer.getOrCreateKernelThread( - eventBase.threadName, tgid, pid); - - if (kthread.openSliceTS !== undefined) { - kthread.thread.sliceGroup.pushCompleteSlice('memreclaim', - 'direct reclaim', kthread.openSliceTS, ts - kthread.openSliceTS, - 0, 0, - { - order: kthread.order, - gfp: kthread.gfp, - nr_reclaimed: nr_reclaimed - }); - } - kthread.openSliceTS = undefined; - kthread.order = undefined; - kthread.gfp = undefined; - return true; - } - - }; - - Parser.register(MemReclaimParser); - - return { - MemReclaimParser: MemReclaimParser - }; -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/memreclaim_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/memreclaim_parser_test.html deleted file mode 100644 index f6a10ecf47e..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/memreclaim_parser_test.html +++ /dev/null @@ -1,170 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - function newModel(events) { - return tr.c.TestUtils.newModelWithEvents([events], { - shiftWorldToZero: false - }); - } - - test('memreclaimImport', function() { - var lines = [ - ' surfaceflinger-1155 ( 1155) [001] ...1 12839.528756: mm_vmscan_direct_reclaim_begin: order=0 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|GFP_ZERO|0x2', // @suppress longLineCheck - ' surfaceflinger-1155 ( 1155) [001] ...1 12839.531950: mm_vmscan_direct_reclaim_end: nr_reclaimed=66', // @suppress longLineCheck - ' kswapd0-33 ( 33) [001] ...1 12838.491407: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - ' kswapd0-33 ( 33) [001] ...1 12838.529770: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck - ' kswapd0-33 ( 33) [001] ...1 12840.545737: mm_vmscan_kswapd_sleep: nid=0'// @suppress longLineCheck - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - assert.equal(m.processes['1155'].threads['1155'].sliceGroup.length, 1); - assert.equal(m.processes['33'].threads['33'].sliceGroup.length, 1); - }); - - test('memreclaimDirectReclaim', function() { - var lines = [ - 'RenderThread-9844 ( 9786) [001] ...1 1734.106078: mm_vmscan_direct_reclaim_begin: order=5 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|0x2', // @suppress longLineCheck - 'RenderThread-9844 ( 9786) [001] ...1 1734.107619: mm_vmscan_direct_reclaim_end: nr_reclaimed=72', // @suppress longLineCheck - 'RenderThread-9844 ( 9786) [001] ...1 1734.107738: mm_vmscan_direct_reclaim_begin: order=4 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|0x2', // @suppress longLineCheck - 'RenderThread-9844 ( 9786) [001] ...1 1734.107844: mm_vmscan_direct_reclaim_end: nr_reclaimed=35', // @suppress longLineCheck - 'RenderThread-9844 ( 9786) [001] ...1 1734.107891: mm_vmscan_direct_reclaim_begin: order=4 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|0x2', // @suppress longLineCheck - 'RenderThread-9844 ( 9786) [001] ...1 1734.107945: mm_vmscan_direct_reclaim_end: nr_reclaimed=35', // @suppress longLineCheck - 'RenderThread-9844 ( 9786) [001] ...1 1734.107990: mm_vmscan_direct_reclaim_begin: order=4 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|0x2', // @suppress longLineCheck - 'RenderThread-9844 ( 9786) [001] ...1 1734.108062: mm_vmscan_direct_reclaim_end: nr_reclaimed=34', // @suppress longLineCheck - 'Binder_8-1735 ( 1022) [001] ...1 1735.472240: mm_vmscan_direct_reclaim_begin: order=3 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|0x2', // @suppress longLineCheck - 'Binder_8-1735 ( 1022) [001] ...1 1735.472849: mm_vmscan_direct_reclaim_end: nr_reclaimed=47', // @suppress longLineCheck - 'Binder_8-1735 ( 1022) [001] ...1 1735.473002: mm_vmscan_direct_reclaim_begin: order=3 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|0x2', // @suppress longLineCheck - 'Binder_8-1735 ( 1022) [001] ...1 1735.474859: mm_vmscan_direct_reclaim_end: nr_reclaimed=48', // @suppress longLineCheck - 'touch_fusion-88 ( 88) [000] ...1 1736.510656: mm_vmscan_direct_reclaim_begin: order=2 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|GFP_COMP|GFP_NOMEMALLOC|GFP_KMEMCG', // @suppress longLineCheck - 'touch_fusion-88 ( 88) [000] ...1 1736.517616: mm_vmscan_direct_reclaim_end: nr_reclaimed=34', // @suppress longLineCheck - 'touch_fusion-88 ( 88) [000] ...1 1736.527061: mm_vmscan_direct_reclaim_begin: order=2 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|GFP_COMP|GFP_NOMEMALLOC|GFP_KMEMCG', // @suppress longLineCheck - 'touch_fusion-88 ( 88) [000] ...1 1736.530857: mm_vmscan_direct_reclaim_end: nr_reclaimed=39'// @suppress longLineCheck - ]; - - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - - assert.equal(threads.length, 3); - - var Binder_8 = threads[0]; - var touch_fusion = threads[1]; - var RenderThread = threads[2]; - - /* make sure there are the expected amount of slices per thread */ - assert.equal(Binder_8.sliceGroup.length, 2); - assert.equal(touch_fusion.sliceGroup.length, 2); - assert.equal(RenderThread.sliceGroup.length, 4); - - /* make sure the slices have information to display to the - * user when selected - */ - - var iterate_me = [Binder_8, touch_fusion, RenderThread]; - iterate_me.forEach(function(thread) { - for (var i = 0; i < thread.sliceGroup.length; i++) { - assert.equal(thread.sliceGroup.slices[i].args !== undefined, true); - } - }); - }); - - test('memreclaimKswapd', function() { - var lines = [ - 'kswapd0-48 ( 48) [001] ...1 1734.210437: mm_vmscan_kswapd_wake: nid=0 order=5', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1734.227291: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1734.237585: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1734.258698: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1734.269642: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1734.319484: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1734.344839: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1734.428425: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1734.429593: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1734.599419: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1734.696606: mm_vmscan_kswapd_sleep: nid=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1735.465745: mm_vmscan_kswapd_wake: nid=0 order=3', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1735.563917: mm_vmscan_kswapd_wake: nid=0 order=5', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1735.570555: mm_vmscan_kswapd_wake: nid=0 order=4', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1735.666658: mm_vmscan_kswapd_sleep: nid=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1736.508069: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1736.529293: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1736.696725: mm_vmscan_kswapd_sleep: nid=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1737.945426: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1737.988642: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1738.057237: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1738.144630: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1738.207546: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1738.221963: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1738.316889: mm_vmscan_kswapd_sleep: nid=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1738.712804: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1738.751103: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1738.773175: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1738.785068: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1738.789545: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1738.873675: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1738.899117: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1738.939214: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1738.990366: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1739.028269: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1739.036765: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1739.077631: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.094731: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.096757: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.160536: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.256638: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.264972: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1739.360137: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.368759: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.387082: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.455657: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.489058: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.507561: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.570247: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [001] ...1 1739.582975: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.678148: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.762025: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.799245: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.821950: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.894130: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1739.919775: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1740.026933: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1740.126608: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1740.150819: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1740.156101: mm_vmscan_kswapd_wake: nid=0 order=1', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1740.246626: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1740.357055: mm_vmscan_kswapd_sleep: nid=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1740.762705: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1740.772367: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1740.783509: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck - 'kswapd0-48 ( 48) [000] ...1 1740.876601: mm_vmscan_kswapd_sleep: nid=0'// @suppress longLineCheck - ]; - - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 1); - - var thread = threads[0]; - - assert.equal(thread.sliceGroup.length, 6); - - thread.sliceGroup.slices.forEach(function(slice) { - assert.equal(slice.args !== undefined, true); - }); - }); - -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/parser.html deleted file mode 100644 index dd64d06b69d..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/parser.html +++ /dev/null @@ -1,90 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> -<link rel="import" href="/tracing/base/base.html"> -<link rel="import" href="/tracing/base/extension_registry.html"> -<script> -'use strict'; - -/** - * @fileoverview Base class for linux perf event parsers. - * - * The linux perf trace event importer depends on subclasses of - * Parser to parse event data. Each subclass corresponds - * to a group of trace events; e.g. SchedParser implements - * parsing of sched:* kernel trace events. Parser subclasses must - * call Parser.register to arrange to be instantiated - * and their constructor must register their event handlers with the - * importer. For example, - * - * var Parser = tr.e.importer.linux_perf.Parser; - * - * function WorkqueueParser(importer) { - * Parser.call(this, importer); - * - * importer.registerEventHandler('workqueue_execute_start', - * WorkqueueParser.prototype.executeStartEvent.bind(this)); - * importer.registerEventHandler('workqueue_execute_end', - * WorkqueueParser.prototype.executeEndEvent.bind(this)); - * } - * - * Parser.register(WorkqueueParser); - * - * When a registered event name is found in the data stream the associated - * event handler is invoked: - * - * executeStartEvent: function(eventName, cpuNumber, ts, eventBase) - * - * If the routine returns false the caller will generate an import error - * saying there was a problem parsing it. Handlers can also emit import - * messages using this.importer.model.importWarning. If this is done in lieu of - * the generic import error it may be desirable for the handler to return - * true. - * - * Trace events generated by writing to the trace_marker file are expected - * to have a leading text marker followed by a ':'; e.g. the trace clock - * synchronization event is: - * - * tracing_mark_write: trace_event_clock_sync: parent_ts=0 - * - * To register an event handler for these events, prepend the marker with - * 'tracing_mark_write:'; e.g. - * - * this.registerEventHandler('tracing_mark_write:trace_event_clock_sync', - * - * All subclasses should depend on importer.linux_perf.parser, e.g. - * - * tr.defineModule('importer.linux_perf.workqueue_parser') - * .dependsOn('importer.linux_perf.parser') - * .exportsTo('tracing', function() - * - * and be listed in the dependsOn of FTraceImporter. Beware that after adding a - * new subclass you must run build/generate_about_tracing_contents.py to - * regenerate tr.ui.e.about_tracing.*. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - /** - * Parses linux perf events. - * @constructor - */ - function Parser(importer) { - this.importer = importer; - this.model = importer.model; - } - - Parser.prototype = { - __proto__: Object.prototype - }; - - var options = new tr.b.ExtensionRegistryOptions(tr.b.BASIC_REGISTRY_MODE); - options.mandatoryBaseClass = Parser; - tr.b.decorateExtensionRegistry(Parser, options); - - return { - Parser: Parser - }; -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/power_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/power_parser.html deleted file mode 100644 index c6d01a26d05..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/power_parser.html +++ /dev/null @@ -1,183 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> -<link rel="import" href="/tracing/model/counter_series.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses power events in the Linux event trace format. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - - var ColorScheme = tr.b.ColorScheme; - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses linux power trace events. - * @constructor - */ - function PowerParser(importer) { - Parser.call(this, importer); - - // NB: old-style power events, deprecated - importer.registerEventHandler('power_start', - PowerParser.prototype.powerStartEvent.bind(this)); - importer.registerEventHandler('power_frequency', - PowerParser.prototype.powerFrequencyEvent.bind(this)); - - importer.registerEventHandler('cpu_frequency', - PowerParser.prototype.cpuFrequencyEvent.bind(this)); - importer.registerEventHandler('cpu_frequency_limits', - PowerParser.prototype.cpuFrequencyLimitsEvent.bind(this)); - importer.registerEventHandler('cpu_idle', - PowerParser.prototype.cpuIdleEvent.bind(this)); - } - - PowerParser.prototype = { - __proto__: Parser.prototype, - - cpuStateSlice: function(ts, targetCpuNumber, eventType, cpuState) { - var targetCpu = this.importer.getOrCreateCpu(targetCpuNumber); - var powerCounter; - if (eventType != '1') { - this.importer.model.importWarning({ - type: 'parse_error', - message: 'Don\'t understand power_start events of ' + - 'type ' + eventType - }); - return; - } - powerCounter = targetCpu.getOrCreateCounter('', 'C-State'); - if (powerCounter.numSeries === 0) { - powerCounter.addSeries(new tr.model.CounterSeries('state', - ColorScheme.getColorIdForGeneralPurposeString( - powerCounter.name + '.' + 'state'))); - } - powerCounter.series.forEach(function(series) { - series.addCounterSample(ts, cpuState); - }); - }, - - cpuIdleSlice: function(ts, targetCpuNumber, cpuState) { - var targetCpu = this.importer.getOrCreateCpu(targetCpuNumber); - var powerCounter = targetCpu.getOrCreateCounter('', 'C-State'); - if (powerCounter.numSeries === 0) { - powerCounter.addSeries(new tr.model.CounterSeries('state', - ColorScheme.getColorIdForGeneralPurposeString(powerCounter.name))); - } - // NB: 4294967295/-1 means an exit from the current state - var val = (cpuState != 4294967295 ? cpuState + 1 : 0); - powerCounter.series.forEach(function(series) { - series.addCounterSample(ts, val); - }); - }, - - cpuFrequencySlice: function(ts, targetCpuNumber, powerState) { - var targetCpu = this.importer.getOrCreateCpu(targetCpuNumber); - var powerCounter = - targetCpu.getOrCreateCounter('', 'Clock Frequency'); - if (powerCounter.numSeries === 0) { - powerCounter.addSeries(new tr.model.CounterSeries('state', - ColorScheme.getColorIdForGeneralPurposeString( - powerCounter.name + '.' + 'state'))); - } - powerCounter.series.forEach(function(series) { - series.addCounterSample(ts, powerState); - }); - }, - - cpuFrequencyLimitsSlice: function(ts, targetCpuNumber, minFreq, maxFreq) { - var targetCpu = this.importer.getOrCreateCpu(targetCpuNumber); - var powerCounter = - targetCpu.getOrCreateCounter('', 'Clock Frequency Limits'); - if (powerCounter.numSeries === 0) { - powerCounter.addSeries(new tr.model.CounterSeries('Min Frequency', - ColorScheme.getColorIdForGeneralPurposeString( - powerCounter.name + '.' + 'Min Frequency'))); - powerCounter.addSeries(new tr.model.CounterSeries('Max Frequency', - ColorScheme.getColorIdForGeneralPurposeString( - powerCounter.name + '.' + 'Max Frequency'))); - } - powerCounter.series.forEach(function(series) { - if (series.name == 'Min Frequency') - series.addCounterSample(ts, minFreq); - if (series.name == 'Max Frequency') - series.addCounterSample(ts, maxFreq); - }); - }, - - /** - * Parses power events and sets up state in the importer. - */ - powerStartEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /type=(\d+) state=(\d) cpu_id=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - var targetCpuNumber = parseInt(event[3]); - var cpuState = parseInt(event[2]); - this.cpuStateSlice(ts, targetCpuNumber, event[1], cpuState); - return true; - }, - - powerFrequencyEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /type=(\d+) state=(\d+) cpu_id=(\d+)/ - .exec(eventBase.details); - if (!event) - return false; - - var targetCpuNumber = parseInt(event[3]); - var powerState = parseInt(event[2]); - this.cpuFrequencySlice(ts, targetCpuNumber, powerState); - return true; - }, - - cpuFrequencyEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /state=(\d+) cpu_id=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - var targetCpuNumber = parseInt(event[2]); - var powerState = parseInt(event[1]); - this.cpuFrequencySlice(ts, targetCpuNumber, powerState); - return true; - }, - - cpuFrequencyLimitsEvent: function(eventName, cpu, pid, ts, eventBase) { - var event = /min=(\d+) max=(\d+) cpu_id=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - var targetCpuNumber = parseInt(event[3]); - var minFreq = parseInt(event[1]); - var maxFreq = parseInt(event[2]); - this.cpuFrequencyLimitsSlice(ts, targetCpuNumber, minFreq, maxFreq); - return true; - }, - - cpuIdleEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /state=(\d+) cpu_id=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - var targetCpuNumber = parseInt(event[2]); - var cpuState = parseInt(event[1]); - this.cpuIdleSlice(ts, targetCpuNumber, cpuState); - return true; - } - }; - - Parser.register(PowerParser); - - return { - PowerParser: PowerParser - }; -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/power_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/power_parser_test.html deleted file mode 100644 index 9dae21dcc9d..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/power_parser_test.html +++ /dev/null @@ -1,93 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - function newModel(events) { - return tr.c.TestUtils.newModelWithEvents([events], { - shiftWorldToZero: false - }); - } - - test('powerFrequencyImport', function() { - 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 = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var c0 = m.kernel.cpus[0]; - assert.equal(c0.slices.length, 0); - assert.equal(c0.counters['.Clock Frequency'].series[0].samples.length, 1); - - var c1 = m.kernel.cpus[1]; - assert.equal(c1.slices.length, 0); - assert.equal(c1.counters['.Clock Frequency'].series[0].samples.length, 2); - }); - - test('cpuFrequencyImport', function() { - var lines = [ - ' kworker/1:0-9665 [001] 15051.007301: cpu_frequency: ' + - 'state=800000 cpu_id=1', - ' kworker/1:0-9665 [001] 15051.010278: cpu_frequency: ' + - 'state=1300000 cpu_id=1', - ' kworker/0:2-7972 [000] 15051.010278: cpu_frequency: ' + - 'state=1000000 cpu_id=0', - ' kworker/0:2-7972 [000] 15051.020304: cpu_frequency: ' + - 'state=800000 cpu_id=0' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var c0 = m.kernel.cpus[0]; - assert.equal(c0.slices.length, 0); - assert.equal(c0.counters['.Clock Frequency'].series[0].samples.length, 2); - - var c1 = m.kernel.cpus[1]; - assert.equal(c1.slices.length, 0); - assert.equal(c1.counters['.Clock Frequency'].series[0].samples.length, 2); - }); - - test('cpuIdleImport', function() { - var lines = [ - ' <idle>-0 [000] 15050.992883: cpu_idle: ' + - 'state=1 cpu_id=0', - ' <idle>-0 [000] 15050.993027: cpu_idle: ' + - 'state=4294967295 cpu_id=0', - ' <idle>-0 [001] 15050.993132: cpu_idle: ' + - 'state=1 cpu_id=1', - ' <idle>-0 [001] 15050.993276: cpu_idle: ' + - 'state=4294967295 cpu_id=1', - ' <idle>-0 [001] 15050.993279: cpu_idle: ' + - 'state=3 cpu_id=1', - ' <idle>-0 [001] 15050.993457: cpu_idle: ' + - 'state=4294967295 cpu_id=1' - ]; - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var c0 = m.kernel.cpus[0]; - assert.equal(c0.slices.length, 0); - assert.equal(c0.counters['.C-State'].series[0].samples.length, 2); - - var c1 = m.kernel.cpus[1]; - assert.equal(c1.slices.length, 0); - assert.equal(c1.counters['.C-State'].series[0].samples.length, 4); - }); -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/regulator_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/regulator_parser.html deleted file mode 100644 index 0c56720f51c..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/regulator_parser.html +++ /dev/null @@ -1,143 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2015 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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses regulator events in the Linux event trace format. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - - var ColorScheme = tr.b.ColorScheme; - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses linux regulator trace events. - * @constructor - */ - function RegulatorParser(importer) { - Parser.call(this, importer); - - importer.registerEventHandler('regulator_enable', - RegulatorParser.prototype.regulatorEnableEvent.bind(this)); - importer.registerEventHandler('regulator_enable_delay', - RegulatorParser.prototype.regulatorEnableDelayEvent.bind(this)); - importer.registerEventHandler('regulator_enable_complete', - RegulatorParser.prototype.regulatorEnableCompleteEvent.bind(this)); - importer.registerEventHandler('regulator_disable', - RegulatorParser.prototype.regulatorDisableEvent.bind(this)); - importer.registerEventHandler('regulator_disable_complete', - RegulatorParser.prototype.regulatorDisableCompleteEvent.bind(this)); - importer.registerEventHandler('regulator_set_voltage', - RegulatorParser.prototype.regulatorSetVoltageEvent.bind(this)); - importer.registerEventHandler('regulator_set_voltage_complete', - RegulatorParser.prototype.regulatorSetVoltageCompleteEvent.bind(this)); - - this.model_ = importer.model_; - } - - // Matches the regulator_enable record - var regulatorEnableRE = /name=(.+)/; - - // Matches the regulator_disable record - var regulatorDisableRE = /name=(.+)/; - - // Matches the regulator_set_voltage_complete record - var regulatorSetVoltageCompleteRE = /name=(\S+), val=(\d+)/; - - RegulatorParser.prototype = { - __proto__: Parser.prototype, - - /** - * Get or create a counter with one series. - */ - getCtr_: function(ctrName, valueName) { - var ctr = this.model_.kernel - .getOrCreateCounter(null, 'vreg ' + ctrName + ' ' + valueName); - // Initialize the counter's series fields if needed. - if (ctr.series[0] === undefined) { - ctr.addSeries(new tr.model.CounterSeries(valueName, - ColorScheme.getColorIdForGeneralPurposeString( - ctrName + '.' + valueName))); - } - return ctr; - }, - - /** - * Parses regulator events and sets up state in the importer. - */ - regulatorEnableEvent: function(eventName, cpuNum, pid, ts, eventBase) { - var event = regulatorEnableRE.exec(eventBase.details); - if (!event) - return false; - - var name = event[1]; - - var ctr = this.getCtr_(name, 'enabled'); - ctr.series[0].addCounterSample(ts, 1); - - return true; - }, - - regulatorEnableDelayEvent: function(eventName, cpuNum, pid, ts, eventBase) { - return true; - }, - - regulatorEnableCompleteEvent: function(eventName, cpuNum, pid, ts, - eventBase) { - return true; - }, - - regulatorDisableEvent: function(eventName, cpuNum, pid, ts, eventBase) { - var event = regulatorDisableRE.exec(eventBase.details); - if (!event) - return false; - - var name = event[1]; - - var ctr = this.getCtr_(name, 'enabled'); - ctr.series[0].addCounterSample(ts, 0); - - return true; - }, - - regulatorDisableCompleteEvent: function(eventName, cpuNum, pid, ts, - eventBase) { - return true; - }, - - regulatorSetVoltageEvent: function(eventName, cpuNum, pid, ts, eventBase) { - return true; - }, - - regulatorSetVoltageCompleteEvent: function(eventName, cpuNum, pid, ts, - eventBase) { - var event = regulatorSetVoltageCompleteRE.exec(eventBase.details); - if (!event) - return false; - - var name = event[1]; - var voltage = parseInt(event[2]); - - var ctr = this.getCtr_(name, 'voltage'); - ctr.series[0].addCounterSample(ts, voltage); - - return true; - } - - }; - - Parser.register(RegulatorParser); - - return { - RegulatorParser: RegulatorParser - }; -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/regulator_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/regulator_parser_test.html deleted file mode 100644 index 328bf7c3161..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/regulator_parser_test.html +++ /dev/null @@ -1,45 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2015 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - test('regulatorImport', function() { - var lines = [ - ' kworker/0:2H-14312 [000] ...1 143713.787749: ' + - 'regulator_set_voltage: name=krait0 (810000-1100000)', - ' kworker/0:2H-14312 [000] ...1 143713.787778: ' + - 'regulator_set_voltage_complete: name=krait0, val=810000', - ' kworker/0:2H-14312 [000] ...1 143714.037871: ' + - 'regulator_set_voltage: name=krait0 (800000-1100000)', - ' kworker/0:2H-14312 [000] ...1 143714.037895: ' + - 'regulator_set_voltage_complete: name=krait0, val=800000', - 'kworker/0:1-30321 [000] ...1 144568.624596: ' + - 'regulator_enable: name=8941_smbb_boost', - 'kworker/0:1-30321 [000] ...1 144568.624715: ' + - 'regulator_enable_delay: name=8941_smbb_boost', - 'kworker/0:1-30321 [000] ...1 144568.624723: ' + - 'regulator_enable_complete: name=8941_smbb_boost', - 'kworker/0:1-30321 [000] ...1 144568.653546: ' + - 'regulator_disable: name=8941_smbb_boost', - 'kworker/0:1-30321 [000] ...1 144568.654785: ' + - 'regulator_disable_complete: name=8941_smbb_boost' - ]; - var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], { - shiftWorldToZero: false - }); - assert.isFalse(m.hasImportWarnings); - - assert.property(m.kernel.counters, 'null.vreg krait0 voltage'); - assert.property(m.kernel.counters, 'null.vreg 8941_smbb_boost enabled'); - }); -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sched_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sched_parser.html deleted file mode 100644 index 08ad46aed4b..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sched_parser.html +++ /dev/null @@ -1,150 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> -<link rel="import" href="/tracing/model/counter.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses scheduler events in the Linux event trace format. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses linux sched trace events. - * @constructor - */ - function SchedParser(importer) { - Parser.call(this, importer); - - importer.registerEventHandler('sched_switch', - SchedParser.prototype.schedSwitchEvent.bind(this)); - importer.registerEventHandler('sched_wakeup', - SchedParser.prototype.schedWakeupEvent.bind(this)); - importer.registerEventHandler('sched_blocked_reason', - SchedParser.prototype.schedBlockedEvent.bind(this)); - importer.registerEventHandler('sched_cpu_hotplug', - SchedParser.prototype.schedCpuHotplugEvent.bind(this)); - } - - var TestExports = {}; - - // Matches the sched_switch record - var schedSwitchRE = new RegExp( - 'prev_comm=(.+) prev_pid=(\\d+) prev_prio=(\\d+) ' + - 'prev_state=(\\S\\+?|\\S\\|\\S) ==> ' + - 'next_comm=(.+) next_pid=(\\d+) next_prio=(\\d+)'); - - // Matches sched_blocked_reason record - var schedBlockedRE = new RegExp('pid=(\\d+) iowait=(\\d) caller=(.+)'); - TestExports.schedSwitchRE = schedSwitchRE; - - // Matches the sched_wakeup record - var schedWakeupRE = - /comm=(.+) pid=(\d+) prio=(\d+) success=(\d+) target_cpu=(\d+)/; - TestExports.schedWakeupRE = schedWakeupRE; - - SchedParser.prototype = { - __proto__: Parser.prototype, - - /** - * Parses scheduler events and sets up state in the CPUs of the importer. - */ - schedSwitchEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = schedSwitchRE.exec(eventBase.details); - if (!event) - return false; - - var prevState = event[4]; - var nextComm = event[5]; - var nextPid = parseInt(event[6]); - var nextPrio = parseInt(event[7]); - - var nextThread = this.importer.threadsByLinuxPid[nextPid]; - var nextName; - if (nextThread) - nextName = nextThread.userFriendlyName; - else - nextName = nextComm; - - var cpu = this.importer.getOrCreateCpu(cpuNumber); - cpu.switchActiveThread( - ts, - {stateWhenDescheduled: prevState}, - nextPid, - nextName, - { - comm: nextComm, - tid: nextPid, - prio: nextPrio - }); - - return true; - }, - - schedWakeupEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = schedWakeupRE.exec(eventBase.details); - if (!event) - return false; - - var fromPid = pid; - var comm = event[1]; - var pid = parseInt(event[2]); - var prio = parseInt(event[3]); - this.importer.markPidRunnable(ts, pid, comm, prio, fromPid); - return true; - }, - - schedCpuHotplugEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = /cpu (\d+) (.+) error=(\d+)/.exec(eventBase.details); - if (!event) - return false; - - var cpuNumber = event[1]; - var state = event[2]; - var targetCpu = this.importer.getOrCreateCpu(cpuNumber); - - var powerCounter = targetCpu.getOrCreateCounter('', 'Cpu Hotplug'); - if (powerCounter.numSeries === 0) { - powerCounter.addSeries(new tr.model.CounterSeries('State', - tr.b.ColorScheme.getColorIdForGeneralPurposeString( - powerCounter.name + '.' + 'State'))); - } - powerCounter.series.forEach(function(series) { - if (series.name == 'State') - series.addCounterSample(ts, state.localeCompare('offline') ? 0 : 1); - }); - return true; - }, - - schedBlockedEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = schedBlockedRE.exec(eventBase.details); - if (!event) - return false; - - var pid = parseInt(event[1]); - var iowait = parseInt(event[2]); - var caller = event[3]; - - this.importer.addPidBlockedReason(ts, pid, iowait, caller); - return true; - } - }; - - Parser.register(SchedParser); - - return { - SchedParser: SchedParser, - _SchedParserTestExports: TestExports - }; -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sched_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sched_parser_test.html deleted file mode 100644 index 435463e5b43..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sched_parser_test.html +++ /dev/null @@ -1,222 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - function newModel(events) { - return tr.c.TestUtils.newModelWithEvents([events], { - shiftWorldToZero: false - }); - } - - test('schedSwitchRE', function() { - var re = tr.e.importer.linux_perf._SchedParserTestExports.schedSwitchRE; - var x = re.exec('prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ' + - '==> next_comm=SurfaceFlinger next_pid=178 next_prio=112'); - assert.isNotNull(x); - assert.equal(x[1], 'swapper'); - assert.equal(x[2], '0'); - assert.equal(x[3], '120'); - assert.equal(x[4], 'R'); - assert.equal(x[5], 'SurfaceFlinger'); - assert.equal(x[6], '178'); - assert.equal(x[7], '112'); - - var x = re.exec('prev_comm=.android.chrome prev_pid=1562 prev_prio=120 prev_state=R ==> next_comm=Binder Thread # next_pid=195 next_prio=120'); // @suppress longLineCheck - assert.isNotNull(x); - assert.equal(x[1], '.android.chrome'); - assert.equal(x[5], 'Binder Thread #'); - - var x = re.exec('prev_comm=Binder Thread # prev_pid=1562 prev_prio=120 prev_state=R ==> next_comm=.android.chrome next_pid=195 next_prio=120'); // @suppress longLineCheck - assert.isNotNull(x); - assert.equal(x[1], 'Binder Thread #'); - assert.equal(x[5], '.android.chrome'); - - // explicit test for prev_state of D|W - var x = re.exec('prev_comm=.android.chrome prev_pid=1562 prev_prio=120 ' + - 'prev_state=D|W ==> next_comm=Binder Thread # next_pid=195 ' + - 'next_prio=120'); - assert.isNotNull(x); - assert.equal(x[4], 'D|W'); - }); - - test('schedWakeupRE', function() { - var re = tr.e.importer.linux_perf._SchedParserTestExports.schedWakeupRE; - var x = re.exec( - 'comm=SensorService pid=207 prio=112 success=1 target_cpu=000'); - assert.isNotNull(x); - assert.equal(x[1], 'SensorService'); - assert.equal(x[2], '207'); - assert.equal(x[3], '112'); - assert.equal(x[4], '1'); - assert.equal(x[5], '000'); - }); - - test('importOneSequenceWithSchedWakeUp', function() { - var SCHEDULING_STATE = tr.model.SCHEDULING_STATE; - var lines = [ - 'ndroid.launcher-584 [001] d..3 12622.506890: sched_switch: prev_comm=ndroid.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck - ' Binder_1-217 [001] d..3 12622.506918: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=D ==> next_comm=ndroid.launcher next_pid=584 next_prio=120', // @suppress longLineCheck - 'ndroid.launcher-584 [001] d..4 12622.506936: sched_wakeup: comm=Binder_1 pid=217 prio=120 success=1 target_cpu=001', // @suppress longLineCheck - 'ndroid.launcher-584 [001] d..3 12622.506950: sched_switch: prev_comm=ndroid.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck - ' Binder_1-217 [001] ...1 12622.507057: tracing_mark_write: B|128|queueBuffer', // @suppress longLineCheck - ' Binder_1-217 [001] ...1 12622.507175: tracing_mark_write: E', - ' Binder_1-217 [001] d..3 12622.507253: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=S ==> next_comm=ndroid.launcher next_pid=584 next_prio=120' // @suppress longLineCheck - ]; - - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var thread = m.findAllThreadsNamed('Binder_1')[0]; - var timeSlices = thread.timeSlices; - assert.equal(timeSlices.length, 4); - - var runningSlice = timeSlices[0]; - assert.equal(runningSlice.schedulingState, SCHEDULING_STATE.RUNNING); - assert.closeTo(12622506.890, runningSlice.start, 1e-5); - assert.closeTo(.918 - .890, runningSlice.duration, 1e-5); - - var sleepSlice = timeSlices[1]; - assert.equal(sleepSlice.schedulingState, SCHEDULING_STATE.UNINTR_SLEEP); - assert.closeTo(12622506.918, sleepSlice.start, 1e-5); - assert.closeTo(.936 - .918, sleepSlice.duration, 1e-5); - - var wakeupSlice = timeSlices[2]; - assert.equal(wakeupSlice.schedulingState, SCHEDULING_STATE.RUNNABLE); - assert.closeTo(12622506.936, wakeupSlice.start, 1e-5); - assert.closeTo(.950 - .936, wakeupSlice.duration, 1e-5); - assert.equal(wakeupSlice.args['wakeup from tid'], 584); - - var runningSlice2 = timeSlices[3]; - assert.equal(runningSlice2.schedulingState, SCHEDULING_STATE.RUNNING); - assert.closeTo(12622506.950, runningSlice2.start, 1e-5); - assert.closeTo(7.253 - 6.950, runningSlice2.duration, 1e-5); - }); - - test('importWithUnknownSleepState', function() { - var SCHEDULING_STATE = tr.model.SCHEDULING_STATE; - var lines = [ - 'ndroid.launcher-584 [001] d..3 12622.506890: sched_switch: prev_comm=ndroid.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck - ' Binder_1-217 [001] d..3 12622.506918: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=F|O ==> next_comm=ndroid.launcher next_pid=584 next_prio=120', // @suppress longLineCheck - 'ndroid.launcher-584 [001] d..4 12622.506936: sched_wakeup: comm=Binder_1 pid=217 prio=120 success=1 target_cpu=001', // @suppress longLineCheck - 'ndroid.launcher-584 [001] d..3 12622.506950: sched_switch: prev_comm=ndroid.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck - ' Binder_1-217 [001] ...1 12622.507057: tracing_mark_write: B|128|queueBuffer', // @suppress longLineCheck - ' Binder_1-217 [001] ...1 12622.507175: tracing_mark_write: E', - ' Binder_1-217 [001] d..3 12622.507253: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=F|O ==> next_comm=ndroid.launcher next_pid=584 next_prio=120' // @suppress longLineCheck - ]; - - var m; - assert.doesNotThrow(function() { - m = newModel(lines.join('\n')); - }); - assert.isTrue(m.hasImportWarnings); - assert.equal(m.importWarnings[0].message, 'Unrecognized sleep state: F|O'); - - var thread = m.findAllThreadsNamed('Binder_1')[0]; - var timeSlices = thread.timeSlices; - - assert.equal(timeSlices[1].schedulingState, SCHEDULING_STATE.UNKNOWN); - }); - - test('importWithUninterruptibleSleep', function() { - var SCHEDULING_STATE = tr.model.SCHEDULING_STATE; - var lines = [ - 'ndroid.launcher-584 [001] d..3 12622.506890: sched_switch: ' + - 'prev_comm=ndroid.launcher prev_pid=584 ' + - 'prev_prio=120 prev_state=R+ ' + - '==> next_comm=Binder_1 next_pid=217 next_prio=120', - - ' Binder_1-217 [001] d..3 12622.506918: sched_switch: ' + - 'prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=D|K ' + - '==> next_comm=ndroid.launcher next_pid=584 next_prio=120', - - 'ndroid.launcher-584 [001] d..4 12622.506936: sched_wakeup: ' + - 'comm=Binder_1 pid=217 prio=120 success=1 target_cpu=001', - - 'ndroid.launcher-584 [001] d..3 12622.506950: sched_switch: ' + - 'prev_comm=ndroid.launcher prev_pid=584 ' + - 'prev_prio=120 prev_state=R+ ' + - '==> next_comm=Binder_1 next_pid=217 next_prio=120', - - ' Binder_1-217 [001] ...1 12622.507057: tracing_mark_write: ' + - 'B|128|queueBuffer', - - ' Binder_1-217 [001] ...1 12622.507175: tracing_mark_write: E', - - ' Binder_1-217 [001] d..3 12622.507253: sched_switch: ' + - 'prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=S ' + - '==> next_comm=ndroid.launcher next_pid=584 next_prio=120' - ]; - - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var thread = m.findAllThreadsNamed('Binder_1')[0]; - var timeSlices = thread.timeSlices; - assert.equal(timeSlices.length, 4); - - var wakeKillSlice = timeSlices[1]; - assert.equal(wakeKillSlice.schedulingState, - SCHEDULING_STATE.UNINTR_SLEEP_WAKE_KILL); - assert.closeTo(12622506.918, wakeKillSlice.start, 1e-5); - assert.closeTo(.936 - .918, wakeKillSlice.duration, 1e-5); - }); - - test('importWithUninterruptibleSleepAndBlockedReason', function() { - var SCHEDULING_STATE = tr.model.SCHEDULING_STATE; - var lines = [ - 'ndroid.launcher-584 [001] d..3 12622.506890: sched_switch: ' + - 'prev_comm=ndroid.launcher prev_pid=584 ' + - 'prev_prio=120 prev_state=R+ ' + - '==> next_comm=Binder_1 next_pid=217 next_prio=120', - - ' Binder_1-217 [001] d..3 12622.506918: sched_switch: ' + - 'prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=D|K ' + - '==> next_comm=ndroid.launcher next_pid=584 next_prio=120', - - ' Binder_1-217 [001] d..3 12622.506930: sched_blocked_reason: ' + - 'pid=217 iowait=1 caller=sleep_on_page_killable+0x10/0x4c', - - 'ndroid.launcher-584 [001] d..4 12622.506936: sched_wakeup: ' + - 'comm=Binder_1 pid=217 prio=120 success=1 target_cpu=001', - - 'ndroid.launcher-584 [001] d..3 12622.506950: sched_switch: ' + - 'prev_comm=ndroid.launcher prev_pid=584 ' + - 'prev_prio=120 prev_state=R+ ' + - '==> next_comm=Binder_1 next_pid=217 next_prio=120', - - ' Binder_1-217 [001] ...1 12622.507057: tracing_mark_write: ' + - 'B|128|queueBuffer', - - ' Binder_1-217 [001] ...1 12622.507175: tracing_mark_write: E', - - ' Binder_1-217 [001] d..3 12622.507253: sched_switch: ' + - 'prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=S ' + - '==> next_comm=ndroid.launcher next_pid=584 next_prio=120' - ]; - - var m = newModel(lines.join('\n')); - assert.isFalse(m.hasImportWarnings); - - var thread = m.findAllThreadsNamed('Binder_1')[0]; - var timeSlices = thread.timeSlices; - assert.equal(timeSlices.length, 4); - - var wakeKillSlice = timeSlices[1]; - assert.equal(wakeKillSlice.schedulingState, - SCHEDULING_STATE.UNINTR_SLEEP_WAKE_KILL_IO); - assert.closeTo(12622506.918, wakeKillSlice.start, 1e-5); - assert.closeTo(.936 - .918, wakeKillSlice.duration, 1e-5); - }); -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sync_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sync_parser.html deleted file mode 100644 index ce6afe7179a..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sync_parser.html +++ /dev/null @@ -1,135 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses sync events in the Linux event trace format. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - - var ColorScheme = tr.b.ColorScheme; - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses linux sync trace events. - * @constructor - */ - function SyncParser(importer) { - Parser.call(this, importer); - - importer.registerEventHandler( - 'sync_timeline', - SyncParser.prototype.timelineEvent.bind(this)); - importer.registerEventHandler( - 'sync_wait', - SyncParser.prototype.syncWaitEvent.bind(this)); - importer.registerEventHandler( - 'sync_pt', - SyncParser.prototype.syncPtEvent.bind(this)); - this.model_ = importer.model_; - } - - var syncTimelineRE = /name=(\S+) value=(\S*)/; - var syncWaitRE = /(\S+) name=(\S+) state=(\d+)/; - var syncPtRE = /name=(\S+) value=(\S*)/; - - SyncParser.prototype = { - __proto__: Parser.prototype, - - /** - * Parses sync events and sets up state in the importer. - */ - timelineEvent: function(eventName, cpuNumber, pid, - ts, eventBase) { - var event = syncTimelineRE.exec(eventBase.details); - if (!event) - return false; - - var thread = this.importer.getOrCreatePseudoThread(event[1]); - - if (thread.lastActiveTs !== undefined) { - var duration = ts - thread.lastActiveTs; - var value = thread.lastActiveValue; - if (value == undefined) - value = ' '; - var slice = new tr.model.Slice( - '', value, - ColorScheme.getColorIdForGeneralPurposeString(value), - thread.lastActiveTs, {}, - duration); - thread.thread.sliceGroup.pushSlice(slice); - } - thread.lastActiveTs = ts; - thread.lastActiveValue = event[2]; - return true; - }, - - syncWaitEvent: function(eventName, cpuNumber, pid, ts, - eventBase) { - var event = syncWaitRE.exec(eventBase.details); - if (!event) - return false; - - if (eventBase.tgid === undefined) { - return false; - } - - var tgid = parseInt(eventBase.tgid); - var thread = this.model_.getOrCreateProcess(tgid) - .getOrCreateThread(pid); - thread.name = eventBase.threadName; - var slices = thread.kernelSliceGroup; - if (!slices.isTimestampValidForBeginOrEnd(ts)) { - this.model_.importWarning({ - type: 'parse_error', - message: 'Timestamps are moving backward.' - }); - return false; - } - - var name = 'fence_wait("' + event[2] + '")'; - if (event[1] == 'begin') { - var slice = slices.beginSlice(null, name, ts, { - 'Start state': event[3] - }); - } else if (event[1] == 'end') { - if (slices.openSliceCount > 0) { - slices.endSlice(ts); - } - } else { - return false; - } - - return true; - }, - - syncPtEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = syncPtRE.exec(eventBase.details); - if (!event) - return false; - - return true; - - var thread = this.importer.getOrCreateKernelThread( - eventBase[1]).thread; - thread.syncWaitSyncPts[event[1]] = event[2]; - return true; - } - }; - - Parser.register(SyncParser); - - return { - SyncParser: SyncParser - }; -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sync_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sync_parser_test.html deleted file mode 100644 index c56e2576f3a..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sync_parser_test.html +++ /dev/null @@ -1,55 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - test('syncEventImport', function() { - var lines = [ - 's3c-fb-92 ( 0) [000] ...1 7206.550061: sync_timeline: name=s3c-fb value=7094', // @suppress longLineCheck - 'TimedEventQueue-2700 ( 0) [001] ...1 7206.569027: sync_wait: begin name=SurfaceView:6 state=1', // @suppress longLineCheck - 'TimedEventQueue-2700 ( 0) [001] ...1 7206.569038: sync_pt: name=malitl_124_0x40b6406c value=7289', // @suppress longLineCheck - 'TimedEventQueue-2700 ( 0) [001] ...1 7206.569056: sync_pt: name=exynos-gsc.0-src value=25', // @suppress longLineCheck - 'TimedEventQueue-2700 ( 0) [001] ...1 7206.569068: sync_wait: end name=SurfaceView:6 state=1', // @suppress longLineCheck - 'irq/128-s5p-mfc-62 ( 0) [000] d..3 7206.572402: sync_timeline: name=vb2 value=37', // @suppress longLineCheck - 'irq/128-s5p-mfc-62 ( 0) [000] d..3 7206.572475: sync_timeline: name=vb2 value=33', // @suppress longLineCheck - 'SurfaceFlinger-225 ( 0) [001] ...1 7206.584769: sync_timeline: name=malitl_124_0x40b6406c value=7290', // @suppress longLineCheck - 'kworker/u:5-2269 ( 0) [000] ...1 7206.586745: sync_wait: begin name=display state=1', // @suppress longLineCheck - 'kworker/u:5-2269 ( 0) [000] ...1 7206.586750: sync_pt: name=s3c-fb value=7093', // @suppress longLineCheck - 'kworker/u:5-2269 ( 0) [000] ...1 7206.586760: sync_wait: end name=display state=1', // @suppress longLineCheck - 's3c-fb-92 ( 0) [000] ...1 7206.587193: sync_wait: begin name=vb2 state=0', // @suppress longLineCheck - 's3c-fb-92 ( 0) [000] ...1 7206.587198: sync_pt: name=exynos-gsc.0-dst value=27', // @suppress longLineCheck - '<idle>-0 ( 0) [000] d.h4 7206.591133: sync_timeline: name=exynos-gsc.0-src value=27', // @suppress longLineCheck - '<idle>-0 ( 0) [000] d.h4 7206.591152: sync_timeline: name=exynos-gsc.0-dst value=27', // @suppress longLineCheck - 's3c-fb-92 ( 0) [000] ...1 7206.591244: sync_wait: end name=vb2 state=1' // @suppress longLineCheck - ]; - - var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], { - shiftWorldToZero: false - }); - assert.isFalse(m.hasImportWarnings); - - var threads = m.getAllThreads(); - assert.equal(threads.length, 4); - - var threads = m.findAllThreadsNamed('s3c-fb'); - assert.equal(threads.length, 1); - assert.equal(threads[0].sliceGroup.length, 1); - - var threads = m.findAllThreadsNamed('kworker/u:5'); - assert.equal(threads.length, 1); - assert.equal(threads[0].sliceGroup.length, 1); - assert.equal('fence_wait("display")', - threads[0].sliceGroup.slices[0].title); - }); -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/workqueue_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/workqueue_parser.html deleted file mode 100644 index ab71565b6b4..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/workqueue_parser.html +++ /dev/null @@ -1,103 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> - -<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html"> - -<script> -'use strict'; - -/** - * @fileoverview Parses workqueue events in the Linux event trace format. - */ -tr.exportTo('tr.e.importer.linux_perf', function() { - - var ColorScheme = tr.b.ColorScheme; - var Parser = tr.e.importer.linux_perf.Parser; - - /** - * Parses linux workqueue trace events. - * @constructor - */ - function WorkqueueParser(importer) { - Parser.call(this, importer); - - importer.registerEventHandler('workqueue_execute_start', - WorkqueueParser.prototype.executeStartEvent.bind(this)); - importer.registerEventHandler('workqueue_execute_end', - WorkqueueParser.prototype.executeEndEvent.bind(this)); - importer.registerEventHandler('workqueue_queue_work', - WorkqueueParser.prototype.executeQueueWork.bind(this)); - importer.registerEventHandler('workqueue_activate_work', - WorkqueueParser.prototype.executeActivateWork.bind(this)); - } - - // Matches the workqueue_execute_start record - // workqueue_execute_start: work struct c7a8a89c: function MISRWrapper - var workqueueExecuteStartRE = /work struct (.+): function (\S+)/; - - // Matches the workqueue_execute_start record - // workqueue_execute_end: work struct c7a8a89c - var workqueueExecuteEndRE = /work struct (.+)/; - - WorkqueueParser.prototype = { - __proto__: Parser.prototype, - - /** - * Parses workqueue events and sets up state in the importer. - */ - executeStartEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = workqueueExecuteStartRE.exec(eventBase.details); - if (!event) - return false; - - var kthread = this.importer.getOrCreateKernelThread(eventBase.threadName, - pid, pid); - kthread.openSliceTS = ts; - kthread.openSlice = event[2]; - return true; - }, - - executeEndEvent: function(eventName, cpuNumber, pid, ts, eventBase) { - var event = workqueueExecuteEndRE.exec(eventBase.details); - if (!event) - return false; - - var kthread = this.importer.getOrCreateKernelThread(eventBase.threadName, - pid, pid); - if (kthread.openSlice) { - var slice = new tr.model.Slice('', kthread.openSlice, - ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice), - kthread.openSliceTS, - {}, - ts - kthread.openSliceTS); - - kthread.thread.sliceGroup.pushSlice(slice); - } - kthread.openSlice = undefined; - return true; - }, - - executeQueueWork: function(eventName, cpuNumber, pid, ts, eventBase) { - // TODO: Do something with this event? - return true; - }, - - executeActivateWork: function(eventName, cpuNumber, pid, ts, eventBase) { - // TODO: Do something with this event? - return true; - } - - }; - - Parser.register(WorkqueueParser); - - return { - WorkqueueParser: WorkqueueParser - }; -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/workqueue_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/workqueue_parser_test.html deleted file mode 100644 index dc3057b6a9b..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/workqueue_parser_test.html +++ /dev/null @@ -1,36 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 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. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html"> - -<script> -'use strict'; - -tr.b.unittest.testSuite(function() { - test('workQueueImport', function() { - 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 = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], { - shiftWorldToZero: false - }); - assert.isFalse(m.hasImportWarnings); - - assert.equal(m.processes['6880'].threads['6880'].sliceGroup.length, 1); - assert.equal(m.processes['7269'].threads['7269'].sliceGroup.length, 1); - }); -}); -</script> - |