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

Unified Diff: dashboard/dashboard/static/related_timeseries.html

Issue 2993773002: Dashboard charts: display sparklines of related timeseries in a tab strip. (Closed)
Patch Set: fix warnings[].value Created 3 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
Index: dashboard/dashboard/static/related_timeseries.html
diff --git a/dashboard/dashboard/static/related_timeseries.html b/dashboard/dashboard/static/related_timeseries.html
new file mode 100644
index 0000000000000000000000000000000000000000..48a6213fdc6689c713802e3c107a10481bdae25c
--- /dev/null
+++ b/dashboard/dashboard/static/related_timeseries.html
@@ -0,0 +1,105 @@
+<!DOCTYPE html>
+<!--
+Copyright 2017 The Chromium Authors. All rights reserved.
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+-->
+
+<link rel="import" href="/dashboard/static/memory_related_names.html">
+
+<script>
+'use strict';
+tr.exportTo('d', function() {
+ /**
+ * @param {Array.<{color: string, testpath: string}>} sources
+ * @return {Array.<{
+ * name: string like 'Process' or 'Component' or 'Bot',
+ * sparklines: Array.<{
+ * name: string like 'renderer_processes' or 'v8:heap',
+ * testpaths: Array.<{color: string, testpath: string}>
+ * }>
+ * }>}
+ */
+ function buildRelatedTimeseries(sources) {
+ const tabs = new Map();
+ for (const source of sources) {
+ const parts = source.testpath.split('/');
+ const measurementName = parts[3];
+ const prefix = parts.slice(0, 3).join('/') + '/';
+ let suffix = parts.slice(4).join('/');
+ if (suffix) suffix = '/' + suffix;
+
+ if (d.MEMORY_PROCESS_RELATED_NAMES.has(measurementName)) {
+ const sparklines = tabs.get('Process') || [];
+ for (const relatedName of d.MEMORY_PROCESS_RELATED_NAMES.get(
+ measurementName)) {
+ if (relatedName === measurementName) continue;
+ const relatedParts = relatedName.split(':');
+ const relatedProcessName = relatedParts[2];
+ const relatedTestPath = {
+ testpath: prefix + relatedName + suffix,
+ color: source.color,
+ };
+ let found = false;
+ for (const sparkline of sparklines) {
+ if (sparkline.name === relatedProcessName) {
+ found = true;
+ sparkline.testpaths.push(relatedTestPath);
+ }
+ }
+ if (!found) {
+ sparklines.push({
+ name: relatedProcessName,
+ testpaths: [relatedTestPath],
+ });
+ }
+ }
+ if (sparklines.length) {
+ tabs.set('Process', sparklines);
+ }
+ }
+
+ if (d.MEMORY_COMPONENT_RELATED_NAMES.has(measurementName)) {
+ const sparklines = tabs.get('Component') || [];
+ for (const relatedName of d.MEMORY_COMPONENT_RELATED_NAMES.get(
+ measurementName)) {
+ if (relatedName === measurementName) continue;
+ const relatedParts = relatedName.split(':');
+ const componentName = relatedParts.slice(
+ 4, relatedParts.length - 1).join(':');
+ const relatedTestPath = {
+ testpath: prefix + relatedName + suffix,
+ color: source.color,
+ };
+ let found = false;
+ for (const sparkline of sparklines) {
+ if (sparkline.name === componentName) {
+ found = true;
+ sparkline.testpaths.push(relatedTestPath);
+ }
+ }
+ if (!found) {
+ sparklines.push({
+ name: componentName,
+ testpaths: [relatedTestPath],
+ });
+ }
+ }
+ if (sparklines.length) {
+ tabs.set('Component', sparklines);
+ }
+ }
+ }
+
+ const relatedTabs = [];
+ for (const [name, sparklines] of tabs) {
+ relatedTabs.push({name, sparklines});
+ }
+ return relatedTabs;
+ }
+
+ return {
+ buildRelatedTimeseries,
+ };
+});
+</script>
« no previous file with comments | « dashboard/dashboard/static/memory_related_names.html ('k') | dashboard/dashboard/static/related_timeseries_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698