Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: tools/perf/measurements/startup.py

Issue 714273004: mac: Expose keychain access frequency to Telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mock_keychain_sleep
Patch Set: Add a common subclass to measurements. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 from measurements import PageTestMeasurement
5 from metrics import startup_metric 6 from metrics import startup_metric
6 from telemetry.page import page_test
7 7
8 8
9 class Startup(page_test.PageTest): 9 class Startup(PageTestMeasurement):
10 """Performs a measurement of Chromium's startup performance. 10 """Performs a measurement of Chromium's startup performance.
11 11
12 This test must be invoked with either --warm or --cold on the command line. A 12 This test must be invoked with either --warm or --cold on the command line. A
13 cold start means none of the Chromium files are in the disk cache. A warm 13 cold start means none of the Chromium files are in the disk cache. A warm
14 start assumes the OS has already cached much of Chromium's content. For warm 14 start assumes the OS has already cached much of Chromium's content. For warm
15 tests, you should repeat the page set to ensure it's cached. 15 tests, you should repeat the page set to ensure it's cached.
16 """ 16 """
17 17
18 def __init__(self, action_name_to_run = ''): 18 def __init__(self, action_name_to_run = ''):
19 super(Startup, self).__init__(needs_browser_restart_after_each_page=True, 19 super(Startup, self).__init__(needs_browser_restart_after_each_page=True,
20 action_name_to_run=action_name_to_run) 20 action_name_to_run=action_name_to_run)
21 21
22 @classmethod 22 @classmethod
23 def AddCommandLineArgs(cls, parser): 23 def AddCommandLineArgs(cls, parser):
24 parser.add_option('--cold', action='store_true', 24 parser.add_option('--cold', action='store_true',
25 help='Clear the OS disk cache before performing the test') 25 help='Clear the OS disk cache before performing the test')
26 parser.add_option('--warm', action='store_true', 26 parser.add_option('--warm', action='store_true',
27 help='Start up with everything already cached') 27 help='Start up with everything already cached')
28 28
29 @classmethod 29 @classmethod
30 def ProcessCommandLineArgs(cls, parser, args): 30 def ProcessCommandLineArgs(cls, parser, args):
31 cls._cold = args.cold 31 cls._cold = args.cold
32 # TODO: Once the bots start running benchmarks, enforce that either --warm 32 # TODO: Once the bots start running benchmarks, enforce that either --warm
33 # or --cold is explicitly specified. 33 # or --cold is explicitly specified.
34 # if args.warm == args.cold: 34 # if args.warm == args.cold:
35 # parser.error('You must specify either --warm or --cold') 35 # parser.error('You must specify either --warm or --cold')
36 36
37 def CustomizeBrowserOptions(self, options): 37 def CustomizeBrowserOptions(self, options):
38 super(Startup, self).CustomizeBrowserOptions(options)
38 if self._cold: 39 if self._cold:
39 options.clear_sytem_cache_for_browser_and_profile_on_start = True 40 options.clear_sytem_cache_for_browser_and_profile_on_start = True
40 else: 41 else:
41 self.discard_first_result = True 42 self.discard_first_result = True
42 43
43 options.AppendExtraBrowserArgs([ 44 options.AppendExtraBrowserArgs([
44 '--enable-stats-collection-bindings' 45 '--enable-stats-collection-bindings'
45 ]) 46 ])
46 47
47 def RunNavigateSteps(self, page, tab): 48 def RunNavigateSteps(self, page, tab):
48 # Overriden so that no page navigation occurs - startup to the NTP. 49 # Overriden so that no page navigation occurs - startup to the NTP.
49 pass 50 pass
50 51
51 def ValidateAndMeasurePage(self, page, tab, results): 52 def ValidateAndMeasurePage(self, page, tab, results):
53 super(Startup, self).ValidateAndMeasurePage(page, tab, results)
52 startup_metric.StartupMetric().AddResults(tab, results) 54 startup_metric.StartupMetric().AddResults(tab, results)
53 55
54 56
55 class StartWithUrl(Startup): 57 class StartWithUrl(Startup):
56 """Performs a measurement of Chromium's performance starting with a URL. 58 """Performs a measurement of Chromium's performance starting with a URL.
57 59
58 This test must be invoked with either --warm or --cold on the command line. A 60 This test must be invoked with either --warm or --cold on the command line. A
59 cold start means none of the Chromium files are in the disk cache. A warm 61 cold start means none of the Chromium files are in the disk cache. A warm
60 start assumes the OS has already cached much of Chromium's content. For warm 62 start assumes the OS has already cached much of Chromium's content. For warm
61 tests, you should repeat the page set to ensure it's cached. 63 tests, you should repeat the page set to ensure it's cached.
62 64
63 The startup URL is taken from the page set's startup_url. This 65 The startup URL is taken from the page set's startup_url. This
64 allows the testing of multiple different URLs in a single benchmark. 66 allows the testing of multiple different URLs in a single benchmark.
65 """ 67 """
66 68
67 def __init__(self): 69 def __init__(self):
68 super(StartWithUrl, self).__init__(action_name_to_run='RunNavigateSteps') 70 super(StartWithUrl, self).__init__(action_name_to_run='RunNavigateSteps')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698