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

Unified Diff: tracing/tracing/metrics/all_histogram_names.py

Issue 2656493002: Register metric Histogram names. (Closed)
Patch Set: rebase Created 3 years, 10 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: tracing/tracing/metrics/all_histogram_names.py
diff --git a/tracing/tracing/metrics/all_histogram_names.py b/tracing/tracing/metrics/all_histogram_names.py
new file mode 100644
index 0000000000000000000000000000000000000000..a9847dc6f4bff0e2fefab39db8c6c197fd0d7fd1
--- /dev/null
+++ b/tracing/tracing/metrics/all_histogram_names.py
@@ -0,0 +1,33 @@
+# 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.
+
+import json
+import os
+
+import tracing_project
+import vinn
+
+
+_ALL_HISTOGRAM_NAMES_CMD_LINE = os.path.join(
+ os.path.dirname(__file__), 'all_histogram_names_cmdline.html')
+
+
+def AllHistogramNames(metrics):
+ """ Returns a list of registered metrics.
+
+ Args:
+ metrics: a list of modules (string) to be loaded before discovering
+ the registered metrics.
+ """
+ assert isinstance(metrics, list)
+ project = tracing_project.TracingProject()
+ res = vinn.RunFile(
+ _ALL_HISTOGRAM_NAMES_CMD_LINE, source_paths=list(project.source_paths),
+ js_args=metrics)
+
+ if res.returncode != 0:
+ raise RuntimeError('Error running all_histogram_names_cmdline: ' +
+ res.stdout)
+ else:
+ return [str(m) for m in json.loads(res.stdout)]
« no previous file with comments | « telemetry/telemetry/web_perf/timeline_based_measurement.py ('k') | tracing/tracing/metrics/all_histogram_names_cmdline.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698