OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 """This measurement runs a blink performance test and reports the results.""" | 5 """This measurement runs a blink performance test and reports the results.""" |
6 | 6 |
7 import os | 7 import os |
8 import sys | 8 import sys |
9 | 9 |
10 from telemetry.core import util | 10 from telemetry.core import util |
(...skipping 19 matching lines...) Expand all Loading... |
30 sys.exit(1) | 30 sys.exit(1) |
31 | 31 |
32 page_set_dict = {'pages': []} | 32 page_set_dict = {'pages': []} |
33 | 33 |
34 def _AddPage(path): | 34 def _AddPage(path): |
35 if not path.endswith('.html'): | 35 if not path.endswith('.html'): |
36 return | 36 return |
37 if '../' in open(path, 'r').read(): | 37 if '../' in open(path, 'r').read(): |
38 # If the page looks like it references its parent dir, include it. | 38 # If the page looks like it references its parent dir, include it. |
39 page_set_dict['serving_dirs'] = [os.path.dirname(os.path.dirname(path))] | 39 page_set_dict['serving_dirs'] = [os.path.dirname(os.path.dirname(path))] |
40 page_set_dict['pages'].append({'url': 'file://' + path}) | 40 page_set_dict['pages'].append({'url': |
| 41 'file://' + path.replace('\\', '/')}) |
41 | 42 |
42 def _AddDir(dir_path, skipped): | 43 def _AddDir(dir_path, skipped): |
43 for path in os.listdir(dir_path): | 44 for path in os.listdir(dir_path): |
44 if path == 'resources': | 45 if path == 'resources': |
45 continue | 46 continue |
46 path = os.path.join(dir_path, path) | 47 path = os.path.join(dir_path, path) |
47 if path.startswith(tuple([os.path.join(page_set_arg, s) | 48 if path.startswith(tuple([os.path.join(page_set_arg, s) |
48 for s in skipped])): | 49 for s in skipped])): |
49 continue | 50 continue |
50 if os.path.isdir(path): | 51 if os.path.isdir(path): |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 if not line.startswith('values '): | 87 if not line.startswith('values '): |
87 continue | 88 continue |
88 parts = line.split() | 89 parts = line.split() |
89 values = [float(v.replace(',', '')) for v in parts[1:-1]] | 90 values = [float(v.replace(',', '')) for v in parts[1:-1]] |
90 units = parts[-1] | 91 units = parts[-1] |
91 metric = page.display_url.split('.')[0].replace('/', '_') | 92 metric = page.display_url.split('.')[0].replace('/', '_') |
92 results.Add(metric, units, values) | 93 results.Add(metric, units, values) |
93 break | 94 break |
94 | 95 |
95 print log | 96 print log |
OLD | NEW |