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

Side by Side Diff: tools/perf/benchmarks/session_restore.py

Issue 962793004: [Telemetry] Make "discard_first_result" apply to user_stories too. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 5 years, 9 months 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
« no previous file with comments | « tools/perf/benchmarks/page_cycler.py ('k') | tools/perf/benchmarks/startup.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import os 5 import os
6 import tempfile 6 import tempfile
7 7
8 from measurements import session_restore 8 from measurements import session_restore
9 import page_sets 9 import page_sets
10 from profile_creators import small_profile_creator 10 from profile_creators import small_profile_creator
11 from telemetry import benchmark 11 from telemetry import benchmark
12 from telemetry.page import profile_generator 12 from telemetry.page import profile_generator
13 13
14 14
15 class _SessionRestoreTypical25(benchmark.Benchmark): 15 class _SessionRestoreTypical25(benchmark.Benchmark):
16 """Base Benchmark class for session restore benchmarks. 16 """Base Benchmark class for session restore benchmarks.
17 17
18 A cold start means none of the Chromium files are in the disk cache. 18 A cold start means none of the Chromium files are in the disk cache.
19 A warm start assumes the OS has already cached much of Chromium's content. 19 A warm start assumes the OS has already cached much of Chromium's content.
20 For warm tests, you should repeat the page set to ensure it's cached. 20 For warm tests, you should repeat the page set to ensure it's cached.
21 21
22 Use Typical25PageSet to match what the SmallProfileCreator uses. 22 Use Typical25PageSet to match what the SmallProfileCreator uses.
23 TODO(slamm): Make SmallProfileCreator and this use the same page_set ref. 23 TODO(slamm): Make SmallProfileCreator and this use the same page_set ref.
24 """ 24 """
25 page_set = page_sets.Typical25PageSet 25 page_set = page_sets.Typical25PageSet
26 tag = None # override with 'warm' or 'cold'
26 27
27 @classmethod 28 @classmethod
28 def Name(cls): 29 def Name(cls):
29 return 'session_restore' 30 return 'session_restore'
30 31
31 @classmethod 32 @classmethod
32 def ProcessCommandLineArgs(cls, parser, args): 33 def ProcessCommandLineArgs(cls, parser, args):
33 super(_SessionRestoreTypical25, cls).ProcessCommandLineArgs(parser, args) 34 super(_SessionRestoreTypical25, cls).ProcessCommandLineArgs(parser, args)
34 profile_type = 'small_profile' 35 profile_type = 'small_profile'
35 if not args.browser_options.profile_dir: 36 if not args.browser_options.profile_dir:
36 output_dir = os.path.join(tempfile.gettempdir(), profile_type) 37 output_dir = os.path.join(tempfile.gettempdir(), profile_type)
37 profile_dir = os.path.join(output_dir, profile_type) 38 profile_dir = os.path.join(output_dir, profile_type)
38 if not os.path.exists(output_dir): 39 if not os.path.exists(output_dir):
39 os.makedirs(output_dir) 40 os.makedirs(output_dir)
40 41
41 # Generate new profiles if profile_dir does not exist. It only exists if 42 # Generate new profiles if profile_dir does not exist. It only exists if
42 # all profiles had been correctly generated in a previous run. 43 # all profiles had been correctly generated in a previous run.
43 if not os.path.exists(profile_dir): 44 if not os.path.exists(profile_dir):
44 new_args = args.Copy() 45 new_args = args.Copy()
45 new_args.pageset_repeat = 1 46 new_args.pageset_repeat = 1
46 new_args.output_dir = output_dir 47 new_args.output_dir = output_dir
47 profile_generator.GenerateProfiles( 48 profile_generator.GenerateProfiles(
48 small_profile_creator.SmallProfileCreator, profile_type, new_args) 49 small_profile_creator.SmallProfileCreator, profile_type, new_args)
49 args.browser_options.profile_dir = profile_dir 50 args.browser_options.profile_dir = profile_dir
50 51
52 @classmethod
53 def ValueCanBeAddedPredicate(cls, _, is_first_result):
54 return cls.tag == 'cold' or not is_first_result
55
51 def CreateUserStorySet(self, _): 56 def CreateUserStorySet(self, _):
52 """Return a user story set that only has the first user story. 57 """Return a user story set that only has the first user story.
53 58
54 The session restore measurement skips the navigation step and 59 The session restore measurement skips the navigation step and
55 only tests session restore by having the browser start-up. 60 only tests session restore by having the browser start-up.
56 The first user story is used to get WPR set up and hold results. 61 The first user story is used to get WPR set up and hold results.
57 """ 62 """
58 user_story_set = self.page_set() 63 user_story_set = self.page_set()
59 for user_story in user_story_set.user_stories[1:]: 64 for user_story in user_story_set.user_stories[1:]:
60 user_story_set.RemoveUserStory(user_story) 65 user_story_set.RemoveUserStory(user_story)
(...skipping 25 matching lines...) Expand all
86 91
87 The first result is discarded. 92 The first result is discarded.
88 """ 93 """
89 tag = 'warm' 94 tag = 'warm'
90 options = {'pageset_repeat': 20} 95 options = {'pageset_repeat': 20}
91 96
92 @classmethod 97 @classmethod
93 def Name(cls): 98 def Name(cls):
94 return 'session_restore.warm.typical_25' 99 return 'session_restore.warm.typical_25'
95 100
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/page_cycler.py ('k') | tools/perf/benchmarks/startup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698