From da1f2c3e702923959727a2ae50f440e228590eb9 Mon Sep 17 00:00:00 2001 From: nednguyen Date: Mon, 10 Nov 2014 16:37:30 -0800 Subject: [PATCH] [Telemetry] Split top_25 to top_25_smooth and top_25_repaint BUG=418375 Review URL: https://codereview.chromium.org/682263005 Cr-Commit-Position: refs/heads/master@{#303550} --- .../perf/benchmarks/rasterize_and_record_micro.py | 2 +- tools/perf/benchmarks/smoothness.py | 4 +- tools/perf/page_sets/data/top_25_repaint.json | 32 ++++ .../page_sets/data/top_25_repaint_000.wpr.sha1 | 1 + tools/perf/page_sets/top_25_repaint.py | 86 +++++++++ tools/perf/page_sets/top_25_smooth.py | 151 +++++++++++++++ tools/perf/page_sets/{top_25.py => top_pages.py} | 208 ++++++--------------- 7 files changed, 327 insertions(+), 157 deletions(-) create mode 100644 tools/perf/page_sets/data/top_25_repaint.json create mode 100644 tools/perf/page_sets/data/top_25_repaint_000.wpr.sha1 create mode 100644 tools/perf/page_sets/top_25_repaint.py create mode 100644 tools/perf/page_sets/top_25_smooth.py rename tools/perf/page_sets/{top_25.py => top_pages.py} (52%) diff --git a/tools/perf/benchmarks/rasterize_and_record_micro.py b/tools/perf/benchmarks/rasterize_and_record_micro.py index 4626435b70a4..dde1b666a665 100644 --- a/tools/perf/benchmarks/rasterize_and_record_micro.py +++ b/tools/perf/benchmarks/rasterize_and_record_micro.py @@ -15,7 +15,7 @@ class RasterizeAndRecordMicroTop25(benchmark.Benchmark): http://www.chromium.org/developers/design-documents/rendering-benchmarks""" test = rasterize_and_record_micro.RasterizeAndRecordMicro - page_set = page_sets.Top25PageSet + page_set = page_sets.Top25SmoothPageSet @benchmark.Disabled('mac', 'win') diff --git a/tools/perf/benchmarks/smoothness.py b/tools/perf/benchmarks/smoothness.py index b5536744b009..18dd6f2352ec 100644 --- a/tools/perf/benchmarks/smoothness.py +++ b/tools/perf/benchmarks/smoothness.py @@ -13,7 +13,7 @@ class SmoothnessTop25(benchmark.Benchmark): http://www.chromium.org/developers/design-documents/rendering-benchmarks""" test = smoothness.Smoothness - page_set = page_sets.Top25PageSet + page_set = page_sets.Top25SmoothPageSet class SmoothnessToughFiltersCases(benchmark.Benchmark): @@ -68,7 +68,7 @@ class SmoothnessGpuRasterizationTop25(benchmark.Benchmark): """ tag = 'gpu_rasterization' test = smoothness.Smoothness - page_set = page_sets.Top25PageSet + page_set = page_sets.Top25SmoothPageSet def CustomizeBrowserOptions(self, options): silk_flags.CustomizeBrowserOptionsForGpuRasterization(options) diff --git a/tools/perf/page_sets/data/top_25_repaint.json b/tools/perf/page_sets/data/top_25_repaint.json new file mode 100644 index 000000000000..0c9258bc6d33 --- /dev/null +++ b/tools/perf/page_sets/data/top_25_repaint.json @@ -0,0 +1,32 @@ +{ + "description": "Describes the Web Page Replay archives for a page set. Don't edit by hand! Use record_wpr for updating.", + "archives": { + "top_25_repaint_000.wpr": [ + "http://techcrunch.com", + "https://www.google.com/#hl=en&q=barack+obama", + "http://answers.yahoo.com", + "https://www.google.com/calendar/", + "https://www.google.com/search?q=cats&tbm=isch", + "Docs (1 open document tab)", + "https://plus.google.com/110031535020051778989/posts", + "http://www.youtube.com", + "Blogger", + "Wordpress", + "http://booking.com", + "Weather.com", + "Facebook", + "LinkedIn", + "Wikipedia (1 tab)", + "Twitter", + "Pinterest", + "ESPN", + "https://mail.google.com/mail/", + "http://games.yahoo.com", + "http://news.yahoo.com", + "http://www.cnn.com", + "http://www.amazon.com", + "http://www.ebay.com", + "http://sports.yahoo.com/" + ] + } +} \ No newline at end of file diff --git a/tools/perf/page_sets/data/top_25_repaint_000.wpr.sha1 b/tools/perf/page_sets/data/top_25_repaint_000.wpr.sha1 new file mode 100644 index 000000000000..74bc057b5ce8 --- /dev/null +++ b/tools/perf/page_sets/data/top_25_repaint_000.wpr.sha1 @@ -0,0 +1 @@ +63cbf11264f320550a66235fd80172830c039619 \ No newline at end of file diff --git a/tools/perf/page_sets/top_25_repaint.py b/tools/perf/page_sets/top_25_repaint.py new file mode 100644 index 000000000000..66a08eb9914f --- /dev/null +++ b/tools/perf/page_sets/top_25_repaint.py @@ -0,0 +1,86 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +from telemetry.page import page as page_module +from telemetry.page import page_set as page_set_module + +from page_sets import top_pages + + +class TopRepaintPage(page_module.Page): + + def __init__(self, url, page_set, name='', credentials=None): + super(TopRepaintPage, self).__init__( + url=url, page_set=page_set, name=name, + credentials_path='data/credentials.json') + self.user_agent_type = 'desktop' + self.archive_data_file = 'data/top_25_repaint.json' + self.credentials = credentials + + def RunRepaint(self, action_runner): + action_runner.RepaintContinuously(seconds=5) + + +def _CreatePageClassWithRepaintInteractions(page_cls): + class DerivedRepaintPage(page_cls): # pylint: disable=W0232 + + def RunRepaint(self, action_runner): + action_runner.RepaintContinuously(seconds=5) + return DerivedRepaintPage + + +class Top25RepaintPageSet(page_set_module.PageSet): + + """ Pages hand-picked for 2012 CrOS scrolling tuning efforts. """ + + def __init__(self): + super(Top25RepaintPageSet, self).__init__( + user_agent_type='desktop', + archive_data_file='data/top_25_repaint.json', + bucket=page_set_module.PARTNER_BUCKET) + + top_page_classes = [ + top_pages.GoogleWebSearchPage, + top_pages.GoogleImageSearchPage, + top_pages.GmailPage, + top_pages.GoogleCalendarPage, + top_pages.GoogleDocPage, + top_pages.GooglePlusPage, + top_pages.YoutubePage, + top_pages.BlogspotPage, + top_pages.WordpressPage, + top_pages.FacebookPage, + top_pages.LinkedinPage, + top_pages.WikipediaPage, + top_pages.TwitterPage, + top_pages.PinterestPage, + top_pages.ESPNPage, + top_pages.WeatherPage, + top_pages.YahooGamesPage, + ] + + for cl in top_page_classes: + self.AddPage(_CreatePageClassWithRepaintInteractions(cl)(self)) + + other_urls = [ + # Why: #1 news worldwide (Alexa global) + 'http://news.yahoo.com', + # Why: #2 news worldwide + 'http://www.cnn.com', + # Why: #1 world commerce website by visits; #3 commerce in the US by + # time spent + 'http://www.amazon.com', + # Why: #1 commerce website by time spent by users in US + 'http://www.ebay.com', + # Why: #1 Alexa recreation + 'http://booking.com', + # Why: #1 Alexa reference + 'http://answers.yahoo.com', + # Why: #1 Alexa sports + 'http://sports.yahoo.com/', + # Why: top tech blog + 'http://techcrunch.com' + ] + + for url in other_urls: + self.AddPage(TopRepaintPage(url, self)) diff --git a/tools/perf/page_sets/top_25_smooth.py b/tools/perf/page_sets/top_25_smooth.py new file mode 100644 index 000000000000..7fc5aadf2ade --- /dev/null +++ b/tools/perf/page_sets/top_25_smooth.py @@ -0,0 +1,151 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +from telemetry.page import page as page_module +from telemetry.page import page_set as page_set_module + +from page_sets import top_pages + + +def _IssueMarkerAndScroll(action_runner): + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage() + interaction.End() + + +def _CreatePageClassWithSmoothInteractions(page_cls): + class DerivedSmoothPage(page_cls): # pylint: disable=W0232 + + def RunSmoothness(self, action_runner): + _IssueMarkerAndScroll(action_runner) + return DerivedSmoothPage + + +class TopSmoothPage(page_module.Page): + + def __init__(self, url, page_set, name='', credentials=None): + super(TopSmoothPage, self).__init__( + url=url, page_set=page_set, name=name, + credentials_path='data/credentials.json') + self.user_agent_type = 'desktop' + self.credentials = credentials + + def RunSmoothness(self, action_runner): + _IssueMarkerAndScroll(action_runner) + + +class GmailSmoothPage(top_pages.GmailPage): + + """ Why: productivity, top google properties """ + + def RunSmoothness(self, action_runner): + action_runner.ExecuteJavaScript(''' + gmonkey.load('2.0', function(api) { + window.__scrollableElementForTelemetry = api.getScrollableElement(); + });''') + action_runner.WaitForJavaScriptCondition( + 'window.__scrollableElementForTelemetry != null') + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollElement( + element_function='window.__scrollableElementForTelemetry') + interaction.End() + + +class GoogleCalendarSmoothPage(top_pages.GoogleCalendarPage): + + """ Why: productivity, top google properties """ + + def RunSmoothness(self, action_runner): + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollElement(selector='#scrolltimedeventswk') + interaction.End() + + +class GoogleDocSmoothPage(top_pages.GoogleDocPage): + + """ Why: productivity, top google properties; Sample doc in the link """ + + def RunSmoothness(self, action_runner): + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollElement(selector='.kix-appview-editor') + interaction.End() + + +class ESPNSmoothPage(top_pages.ESPNPage): + + """ Why: #1 sports """ + + def RunSmoothness(self, action_runner): + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage(left_start_ratio=0.1) + interaction.End() + + +class Top25SmoothPageSet(page_set_module.PageSet): + + """ Pages hand-picked for 2012 CrOS scrolling tuning efforts. """ + + def __init__(self): + super(Top25SmoothPageSet, self).__init__( + user_agent_type='desktop', + archive_data_file='data/top_25.json', + bucket=page_set_module.PARTNER_BUCKET) + + self.AddPage(_CreatePageClassWithSmoothInteractions( + top_pages.GoogleWebSearchPage)(self)) + self.AddPage(GmailSmoothPage(self)) + self.AddPage(GoogleCalendarSmoothPage(self)) + self.AddPage(_CreatePageClassWithSmoothInteractions( + top_pages.GoogleImageSearchPage)(self)) + self.AddPage(GoogleDocSmoothPage(self)) + self.AddPage(_CreatePageClassWithSmoothInteractions( + top_pages.GooglePlusPage)(self)) + self.AddPage(_CreatePageClassWithSmoothInteractions( + top_pages.YoutubePage)(self)) + self.AddPage(_CreatePageClassWithSmoothInteractions( + top_pages.BlogspotPage)(self)) + self.AddPage(_CreatePageClassWithSmoothInteractions( + top_pages.WordpressPage)(self)) + self.AddPage(_CreatePageClassWithSmoothInteractions( + top_pages.FacebookPage)(self)) + self.AddPage(_CreatePageClassWithSmoothInteractions( + top_pages.LinkedinPage)(self)) + self.AddPage(_CreatePageClassWithSmoothInteractions( + top_pages.WikipediaPage)(self)) + self.AddPage(_CreatePageClassWithSmoothInteractions( + top_pages.TwitterPage)(self)) + self.AddPage(_CreatePageClassWithSmoothInteractions( + top_pages.PinterestPage)(self)) + self.AddPage(ESPNSmoothPage(self)) + self.AddPage(_CreatePageClassWithSmoothInteractions( + top_pages.WeatherPage)(self)) + self.AddPage(_CreatePageClassWithSmoothInteractions( + top_pages.YahooGamesPage)(self)) + + other_urls = [ + # Why: #1 news worldwide (Alexa global) + 'http://news.yahoo.com', + # Why: #2 news worldwide + 'http://www.cnn.com', + # Why: #1 world commerce website by visits; #3 commerce in the US by + # time spent + 'http://www.amazon.com', + # Why: #1 commerce website by time spent by users in US + 'http://www.ebay.com', + # Why: #1 Alexa recreation + 'http://booking.com', + # Why: #1 Alexa reference + 'http://answers.yahoo.com', + # Why: #1 Alexa sports + 'http://sports.yahoo.com/', + # Why: top tech blog + 'http://techcrunch.com' + ] + + for url in other_urls: + self.AddPage(TopSmoothPage(url, self)) diff --git a/tools/perf/page_sets/top_25.py b/tools/perf/page_sets/top_pages.py similarity index 52% rename from tools/perf/page_sets/top_25.py rename to tools/perf/page_sets/top_pages.py index 268ef6350199..8856e41a1ab4 100644 --- a/tools/perf/page_sets/top_25.py +++ b/tools/perf/page_sets/top_pages.py @@ -2,39 +2,20 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import page as page_module -from telemetry.page import page_set as page_set_module -def _GetCurrentLocation(action_runner): - return action_runner.EvaluateJavaScript('document.location.href') - - -def _WaitForLocationChange(action_runner, old_href): - action_runner.WaitForJavaScriptCondition( - 'document.location.href != "%s"' % old_href) - - -class Top25Page(page_module.Page): +class TopPages(page_module.Page): def __init__(self, url, page_set, name='', credentials=None): - super(Top25Page, self).__init__( + super(TopPages, self).__init__( url=url, page_set=page_set, name=name, credentials_path='data/credentials.json') self.user_agent_type = 'desktop' self.archive_data_file = 'data/top_25.json' self.credentials = credentials - def RunSmoothness(self, action_runner): - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - - def RunRepaint(self, action_runner): - action_runner.RepaintContinuously(seconds=5) - -class GoogleWebSearchPage(Top25Page): +class GoogleWebSearchPage(TopPages): """ Why: top google property; a google tab is often open """ @@ -48,7 +29,17 @@ class GoogleWebSearchPage(Top25Page): action_runner.WaitForElement(text='Next') -class GmailPage(Top25Page): +class GoogleImageSearchPage(TopPages): + + """ Why: tough image case; top google properties """ + + def __init__(self, page_set): + super(GoogleImageSearchPage, self).__init__( + 'https://www.google.com/search?q=cats&tbm=isch', + page_set=page_set, credentials='google') + + +class GmailPage(TopPages): """ Why: productivity, top google properties """ @@ -64,21 +55,8 @@ class GmailPage(Top25Page): 'window.gmonkey !== undefined &&' 'document.getElementById("gb") !== null') - def RunSmoothness(self, action_runner): - action_runner.ExecuteJavaScript(''' - gmonkey.load('2.0', function(api) { - window.__scrollableElementForTelemetry = api.getScrollableElement(); - });''') - action_runner.WaitForJavaScriptCondition( - 'window.__scrollableElementForTelemetry != null') - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollElement( - element_function='window.__scrollableElementForTelemetry') - interaction.End() - -class GoogleCalendarPage(Top25Page): +class GoogleCalendarPage(TopPages): """ Why: productivity, top google properties """ @@ -101,14 +79,8 @@ class GoogleCalendarPage(Top25Page): })();''') action_runner.Wait(1) - def RunSmoothness(self, action_runner): - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollElement(selector='#scrolltimedeventswk') - interaction.End() - -class GoogleDocPage(Top25Page): +class GoogleDocPage(TopPages): """ Why: productivity, top google properties; Sample doc in the link """ @@ -126,14 +98,8 @@ class GoogleDocPage(Top25Page): action_runner.WaitForJavaScriptCondition( 'document.getElementsByClassName("kix-appview-editor").length') - def RunSmoothness(self, action_runner): - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollElement(selector='.kix-appview-editor') - interaction.End() - -class GooglePlusPage(Top25Page): +class GooglePlusPage(TopPages): """ Why: social; top google property; Public profile; infinite scrolls """ @@ -147,14 +113,8 @@ class GooglePlusPage(Top25Page): action_runner.NavigateToPage(self) action_runner.WaitForElement(text='Home') - def RunSmoothness(self, action_runner): - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - -class YoutubePage(Top25Page): +class YoutubePage(TopPages): """ Why: #3 (Alexa global) """ @@ -168,7 +128,7 @@ class YoutubePage(Top25Page): action_runner.Wait(2) -class BlogspotPage(Top25Page): +class BlogspotPage(TopPages): """ Why: #11 (Alexa global), google property; some blogger layouts have infinite scroll but more interesting """ @@ -184,7 +144,7 @@ class BlogspotPage(Top25Page): action_runner.WaitForElement(text='accessibility') -class WordpressPage(Top25Page): +class WordpressPage(TopPages): """ Why: #18 (Alexa global), Picked an interesting post """ @@ -202,7 +162,7 @@ class WordpressPage(Top25Page): 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sight/"]') -class FacebookPage(Top25Page): +class FacebookPage(TopPages): """ Why: top social,Public profile """ @@ -216,14 +176,28 @@ class FacebookPage(Top25Page): action_runner.NavigateToPage(self) action_runner.WaitForElement(text='About') - def RunSmoothness(self, action_runner): - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() +class LinkedinPage(TopPages): + + """ Why: #12 (Alexa global), Public profile. """ -class TwitterPage(Top25Page): + def __init__(self, page_set): + super(LinkedinPage, self).__init__( + url='http://www.linkedin.com/in/linustorvalds', page_set=page_set, + name='LinkedIn') + + +class WikipediaPage(TopPages): + + """ Why: #6 (Alexa) most visited worldwide,Picked an interesting page. """ + + def __init__(self, page_set): + super(WikipediaPage, self).__init__( + url='http://en.wikipedia.org/wiki/Wikipedia', page_set=page_set, + name='Wikipedia (1 tab)') + + +class TwitterPage(TopPages): """ Why: #8 (Alexa global),Picked an interesting page """ @@ -237,14 +211,8 @@ class TwitterPage(Top25Page): action_runner.NavigateToPage(self) action_runner.Wait(2) - def RunSmoothness(self, action_runner): - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - -class PinterestPage(Top25Page): +class PinterestPage(TopPages): """ Why: #37 (Alexa global) """ @@ -254,14 +222,8 @@ class PinterestPage(Top25Page): page_set=page_set, name='Pinterest') - def RunSmoothness(self, action_runner): - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - -class ESPNPage(Top25Page): +class ESPNPage(TopPages): """ Why: #1 sports """ @@ -271,14 +233,19 @@ class ESPNPage(Top25Page): page_set=page_set, name='ESPN') - def RunSmoothness(self, action_runner): - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage(left_start_ratio=0.1) - interaction.End() +class WeatherPage(TopPages): -class YahooGamesPage(Top25Page): + """ Why: #7 (Alexa news); #27 total time spent, picked interesting page. """ + + def __init__(self, page_set): + super(WeatherPage, self).__init__( + url='http://www.weather.com/weather/right-now/Mountain+View+CA+94043', + page_set=page_set, + name='Weather.com') + + +class YahooGamesPage(TopPages): """ Why: #1 games according to Alexa (with actual games in it) """ @@ -290,70 +257,3 @@ class YahooGamesPage(Top25Page): def RunNavigateSteps(self, action_runner): action_runner.NavigateToPage(self) action_runner.Wait(2) - - -class Top25PageSet(page_set_module.PageSet): - - """ Pages hand-picked for 2012 CrOS scrolling tuning efforts. """ - - def __init__(self): - super(Top25PageSet, self).__init__( - user_agent_type='desktop', - archive_data_file='data/top_25.json', - bucket=page_set_module.PARTNER_BUCKET) - - self.AddPage(GoogleWebSearchPage(self)) - self.AddPage(GmailPage(self)) - self.AddPage(GoogleCalendarPage(self)) - # Why: tough image case; top google properties - self.AddPage( - Top25Page('https://www.google.com/search?q=cats&tbm=isch', - page_set=self, credentials='google')) - self.AddPage(GoogleDocPage(self)) - self.AddPage(GooglePlusPage(self)) - self.AddPage(YoutubePage(self)) - self.AddPage(BlogspotPage(self)) - self.AddPage(WordpressPage(self)) - self.AddPage(FacebookPage(self)) - # Why: #12 (Alexa global), Public profile. - self.AddPage( - Top25Page( - 'http://www.linkedin.com/in/linustorvalds', page_set=self, - name='LinkedIn')) - # Why: #6 (Alexa) most visited worldwide,Picked an interesting page - self.AddPage( - Top25Page( - 'http://en.wikipedia.org/wiki/Wikipedia', page_set=self, - name='Wikipedia (1 tab)')) - self.AddPage(TwitterPage(self)) - self.AddPage(PinterestPage(self)) - self.AddPage(ESPNPage(self)) - # Why: #7 (Alexa news); #27 total time spent, picked interesting page. - self.AddPage(Top25Page( - url='http://www.weather.com/weather/right-now/Mountain+View+CA+94043', - page_set=self, - name='Weather.com')) - self.AddPage(YahooGamesPage(self)) - - other_urls = [ - # Why: #1 news worldwide (Alexa global) - 'http://news.yahoo.com', - # Why: #2 news worldwide - 'http://www.cnn.com', - # Why: #1 world commerce website by visits; #3 commerce in the US by - # time spent - 'http://www.amazon.com', - # Why: #1 commerce website by time spent by users in US - 'http://www.ebay.com', - # Why: #1 Alexa recreation - 'http://booking.com', - # Why: #1 Alexa reference - 'http://answers.yahoo.com', - # Why: #1 Alexa sports - 'http://sports.yahoo.com/', - # Why: top tech blog - 'http://techcrunch.com' - ] - - for url in other_urls: - self.AddPage(Top25Page(url, self)) -- 2.11.4.GIT