devtools-timeline-model
Advanced tools
Comparing version 1.0.16 to 1.0.17
@@ -55,4 +55,12 @@ const filenames = [ | ||
// // console.log('Top down tree, grouped by URL:\n', model.topDownGroupedUnsorted) | ||
// console.log('Bottom up tree grouped by URL:\n', model.bottomUpGroupBy('URL')) | ||
// console.log('Bottom up tree grouped by URL:\n', model.bottomUpGroupBy('None')) | ||
var bottomUpByName = model.bottomUpGroupBy('EventName') | ||
var result = new Map() | ||
bottomUpByName.children.forEach(function(value, key) { | ||
result.set(key, value.selfTime); | ||
}) | ||
console.log('Bottom up tree grouped by Name:\n', result) | ||
console.groupEnd(filename) | ||
@@ -59,0 +67,0 @@ } |
@@ -39,3 +39,6 @@ /* global WebInspector TimelineModelTreeView */ | ||
// @ returns a grouped and sorted tree | ||
/** | ||
* @ param {!String} grouping Allowed values: None Category Subdomain Domain URL Name | ||
* @ return {!WebInspector.TimelineProfileTree.Node} A grouped and sorted tree | ||
*/ | ||
bottomUpGroupBy(grouping) { | ||
@@ -42,0 +45,0 @@ return this.sandbox.bottomUpGroupBy(grouping); |
@@ -15,1 +15,12 @@ /* global Runtime WebInspector */ | ||
} | ||
// add support for groupBy('Name') | ||
WebInspector.TimelineAggregator.GroupBy['EventName'] = 'EventName'; | ||
const old_nodeToGroupIdFunction = WebInspector.TimelineAggregator.prototype._nodeToGroupIdFunction; | ||
WebInspector.TimelineAggregator.prototype._nodeToGroupIdFunction = function(groupBy) { | ||
if (groupBy === WebInspector.TimelineAggregator.GroupBy.EventName) { | ||
return node => node.event.name; | ||
} | ||
return old_nodeToGroupIdFunction.apply(this, arguments); | ||
} |
@@ -105,4 +105,4 @@ 'use strict' | ||
var groupSetting = WebInspector.TimelineAggregator.GroupBy[grouping] // one of: None Category Subdomain Domain URL | ||
var groupURLAggregator = this._aggregator.groupFunction(groupSetting) | ||
var bottomUpGrouped = WebInspector.TimelineProfileTree.buildBottomUp(topDown, groupURLAggregator) | ||
var groupingAggregator = this._aggregator.groupFunction(groupSetting) | ||
var bottomUpGrouped = WebInspector.TimelineProfileTree.buildBottomUp(topDown, groupingAggregator) | ||
// sort the grouped tree, in-place | ||
@@ -109,0 +109,0 @@ new TimelineModelTreeView(bottomUpGrouped).sortingChanged('self', 'desc') |
{ | ||
"name": "devtools-timeline-model", | ||
"version": "1.0.16", | ||
"version": "1.0.17", | ||
"description": "Parse raw trace data into the Chrome DevTools' structured profiling data models", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -58,1 +58,15 @@ import test from 'ava' | ||
}) | ||
test('bottom-up profile - group by name', (t) => { | ||
var bottomUpByName = model.bottomUpGroupBy('EventName'); | ||
var leavesCount = bottomUpByName.children.size; | ||
t.is(leavesCount, 15) | ||
var result = new Map() | ||
bottomUpByName.children.forEach(function(value, key) { | ||
result.set(key, value.selfTime); | ||
}) | ||
var time = [...result.values()][0].toFixed(2) | ||
var name = [...result.keys()][0] | ||
t.is(time, '187.75') | ||
t.is(name, 'Layout') | ||
}) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
19037
379
1