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

Side by Side Diff: tools/perf/page_sets/memory_top_10_mobile.py

Issue 2652343004: Use new Background method in memory perf test. (Closed)
Patch Set: Created 3 years, 11 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/memory.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4
5 import re 5 import re
6 6
7 from telemetry.page import page as page_module 7 from telemetry.page import page as page_module
8 from telemetry.page import shared_page_state 8 from telemetry.page import shared_page_state
9 from telemetry import story 9 from telemetry import story
10 10
11 from devil.android.sdk import intent # pylint: disable=import-error
12 from devil.android.sdk import keyevent # pylint: disable=import-error 11 from devil.android.sdk import keyevent # pylint: disable=import-error
13 12
14 from page_sets import top_10_mobile 13 from page_sets import top_10_mobile
15 14
16 15
17 class MemoryMeasurementPage(page_module.Page): 16 class MemoryMeasurementPage(page_module.Page):
18 """Abstract class for measuring memory on a story unit.""" 17 """Abstract class for measuring memory on a story unit."""
19 18
20 _PHASE = NotImplemented 19 _PHASE = NotImplemented
21 20
(...skipping 22 matching lines...) Expand all
44 43
45 _PHASE = 'background' 44 _PHASE = 'background'
46 45
47 def __init__(self, story_set, name): 46 def __init__(self, story_set, name):
48 super(BackgroundPage, self).__init__(story_set, name, 'about:blank') 47 super(BackgroundPage, self).__init__(story_set, name, 'about:blank')
49 48
50 def RunPageInteractions(self, action_runner): 49 def RunPageInteractions(self, action_runner):
51 action_runner.tab.WaitForDocumentReadyStateToBeComplete() 50 action_runner.tab.WaitForDocumentReadyStateToBeComplete()
52 51
53 # Launch clock app, pushing Chrome to the background. 52 # Launch clock app, pushing Chrome to the background.
54 android_platform = action_runner.tab.browser.platform 53 android_browser = action_runner.tab.browser
55 android_platform.LaunchAndroidApplication( 54 android_browser.Background()
56 intent.Intent(package='com.google.android.deskclock',
57 activity='com.android.deskclock.DeskClock'),
58 app_has_webviews=False)
59 55
60 # Take measurement. 56 # Take measurement.
61 action_runner.MeasureMemory(self.story_set.DETERMINISTIC_MODE) 57 action_runner.MeasureMemory(self.story_set.DETERMINISTIC_MODE)
62 58
63 # Go back to Chrome. 59 # Go back to Chrome.
64 android_platform.android_action_runner.InputKeyEvent(keyevent.KEYCODE_BACK) 60 android_browser.platform.android_action_runner.InputKeyEvent(
61 keyevent.KEYCODE_BACK)
65 62
66 63
67 class MemoryTop10Mobile(story.StorySet): 64 class MemoryTop10Mobile(story.StorySet):
68 """User story to measure foreground/background memory in top 10 mobile.""" 65 """User story to measure foreground/background memory in top 10 mobile."""
69 DETERMINISTIC_MODE = True 66 DETERMINISTIC_MODE = True
70 67
71 def __init__(self): 68 def __init__(self):
72 super(MemoryTop10Mobile, self).__init__( 69 super(MemoryTop10Mobile, self).__init__(
73 archive_data_file='data/memory_top_10_mobile.json', 70 archive_data_file='data/memory_top_10_mobile.json',
74 cloud_storage_bucket=story.PARTNER_BUCKET) 71 cloud_storage_bucket=story.PARTNER_BUCKET)
75 72
76 for url in top_10_mobile.URL_LIST: 73 for url in top_10_mobile.URL_LIST:
77 # We name pages so their foreground/background counterparts are easy 74 # We name pages so their foreground/background counterparts are easy
78 # to identify. For example 'http://google.com' becomes 75 # to identify. For example 'http://google.com' becomes
79 # 'http_google_com' and 'after_http_google_com' respectively. 76 # 'http_google_com' and 'after_http_google_com' respectively.
80 name = re.sub(r'\W+', '_', url) 77 name = re.sub(r'\W+', '_', url)
81 self.AddStory(ForegroundPage(self, name, url)) 78 self.AddStory(ForegroundPage(self, name, url))
82 self.AddStory(BackgroundPage(self, 'after_' + name)) 79 self.AddStory(BackgroundPage(self, 'after_' + name))
83 80
84 81
85 class MemoryTop10MobileRealistic(MemoryTop10Mobile): 82 class MemoryTop10MobileRealistic(MemoryTop10Mobile):
86 """Top 10 mobile user story in realistic mode. 83 """Top 10 mobile user story in realistic mode.
87 84
88 This means, in particular, neither forced GCs nor clearing caches. 85 This means, in particular, neither forced GCs nor clearing caches.
89 """ 86 """
90 DETERMINISTIC_MODE = False 87 DETERMINISTIC_MODE = False
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/memory.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698