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

Side by Side Diff: tracing/tracing/metrics/compare_samples.py

Issue 2089833002: Entry point for bisect sample comparison. (Closed) Base URL: https://github.com/catapult-project/catapult.git@mann
Patch Set: Closing low level file handle for temp file. Created 4 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 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 os
6
7 import tracing_project
8 import vinn
9
10 FORMAT_TO_METHOD = {
11 'chartjson': 'compareCharts',
12 'valueset': 'compareValuesets',
13 'buildbot': 'compareBuildbotOutputs'
14 }
15
16 _COMPARE_SAMPLES_CMD_LINE = os.path.join(
17 os.path.dirname(__file__), 'compare_samples_cmdline.html')
18
19
20 def CompareSamples(sample_a, sample_b, metric, data_format='chartjson'):
21 """Compare the values of a metric from two samples from benchmark output.
22
23 Args:
24 sample_a, sample_b (str): comma-separated lists of paths to the benchmark
25 output.
26 metric (str): Metric name in slash-separated format [2 or 3 part].
27 data_format (str): The format the samples are in. Supported values are:
28 'chartjson', 'valueset', 'buildbot'.
29 Returns:
30 JSON encoded dict with the values parsed form the samples and the result of
31 the hypothesis testing comparison of the samples under the 'result' key.
32 Possible values for the result key are:
33 'NEED_MORE_DATA', 'REJECT' and 'FAIL_TO_REJECT'.
34 Where the null hypothesis is that the samples belong to the same population.
35 i.e. a 'REJECT' result would make it reasonable to conclude that
36 there is a significant difference between the samples. (e.g. a perf
37 regression).
38 """
39
40 method = FORMAT_TO_METHOD[data_format]
41 project = tracing_project.TracingProject()
42 all_source_paths = list(project.source_paths)
43
44 def MakeAbsPaths(l):
45 return ','.join(map(os.path.abspath, l.split(',')))
46
47 return vinn.RunFile(
48 _COMPARE_SAMPLES_CMD_LINE,
49 source_paths=all_source_paths,
50 js_args=[
51 method,
52 MakeAbsPaths(sample_a),
53 MakeAbsPaths(sample_b),
54 metric
55 ])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698