devtools-timeline-model
Advanced tools
Comparing version 1.0.19 to 1.1.0
const filenames = [ | ||
'test/mdn-fling.json', | ||
'test/devtools-homepage-w-screenshots-trace.json' | ||
'test/assets/mdn-fling.json', | ||
'test/assets/devtools-homepage-w-screenshots-trace.json' | ||
] | ||
@@ -62,3 +62,3 @@ | ||
}) | ||
console.log('Bottom up tree grouped by Name:\n', result) | ||
console.log('Bottom up tree grouped by EventName:\n', result) | ||
@@ -65,0 +65,0 @@ |
@@ -13,3 +13,3 @@ /* global WebInspector */ | ||
// First, sandboxed contexts don't have any globals from node, so we whitelist a few we'll provide for it. | ||
var glob = { require: require, global: global, console: console, process, process, __dirname: __dirname } | ||
var glob = { require: require, global: global, console: console, process: process, __dirname: __dirname } | ||
// We read in our script to run, and create a vm.Script object | ||
@@ -16,0 +16,0 @@ var script = new vm.Script(fs.readFileSync(__dirname + "/lib/timeline-model.js", 'utf8')) |
@@ -10,12 +10,11 @@ /* global Runtime WebInspector */ | ||
// DevTools makes a few assumptions about using backing storage to hold traces. | ||
WebInspector.DeferredTempFile = function(){}; | ||
WebInspector.DeferredTempFile = function() {} | ||
WebInspector.DeferredTempFile.prototype = { | ||
write : function(){}, | ||
finishWriting: function(){} | ||
write: function() {}, | ||
finishWriting: function() {} | ||
} | ||
// add support for groupBy('Name') | ||
WebInspector.TimelineAggregator.GroupBy['EventName'] = 'EventName'; | ||
const old_nodeToGroupIdFunction = WebInspector.TimelineAggregator.prototype._nodeToGroupIdFunction; | ||
// add support for groupBy('EventName') | ||
WebInspector.TimelineAggregator.GroupBy.EventName = 'EventName'; | ||
const oldNodeToGroupIdFunction = WebInspector.TimelineAggregator.prototype._nodeToGroupIdFunction; | ||
WebInspector.TimelineAggregator.prototype._nodeToGroupIdFunction = function(groupBy) { | ||
@@ -25,3 +24,3 @@ if (groupBy === WebInspector.TimelineAggregator.GroupBy.EventName) { | ||
} | ||
return old_nodeToGroupIdFunction.apply(this, arguments); | ||
} | ||
return oldNodeToGroupIdFunction.call(this, groupBy); | ||
}; |
@@ -64,2 +64,7 @@ 'use strict' | ||
// convert string (e.g. via fs.readFileSync) to JS | ||
if (typeof events === 'string') events = JSON.parse(events) | ||
// WebPagetest trace files put events in object under key `traceEvents` | ||
if (events.hasOwnProperty('traceEvents')) events = events.traceEvents | ||
// populate with events | ||
@@ -106,11 +111,16 @@ this._tracingModel.reset() | ||
// @ returns a grouped and sorted tree | ||
/** | ||
* @param {!string} grouping Allowed values: None Category Subdomain Domain URL EventName | ||
* @return {!WebInspector.TimelineProfileTree.Node} A grouped and sorted tree | ||
*/ | ||
bottomUpGroupBy(grouping) { | ||
var topDown = this.topDown(); | ||
var groupSetting = WebInspector.TimelineAggregator.GroupBy[grouping] // one of: None Category Subdomain Domain URL | ||
var groupingAggregator = this._aggregator.groupFunction(groupSetting) | ||
var bottomUpGrouped = WebInspector.TimelineProfileTree.buildBottomUp(topDown, groupingAggregator) | ||
var groupSetting = WebInspector.TimelineAggregator.GroupBy[grouping]; | ||
var groupingAggregator = this._aggregator.groupFunction(groupSetting); | ||
var bottomUpGrouped = WebInspector.TimelineProfileTree.buildBottomUp(topDown, groupingAggregator); | ||
// sort the grouped tree, in-place | ||
new TreeView(bottomUpGrouped).sortingChanged('self', 'desc') | ||
return bottomUpGrouped | ||
new TreeView(bottomUpGrouped).sortingChanged('self', 'desc'); | ||
return bottomUpGrouped; | ||
} | ||
@@ -117,0 +127,0 @@ |
{ | ||
"name": "devtools-timeline-model", | ||
"version": "1.0.19", | ||
"version": "1.1.0", | ||
"description": "Parse raw trace data into the Chrome DevTools' structured profiling data models", | ||
@@ -15,7 +15,4 @@ "license": "Apache-2.0", | ||
"scripts": { | ||
"test": "ava --verbose" | ||
"test": "mocha $(find ./test -name '*.js') --timeout 10000" | ||
}, | ||
"ava": { | ||
"failFast": true | ||
}, | ||
"main": "index.js", | ||
@@ -34,5 +31,5 @@ "keywords": [ | ||
"devDependencies": { | ||
"ava": "^0.12.0", | ||
"standard": "^6.0.7" | ||
"mocha": "^2.3.3", | ||
"speedline": "0.1.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
6
20406
12
345