Skip to content

Commit

Permalink
[Telemetry] Add BattOr benchmark.
Browse files Browse the repository at this point in the history
BUG=574888

Review-Url: https://codereview.chromium.org/1984473002
Cr-Commit-Position: refs/heads/master@{#396642}
  • Loading branch information
randalnephew authored and Commit bot committed May 28, 2016
1 parent c70d006 commit 21bd980
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tools/perf/benchmarks/battor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2016 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 core import perf_benchmark
from telemetry.web_perf import timeline_based_measurement
import page_sets


class _BattOrBenchmark(perf_benchmark.PerfBenchmark):

def CreateTimelineBasedMeasurementOptions(self):
options = timeline_based_measurement.Options()
options.config.enable_battor_trace = True
# TODO(rnephew): Enable chrome trace when clock syncs work well with it.
options.config.enable_chrome_trace = False
options.SetTimelineBasedMetric('powerMetric')
return options

@classmethod
def ShouldDisable(cls, possible_browser):
# Only run if BattOr is detected.
if not possible_browser.platform.HasBattOrConnected():
return True

# Galaxy S5s have problems with running system health metrics.
# http://crbug.com/600463
galaxy_s5_type_name = 'SM-G900H'
return possible_browser.platform.GetDeviceTypeName() == galaxy_s5_type_name

@classmethod
def ShouldTearDownStateAfterEachStoryRun(cls):
return True


class BattOrPowerMobileSites(_BattOrBenchmark):
page_set = page_sets.power_cases.PowerCasesPageSet

@classmethod
def Name(cls):
return 'BattOr.BattOrCases'

10 changes: 10 additions & 0 deletions tools/perf/page_sets/data/power_cases.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.",
"archives": {
"power_cases_001.wpr": [
"https://www.youtube.com/watch?v=3KANI2dpXLw?autoplay=1",
"https://webkit.org/blog-files/3d-transforms/poster-circle.html",
"about:blank"
]
}
}
1 change: 1 addition & 0 deletions tools/perf/page_sets/data/power_cases_000.wpr.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ad0c9942a0e37e060df21677fd581d020ab5adc8
1 change: 1 addition & 0 deletions tools/perf/page_sets/data/power_cases_001.wpr.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6eb34ee3e0fe12965951c44bb468cf60a5d0bacd
40 changes: 40 additions & 0 deletions tools/perf/page_sets/power_cases.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2016 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 shared_page_state
from telemetry import story


URL_LIST = [
'https://webkit.org/blog-files/3d-transforms/poster-circle.html',
# Does not autoplay on Android devices.
'https://www.youtube.com/watch?v=3KANI2dpXLw?autoplay=1',
'about:blank'
]


class PowerCasesPage(page_module.Page):

def __init__(self, url, page_set, name=''):
super(PowerCasesPage, self).__init__(
url=url, page_set=page_set, name=name,
credentials_path = 'data/credentials.json',
shared_page_state_class=shared_page_state.SharedDesktopPageState)
self.archive_data_file = 'data/power_cases.json'

def RunPageInteractions(self, action_runner):
action_runner.Wait(30)


class PowerCasesPageSet(story.StorySet):
"""Power hungry pages, used for power testing."""

def __init__(self):
super(PowerCasesPageSet, self).__init__(
archive_data_file='data/power_cases.json',
cloud_storage_bucket=story.PARTNER_BUCKET)

for url in URL_LIST:
self.AddStory(PowerCasesPage(url, self))

0 comments on commit 21bd980

Please sign in to comment.