OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 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 import os | 5 import os |
6 import tempfile | 6 import tempfile |
7 | 7 |
8 from metrics import loading | 8 from metrics import loading |
9 from telemetry.core import util | 9 from telemetry.core import util |
10 from telemetry.core.platform.profiler import perf_profiler | 10 from telemetry.core.platform.profiler import perf_profiler |
11 from telemetry.page import page_measurement | 11 from telemetry.page import page_measurement |
12 | 12 |
13 class LoadingProfile(page_measurement.PageMeasurement): | 13 class LoadingProfile(page_measurement.PageMeasurement): |
14 def __init__(self): | 14 def __init__(self): |
15 super(LoadingProfile, self).__init__(discard_first_result=True) | 15 super(LoadingProfile, self).__init__(discard_first_result=True) |
16 | 16 |
17 if not perf_profiler.PerfProfiler.is_supported(None): | 17 if not perf_profiler.PerfProfiler.is_supported(browser_type='any'): |
18 raise Exception('This measurement is not supported on this platform') | 18 raise Exception('This measurement is not supported on this platform') |
19 | 19 |
20 @property | 20 @property |
21 def results_are_the_same_on_every_page(self): | 21 def results_are_the_same_on_every_page(self): |
22 return False | 22 return False |
23 | 23 |
24 def AddCommandLineOptions(self, parser): | 24 def AddCommandLineOptions(self, parser): |
25 # In order to change the default of an option, we must remove and re-add it. | 25 # In order to change the default of an option, we must remove and re-add it. |
26 page_repeat_option = parser.get_option('--page-repeat') | 26 page_repeat_option = parser.get_option('--page-repeat') |
27 page_repeat_option.default = 2 | 27 page_repeat_option.default = 2 |
(...skipping 20 matching lines...) Expand all Loading... |
48 loading.LoadingMetric().AddResults(tab, results) | 48 loading.LoadingMetric().AddResults(tab, results) |
49 | 49 |
50 profile_file = None | 50 profile_file = None |
51 for profile_file in profile_files: | 51 for profile_file in profile_files: |
52 if 'renderer' in profile_file: | 52 if 'renderer' in profile_file: |
53 break | 53 break |
54 | 54 |
55 for function, period in perf_profiler.PerfProfiler.GetTopSamples( | 55 for function, period in perf_profiler.PerfProfiler.GetTopSamples( |
56 tab.browser.platform.GetOSName(), profile_file, 10).iteritems(): | 56 tab.browser.platform.GetOSName(), profile_file, 10).iteritems(): |
57 results.Add(function.replace('.', '_'), 'period', period) | 57 results.Add(function.replace('.', '_'), 'period', period) |
OLD | NEW |