OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import imp | 4 import imp |
5 import inspect | 5 import inspect |
6 import os | 6 import os |
7 import sys | 7 import sys |
8 | 8 |
9 from core import path_util | 9 from core import path_util |
10 from core import perf_benchmark | 10 from core import perf_benchmark |
11 | 11 |
12 from telemetry.core import discover | |
13 from telemetry import benchmark as benchmark_module | 12 from telemetry import benchmark as benchmark_module |
14 | 13 |
| 14 from py_utils import discover |
15 | 15 |
16 def GetClassFilePath(clazz): | 16 def GetClassFilePath(clazz): |
17 """ Return the absolute file path to |clazz|. """ | 17 """ Return the absolute file path to |clazz|. """ |
18 assert inspect.isclass(clazz) | 18 assert inspect.isclass(clazz) |
19 path = os.path.abspath(inspect.getfile(clazz)) | 19 path = os.path.abspath(inspect.getfile(clazz)) |
20 if path.endswith('.pyc'): | 20 if path.endswith('.pyc'): |
21 return path[:-1] | 21 return path[:-1] |
22 return path | 22 return path |
23 | 23 |
24 | 24 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 all_perf_benchmarks = GetAllPerfBenchmarks() | 62 all_perf_benchmarks = GetAllPerfBenchmarks() |
63 all_contrib_benchmarks = GetAllContribBenchmarks() | 63 all_contrib_benchmarks = GetAllContribBenchmarks() |
64 return all_perf_benchmarks + all_contrib_benchmarks | 64 return all_perf_benchmarks + all_contrib_benchmarks |
65 | 65 |
66 def GetBenchmarksInSubDirectory(directory): | 66 def GetBenchmarksInSubDirectory(directory): |
67 return discover.DiscoverClasses( | 67 return discover.DiscoverClasses( |
68 start_dir=directory, | 68 start_dir=directory, |
69 top_level_dir = path_util.GetPerfDir(), | 69 top_level_dir = path_util.GetPerfDir(), |
70 base_class=benchmark_module.Benchmark, | 70 base_class=benchmark_module.Benchmark, |
71 index_by_class_name=True).values() | 71 index_by_class_name=True).values() |
OLD | NEW |