OLD | NEW |
(Empty) | |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import json |
| 6 import os |
| 7 |
| 8 import tracing_project |
| 9 import vinn |
| 10 |
| 11 |
| 12 _ALL_HISTOGRAM_NAMES_CMD_LINE = os.path.join( |
| 13 os.path.dirname(__file__), 'all_histogram_names_cmdline.html') |
| 14 |
| 15 |
| 16 def AllHistogramNames(metrics): |
| 17 """ Returns a list of registered metrics. |
| 18 |
| 19 Args: |
| 20 metrics: a list of modules (string) to be loaded before discovering |
| 21 the registered metrics. |
| 22 """ |
| 23 assert isinstance(metrics, list) |
| 24 project = tracing_project.TracingProject() |
| 25 res = vinn.RunFile( |
| 26 _ALL_HISTOGRAM_NAMES_CMD_LINE, source_paths=list(project.source_paths), |
| 27 js_args=metrics) |
| 28 |
| 29 if res.returncode != 0: |
| 30 raise RuntimeError('Error running all_histogram_names_cmdline: ' + |
| 31 res.stdout) |
| 32 else: |
| 33 return [str(m) for m in json.loads(res.stdout)] |
OLD | NEW |