| 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)]
|
|
|