Commit 105c0431 authored by Deepanjan Roy's avatar Deepanjan Roy Committed by Commit Bot

[loading_ct] Cache temperature flag and default COLD

Allows specifying cache temperature with --cache-temperature.
Values are as defined in telemetry/page/cache_temperature.py.
For example: --cache-temperature=warm.

Also, changes the default cache temperature for loading_ct to
COLD.

Change-Id: Ib0210bf2a72d28902bfe653cc01646aae4ccbcff
Reviewed-on: https://chromium-review.googlesource.com/1106643
Commit-Queue: Deepanjan Roy <dproy@chromium.org>
Reviewed-by: default avatarRavi Mistry <rmistry@chromium.org>
Reviewed-by: default avatarNed Nguyen <nednguyen@google.com>
Reviewed-by: default avatarTimothy Dresser <tdresser@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569260}
parent f89cb5f7
......@@ -6,6 +6,7 @@ from benchmarks import loading
from contrib.cluster_telemetry import ct_benchmarks_util
from contrib.cluster_telemetry import page_set
from telemetry.page import cache_temperature as cache_temperature_module
from telemetry.page import traffic_setting
......@@ -15,6 +16,7 @@ class LoadingClusterTelemetry(loading._LoadingBase):
options = {'upload_results': True}
_ALL_NET_CONFIGS = traffic_setting.NETWORK_CONFIGS.keys()
_ALL_CACHE_TEMPERATURES = cache_temperature_module.ALL_CACHE_TEMPERATURES
@classmethod
def AddBenchmarkCommandLineArgs(cls, parser):
......@@ -28,6 +30,11 @@ class LoadingClusterTelemetry(loading._LoadingBase):
default=traffic_setting.REGULAR_4G,
help='Traffic condition (string). Default to "%%default". Can be: %s' %
', '.join(cls._ALL_NET_CONFIGS))
parser.add_option(
'--cache-temperature', choices=cls._ALL_CACHE_TEMPERATURES,
default=cache_temperature_module.COLD,
help='Cache temperature (string). Default to "%%default". Can be: %s' %
', '.join(cls._ALL_CACHE_TEMPERATURES))
def CreateStorySet(self, options):
def Wait(action_runner):
......@@ -35,6 +42,7 @@ class LoadingClusterTelemetry(loading._LoadingBase):
return page_set.CTPageSet(
options.urls_list, options.user_agent, options.archive_data_file,
traffic_setting=options.traffic_setting,
cache_temperature=options.cache_temperature,
run_page_interaction_callback=Wait)
@classmethod
......
......@@ -4,6 +4,7 @@
from contrib.cluster_telemetry import shared_browserless_story
from telemetry.page import cache_temperature as cache_temperature_module
from telemetry.page import traffic_setting as traffic_setting_module
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
......@@ -14,12 +15,14 @@ class CTPage(page_module.Page):
def __init__(self, url, page_set, shared_page_state_class, archive_data_file,
traffic_setting, run_page_interaction_callback,
run_navigate_steps_callback):
run_navigate_steps_callback, cache_temperature):
super(CTPage, self).__init__(
url=url,
page_set=page_set,
shared_page_state_class=shared_page_state_class,
traffic_setting=traffic_setting,
cache_temperature=cache_temperature,
grouping_keys={'temperature': cache_temperature},
name=url)
self.archive_data_file = archive_data_file
self._run_navigate_steps_callback = run_navigate_steps_callback
......@@ -64,7 +67,8 @@ class CTPageSet(story.StorySet):
def __init__(self, urls_list, user_agent, archive_data_file,
traffic_setting=traffic_setting_module.NONE,
run_page_interaction_callback=None,
run_navigate_steps_callback=None):
run_navigate_steps_callback=None,
cache_temperature=cache_temperature_module.ANY):
if user_agent == 'mobile':
shared_page_state_class = shared_page_state.SharedMobilePageState
elif user_agent == 'desktop':
......@@ -77,7 +81,8 @@ class CTPageSet(story.StorySet):
for url in urls_list.split(','):
self.AddStory(
CTPage(url, self, shared_page_state_class=shared_page_state_class,
archive_data_file=archive_data_file,
traffic_setting=traffic_setting,
run_page_interaction_callback=run_page_interaction_callback,
run_navigate_steps_callback=run_navigate_steps_callback,))
archive_data_file=archive_data_file,
traffic_setting=traffic_setting,
run_page_interaction_callback=run_page_interaction_callback,
run_navigate_steps_callback=run_navigate_steps_callback,
cache_temperature=cache_temperature))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment