| Index: tracing/bin/run_metric
|
| diff --git a/tracing/bin/run_metric b/tracing/bin/run_metric
|
| index 91a0eb35fb8cc0bdf1c94b0b24e8072a611e3504..857d2a1bfd840f29c3ba578acf4c90f6f0057e22 100755
|
| --- a/tracing/bin/run_metric
|
| +++ b/tracing/bin/run_metric
|
| @@ -17,25 +17,26 @@ def Main(argv):
|
| ['/tracing/metrics/all_metrics.html'])
|
| parser = argparse.ArgumentParser(
|
| description='Runs metrics on local traces')
|
| - parser.add_argument('metric_name',
|
| - help=('The function name of a registered metric, NOT '
|
| - 'filename. Available metrics are: %s' %
|
| - ', '.join(all_metrics)),
|
| - choices=all_metrics, metavar='metricName')
|
| parser.add_argument('trace_file_or_dir',
|
| help='A trace file, or a dir containing trace files')
|
| + parser.add_argument('metrics', nargs=argparse.REMAINDER,
|
| + help=('Function names of registered metrics '
|
| + '(not filenames.) '
|
| + 'Available metrics are: %s' %
|
| + ', '.join(all_metrics)),
|
| + choices=all_metrics, metavar='metricName')
|
|
|
| args = parser.parse_args(argv[1:])
|
| - metric = args.metric_name
|
| + trace_file_or_dir = os.path.abspath(args.trace_file_or_dir)
|
|
|
| - if os.path.isdir(args.trace_file_or_dir):
|
| - trace_dir = args.trace_file_or_dir
|
| + if os.path.isdir(trace_file_or_dir):
|
| + trace_dir = trace_file_or_dir
|
| traces = [os.path.join(trace_dir, trace) for trace in os.listdir(trace_dir)]
|
| else:
|
| - traces = [args.trace_file_or_dir]
|
| + traces = [trace_file_or_dir]
|
|
|
| - results = {k: v.AsDict()
|
| - for k, v in metric_runner.RunMetricOnTraces(traces, metric).iteritems()}
|
| + results = {k: v.AsDict() for k, v in
|
| + metric_runner.RunMetricOnTraces(traces, args.metrics).iteritems()}
|
|
|
| failures = []
|
| for trace in traces:
|
|
|