Chromium Code Reviews| Index: tools/perf/benchmarks/blink_perf.py |
| diff --git a/tools/perf/benchmarks/blink_perf.py b/tools/perf/benchmarks/blink_perf.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..68b6dcd09e04cf1c7a0a3717939b6f6a6e68fe3c |
| --- /dev/null |
| +++ b/tools/perf/benchmarks/blink_perf.py |
| @@ -0,0 +1,61 @@ |
| +# Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import os |
| + |
| +from telemetry import test |
| +from telemetry.core import util |
| +from telemetry.page import page_set |
| + |
| +from measurements import blink_perf |
| + |
| + |
| +def _CreatePageSetFromPath(path): |
| + assert os.path.exists(path) |
| + |
| + page_set_dict = {'pages': []} |
| + |
| + def _AddPage(path): |
|
tonyg
2013/07/18 01:39:00
I assume all this is duplicated with blink_perf.py
dtu
2013/07/18 02:17:05
Done.
|
| + if not path.endswith('.html'): |
| + return |
| + if '../' in open(path, 'r').read(): |
| + # If the page looks like it references its parent dir, include it. |
| + page_set_dict['serving_dirs'] = [os.path.dirname(os.path.dirname(path))] |
| + page_set_dict['pages'].append({'url': |
| + 'file://' + path.replace('\\', '/')}) |
| + |
| + def _AddDir(dir_path, skipped): |
| + for path in os.listdir(dir_path): |
| + if path == 'resources': |
| + continue |
| + path = os.path.join(dir_path, path) |
| + if path.startswith(tuple([os.path.join(path, s) |
| + for s in skipped])): |
| + continue |
| + if os.path.isdir(path): |
| + _AddDir(path, skipped) |
| + else: |
| + _AddPage(path) |
| + |
| + if os.path.isdir(path): |
| + skipped = [] |
| + skipped_file = os.path.join(path, 'Skipped') |
| + if os.path.exists(skipped_file): |
| + for line in open(skipped_file, 'r').readlines(): |
| + line = line.strip() |
| + if line and not line.startswith('#'): |
| + skipped.append(line.replace('/', os.sep)) |
| + _AddDir(path, skipped) |
| + else: |
| + _AddPage(path) |
| + return page_set.PageSet.FromDict(page_set_dict, os.getcwd() + os.sep) |
| + |
| + |
| +class BlinkPerfAll(test.Test): |
| + test = blink_perf.BlinkPerf |
| + |
| + def CreatePageSet(self, options): |
| + path = os.path.join( |
| + util.GetChromiumSrcDir(), 'third_party', 'WebKit', 'PerformanceTests') |
| + return _CreatePageSetFromPath(path) |