From b91487193f54e958dc58f76d67a574ab53eb5e08 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli Date: Tue, 28 Sep 2021 16:59:00 -0400 Subject: [PATCH] Use self-times instead of including all nested trees... --- app/components/slow-node-times.js | 13 +++++++------ app/templates/components/slow-node-times.hbs | 12 +++++++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/app/components/slow-node-times.js b/app/components/slow-node-times.js index ba785d4..78e8568 100644 --- a/app/components/slow-node-times.js +++ b/app/components/slow-node-times.js @@ -79,13 +79,13 @@ export default Ember.Component.extend({ let pluginNameMap = nodes.reduce((memo, node) => { let pluginName = node.label.broccoliPluginName; memo[pluginName] = memo[pluginName] || { count: 0, time: 0 }; - memo[pluginName].time += node._stats.time.plugin; + memo[pluginName].time += node._stats.time.self; memo[pluginName].count++; return memo; }, {}); nodes = []; - + for (let pluginName in pluginNameMap) { nodes.push({ groupedByPluginName: true, @@ -112,7 +112,7 @@ export default Ember.Component.extend({ // off the label as the plugin name. If not, we need // to create a map of the plugin names and return that. let pluginNames = []; - + if (nodes[0].groupedByPluginName === true) { pluginNames = nodes.map(node => node.label.name); } else { @@ -132,11 +132,12 @@ export default Ember.Component.extend({ sortedNodes: computed('nodes', 'sortDescending', function() { let sortDescending = this.get('sortDescending'); + let field = this.get('groupByPluginName') ? 'plugin' : 'self'; return this.get('nodes').sort((a, b) => { if (sortDescending) { - return b._stats.time.plugin - a._stats.time.plugin; + return b._stats.time[field] - a._stats.time[field]; } else { - return a._stats.time.plugin - b._stats.time.plugin; + return a._stats.time[field] - b._stats.time[field]; } }); }).readOnly(), @@ -145,7 +146,7 @@ export default Ember.Component.extend({ let nodes = this.get('nodes'); return nodes.reduce(function(previousValue, node){ - return previousValue + node._stats.time.plugin; + return previousValue + node._stats.time.self; }, 0); }).readOnly(), diff --git a/app/templates/components/slow-node-times.hbs b/app/templates/components/slow-node-times.hbs index a61372a..82cd055 100644 --- a/app/templates/components/slow-node-times.hbs +++ b/app/templates/components/slow-node-times.hbs @@ -12,7 +12,7 @@ {{#if pluginNameFilter}} {{/if}} - +

@@ -33,7 +33,7 @@ Description {{if groupByPluginName "Count" "Plugin Name"}} - Time (ms) + Self Time (ms) @@ -43,7 +43,13 @@ {{node.label.name}} {{node.label.broccoliPluginName}} - {{ns-to-ms node._stats.time.plugin}} + + {{#if groupByPluginName}} + {{ns-to-ms node._stats.time.plugin}} + {{else}} + {{ns-to-ms node._stats.time.self}} + {{/if}} + {{#if node.showDetails}}