OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Pull a sandwich run's output directory's metrics from traces into a CSV. | 5 """Pull a sandwich run's output directory's metrics from traces into a CSV. |
6 | 6 |
7 python pull_sandwich_metrics.py -h | 7 python pull_sandwich_metrics.py -h |
8 """ | 8 """ |
9 | 9 |
10 import collections | 10 import collections |
11 import json | 11 import json |
12 import logging | 12 import logging |
13 import os | 13 import os |
14 import shutil | 14 import shutil |
15 import subprocess | 15 import subprocess |
16 import sys | 16 import sys |
17 import tempfile | 17 import tempfile |
18 | 18 |
19 _SRC_DIR = os.path.abspath(os.path.join( | 19 _SRC_DIR = os.path.abspath(os.path.join( |
20 os.path.dirname(__file__), '..', '..', '..')) | 20 os.path.dirname(__file__), '..', '..', '..')) |
21 | 21 |
22 sys.path.append(os.path.join(_SRC_DIR, 'tools', 'perf')) | 22 sys.path.append(os.path.join(_SRC_DIR, 'tools', 'perf')) |
23 from chrome_telemetry_build import chromium_config | 23 from core import path_util |
| 24 sys.path.append(path_util.GetTelemetryDir()) |
24 | 25 |
25 sys.path.append(chromium_config.GetTelemetryDir()) | |
26 from telemetry.internal.image_processing import video | 26 from telemetry.internal.image_processing import video |
27 from telemetry.util import image_util | 27 from telemetry.util import image_util |
28 from telemetry.util import rgba_color | 28 from telemetry.util import rgba_color |
29 | 29 |
30 import common_util | 30 import common_util |
31 import loading_trace as loading_trace_module | 31 import loading_trace as loading_trace_module |
32 import sandwich_runner | 32 import sandwich_runner |
33 import tracing_track | 33 import tracing_track |
34 | 34 |
35 | 35 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 except video.BoundingBoxNotFoundException: | 336 except video.BoundingBoxNotFoundException: |
337 # Sometimes the bounding box for the web content area is not present. Skip | 337 # Sometimes the bounding box for the web content area is not present. Skip |
338 # calculating Speed Index. | 338 # calculating Speed Index. |
339 run_metrics['speed_index'] = _FAILED_CSV_VALUE | 339 run_metrics['speed_index'] = _FAILED_CSV_VALUE |
340 else: | 340 else: |
341 run_metrics['speed_index'] = _UNAVAILABLE_CSV_VALUE | 341 run_metrics['speed_index'] = _UNAVAILABLE_CSV_VALUE |
342 for key, value in trace.metadata['network_emulation'].iteritems(): | 342 for key, value in trace.metadata['network_emulation'].iteritems(): |
343 run_metrics['net_emul.' + key] = value | 343 run_metrics['net_emul.' + key] = value |
344 assert set(run_metrics.keys()) == set(COMMON_CSV_COLUMN_NAMES) | 344 assert set(run_metrics.keys()) == set(COMMON_CSV_COLUMN_NAMES) |
345 return run_metrics | 345 return run_metrics |
OLD | NEW |