Skip to content

Use self-times instead of including all nested trees... #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions app/components/slow-node-times.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand All @@ -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(),
Expand All @@ -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(),

Expand Down
12 changes: 9 additions & 3 deletions app/templates/components/slow-node-times.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{{#if pluginNameFilter}}
<option value="clearFilter">Clear Filter</option>
{{/if}}
</select>
</select>
</p>
</div>

Expand All @@ -33,7 +33,7 @@
<th>Description</th>
<th>{{if groupByPluginName "Count" "Plugin Name"}}</th>
<th class="td-time">
<a href="#" class="nodes-table_toggle" {{action "toggleTime"}}>Time (ms) <i class="fa fa-caret-{{if sortDescending 'down' 'up'}}"></i></a>
<a href="#" class="nodes-table_toggle" {{action "toggleTime"}}>Self Time (ms) <i class="fa fa-caret-{{if sortDescending 'down' 'up'}}"></i></a>
</th>
</tr>
</thead>
Expand All @@ -43,7 +43,13 @@
<tr class="table-row" {{action 'toggleDetailsForNode' node}}>
<td>{{node.label.name}}</td>
<td class="table-row-plugin-name">{{node.label.broccoliPluginName}}</td>
<td class="td-time">{{ns-to-ms node._stats.time.plugin}}</td>
<td class="td-time">
{{#if groupByPluginName}}
{{ns-to-ms node._stats.time.plugin}}
{{else}}
{{ns-to-ms node._stats.time.self}}
{{/if}}
</td>
</tr>
{{#if node.showDetails}}
<tr>
Expand Down