Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: tools/callstats.html

Issue 2368393005: [tools] Fix callstats.html's first select behavior (Closed)
Patch Set: support selecting groups Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/callstats.html
diff --git a/tools/callstats.html b/tools/callstats.html
index 55323a5e2e0197bcacebb4c6461ea6e80abca54c..d47425b435ed7e1a2c46398caacf0856edd09d9a 100644
--- a/tools/callstats.html
+++ b/tools/callstats.html
@@ -249,6 +249,7 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
var selectedEntry;
function initialize() {
+ // Initialize the stats table and toggle lists.
var original = $("column");
var view = document.createElement('div');
view.id = 'view';
@@ -303,6 +304,7 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
});
initializeToggleList(versions.versions, $('versionSelector'));
initializeToggleList(pages.values(), $('pageSelector'));
+ initializeToggleList(Group.groups.values(), $('groupSelector'));
initializeToggleContentVisibility();
}
@@ -317,7 +319,7 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
checkbox.type = 'checkbox';
checkbox.checked = item.enabled;
checkbox.item = item;
- checkbox.addEventListener('click', handleToggleVersionEnable);
+ checkbox.addEventListener('click', handleToggleVersionOrPageEnable);
li.appendChild(checkbox);
li.appendChild(document.createTextNode(item.name));
list.appendChild(li);
@@ -360,9 +362,8 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
});
if (changeSelectedEntry) {
showEntryDetail(selectedPage.getEntry(selectedEntry));
- } else {
- showImpactList(selectedPage);
}
+ showImpactList(selectedPage);
}
function showPageInColumn(page, columnIndex) {
@@ -662,7 +663,7 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
if (selectedGroup == undefined) {
selectedGroup = groups[0];
} else {
- groups = groups.filter(each => each.name != selectedGroup.name);
+ groups = groups.filter(each => each.enabled && each.name != selectedGroup.name);
groups.unshift(selectedGroup);
}
showPageGraph(groups, page);
@@ -1037,6 +1038,7 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
versions = Versions.fromJSON(JSON.parse(text));
initialize()
showPage(versions.versions[0].pages[0]);
+ selectEntry(selectedPage.total);
}
function handleToggleGroup(event) {
@@ -1117,7 +1119,7 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
showPopover(entry);
}
- function handleToggleVersionEnable(event) {
+ function handleToggleVersionOrPageEnable(event) {
var item = this.item ;
if (item === undefined) return;
item .enabled = this.checked;
@@ -1126,6 +1128,9 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
if (page === undefined || !page.version.enabled) {
page = versions.getEnabledPage(page.name);
}
+ if (!page.enabled) {
+ page = page.getNextPage();
+ }
showPage(page);
}
@@ -1210,13 +1215,17 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
}
return -1;
}
+ getNextPage(page) {
+ if (this.length == 0) return undefined;
+ return this.pages[(this.indexOf(page.name) + 1) % this.length];
+ }
get(name) {
var index = this.indexOf(name);
if (0 <= index) return this.pages[index];
return undefined
}
get length() {
- return this.versions.length
+ return this.pages.length
}
getEntry(entry) {
if (entry === undefined) return undefined;
@@ -1335,21 +1344,20 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
constructor(version, page) {
this.page = page;
this.page.add(this);
- this.total = new GroupedEntry('Total', /.*Total.*/, '#BBB');
+ this.total = Group.groups.get('total').entry();
this.total.isTotal = true;
- this.unclassified = new UnclassifiedEntry(this, "#000")
+ this.unclassified = new UnclassifiedEntry(this)
this.groups = [
this.total,
- new GroupedEntry('IC', /.*IC.*/, "#3366CC"),
- new GroupedEntry('Optimize',
- /StackGuard|.*Optimize.*|.*Deoptimize.*|Recompile.*/, "#DC3912"),
- new GroupedEntry('Compile', /.*Compile.*/, "#FFAA00"),
- new GroupedEntry('Parse', /.*Parse.*/, "#FF6600"),
- new GroupedEntry('Callback', /.*Callback$/, "#109618"),
- new GroupedEntry('API', /.*API.*/, "#990099"),
- new GroupedEntry('GC', /GC|AllocateInTargetSpace/, "#0099C6"),
- new GroupedEntry('JavaScript', /JS_Execution/, "#DD4477"),
- new GroupedEntry('Runtime', /.*/, "#88BB00"),
+ Group.groups.get('ic').entry(),
+ Group.groups.get('optimize').entry(),
+ Group.groups.get('compile').entry(),
+ Group.groups.get('parse').entry(),
+ Group.groups.get('callback').entry(),
+ Group.groups.get('api').entry(),
+ Group.groups.get('gc').entry(),
+ Group.groups.get('javascript').entry(),
+ Group.groups.get('runtime').entry(),
this.unclassified
];
this.entryDict = new Map();
@@ -1420,6 +1428,9 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
});
return sum;
}
+ getNextPage() {
+ return this.version.getNextPage(this);
+ }
}
PageVersion.fromJSON = function(version, name, data) {
var page = new PageVersion(version, pages.get(name));
@@ -1516,14 +1527,41 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
return new Entry(position, ...data);
}
-
- class GroupedEntry extends Entry {
+ class Group {
constructor(name, regexp, color) {
- super(0, 'Group-' + name, 0, 0, 0, 0, 0, 0);
+ this.name = name;
this.regexp = regexp;
this.color = color;
+ this.enabled = true;
+ }
+ entry() { return new GroupedEntry(this) };
+ }
+ Group.groups = new Map();
+ Group.add = function(name, group) {
+ this.groups.set(name, group);
+ }
+ Group.add('total', new Group('Total', /.*Total.*/, '#BBB'));
+ Group.add('ic', new Group('IC', /.*IC.*/, "#3366CC"));
+ Group.add('optimize', new Group('Optimize',
+ /StackGuard|.*Optimize.*|.*Deoptimize.*|Recompile.*/, "#DC3912"));
+ Group.add('compile', new Group('Compile', /.*Compile.*/, "#FFAA00"));
+ Group.add('parse', new Group('Parse', /.*Parse.*/, "#FF6600"));
+ Group.add('callback', new Group('Callback', /.*Callback$/, "#109618"));
+ Group.add('api', new Group('API', /.*API.*/, "#990099"));
+ Group.add('gc', new Group('GC', /GC|AllocateInTargetSpace/, "#0099C6"));
+ Group.add('javascript', new Group('JavaScript', /JS_Execution/, "#DD4477"));
+ Group.add('runtime', new Group('Runtime', /.*/, "#88BB00"));
+ Group.add('unclassified', new Group('Unclassified', /.*/, "#000"));
+
+ class GroupedEntry extends Entry {
+ constructor(group) {
+ super(0, 'Group-' + group.name, 0, 0, 0, 0, 0, 0);
+ this.group = group;
this.entries = [];
}
+ get regexp() { return this.group.regexp }
+ get color() { return this.group.color }
+ get enabled() { return this.group.enabled }
add(entry) {
if (!this.regexp.test(entry.name)) return false;
this._time += entry.time;
@@ -1587,8 +1625,8 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
}
class UnclassifiedEntry extends GroupedEntry {
- constructor(page, color) {
- super('Unclassified', undefined, color);
+ constructor(page) {
+ super(Group.groups.get('unclassified'));
this.page = page;
this._time = undefined;
this._count = undefined;
@@ -1650,14 +1688,21 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
</div>
<div id="versionSelector" class="inline toggleContentVisibility">
- <h2>Version Selector</h2>
+ <h2>Versions</h2>
<div class="content hidden">
<ul></ul>
</div>
</div>
<div id="pageSelector" class="inline toggleContentVisibility">
- <h2>Page Selector</h2>
+ <h2>Pages</h2>
+ <div class="content hidden">
+ <ul></ul>
+ </div>
+ </div>
+
+ <div id="groupSelector" class="inline toggleContentVisibility">
+ <h2>Groups</h2>
<div class="content hidden">
<ul></ul>
</div>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698