[object-stats] Add overall counter to viewer
No-try: true Bug: v8:7266 Change-Id: If1f67688e46e443f8e9e38f5481ce591213d2228 Reviewed-on: https://chromium-review.googlesource.com/877883 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/master@{#50745}
This commit is contained in:
parent
096db4f06b
commit
8889faec94
@ -10,6 +10,9 @@ found in the LICENSE file. -->
|
||||
</style>
|
||||
<div id="container" style="display: none;">
|
||||
<h2>Details</h2>
|
||||
<ul>
|
||||
<li><span id="overall"></span></li>
|
||||
</ul>
|
||||
<div id="chart"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -51,6 +51,10 @@ class HistogramViewer extends HTMLElement {
|
||||
|
||||
stateChanged() {
|
||||
if (this.isValid()) {
|
||||
const overall_bytes = (this.selection.merge_categories) ?
|
||||
this.getPropertyForCategory('overall') :
|
||||
this.getPropertyForInstanceTypes('overall');
|
||||
this.$('#overall').innerHTML = `Overall: ${overall_bytes / KB} KB`;
|
||||
this.drawChart();
|
||||
} else {
|
||||
this.hide();
|
||||
@ -64,6 +68,31 @@ class HistogramViewer extends HTMLElement {
|
||||
.gcs[this.selection.gc][this.selection.data_set];
|
||||
}
|
||||
|
||||
get selectedInstanceTypes() {
|
||||
console.assert(this.selection, 'invalid selection');
|
||||
return Object.values(this.selection.categories)
|
||||
.reduce((accu, current) => accu.concat(current), []);
|
||||
}
|
||||
|
||||
getPropertyForCategory(property) {
|
||||
return Object.values(this.selection.categories)
|
||||
.reduce(
|
||||
(outer_accu, instance_types) => outer_accu +
|
||||
instance_types.reduce(
|
||||
(inner_accu, instance_type) => inner_accu +
|
||||
this.selectedData
|
||||
.instance_type_data[instance_type][property],
|
||||
0),
|
||||
0);
|
||||
}
|
||||
|
||||
getPropertyForInstanceTypes(property) {
|
||||
return this.selectedInstanceTypes.reduce(
|
||||
(accu, instance_type) => accu +
|
||||
this.selectedData.instance_type_data[instance_type][property],
|
||||
0);
|
||||
}
|
||||
|
||||
getCategoryData() {
|
||||
const labels = [
|
||||
'Bucket',
|
||||
@ -89,9 +118,7 @@ class HistogramViewer extends HTMLElement {
|
||||
}
|
||||
|
||||
getInstanceTypeData() {
|
||||
const instance_types =
|
||||
Object.values(this.selection.categories)
|
||||
.reduce((accu, current) => accu.concat(current), []);
|
||||
const instance_types = this.selectedInstanceTypes;
|
||||
const labels = ['Bucket', ...instance_types];
|
||||
const data = this.selectedData.bucket_sizes.map(
|
||||
(bucket_size, index) =>
|
||||
|
Loading…
Reference in New Issue
Block a user