summaryrefslogtreecommitdiffstats
path: root/tools/perf/benchmarks/tab_switching.py
blob: 52a2196d37fa224200939a0d6adcea26cb99690a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Copyright 2013 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 measurements import tab_switching
import page_sets
from telemetry import benchmark


@benchmark.Enabled('has tabs')
@benchmark.Disabled('android')  # http://crbug.com/460084
class TabSwitchingTop10(perf_benchmark.PerfBenchmark):
  """This test records the MPArch.RWH_TabSwitchPaintDuration histogram.

  The histogram is a measure of the time between when a tab was requested to be
  shown, and when first paint occurred. The script opens 10 pages in different
  tabs, waits for them to load, and then switches to each tab and records the
  metric. The pages were chosen from Alexa top ranking sites.
  """
  test = tab_switching.TabSwitching
  page_set = page_sets.Top10PageSet

  @classmethod
  def Name(cls):
    return 'tab_switching.top_10'


@benchmark.Enabled('has tabs')
@benchmark.Disabled('android')  # http://crbug.com/460084
class TabSwitchingTypical25(perf_benchmark.PerfBenchmark):
  """This test records the MPArch.RWH_TabSwitchPaintDuration histogram.

  The histogram is a measure of the time between when a tab was requested to be
  shown, and when first paint occurred. The script opens 25 pages in different
  tabs, waits for them to load, and then switches to each tab and records the
  metric. The pages were chosen from Alexa top ranking sites.
  """
  test = tab_switching.TabSwitching

  def CreateStorySet(self, options):
    return page_sets.Typical25PageSet(run_no_page_interactions=True)

  @classmethod
  def Name(cls):
    return 'tab_switching.typical_25'


@benchmark.Disabled('android')  # http://crbug.com/460084
@benchmark.Enabled('has tabs')
class TabSwitchingFiveBlankTabs(perf_benchmark.PerfBenchmark):
  """This test records the MPArch.RWH_TabSwitchPaintDuration histogram.

  The histogram is a measure of the time between when a tab was requested to be
  shown, and when first paint occurred. The script opens 5 blank pages in
  different tabs, waits for them to load, and then switches to each tab and
  records the metric. Blank pages are use to detect unnecessary idle wakeups.
  """
  test = tab_switching.TabSwitching
  page_set = page_sets.FiveBlankPagesPageSet
  options = {'pageset_repeat': 10}

  @classmethod
  def Name(cls):
    return 'tab_switching.five_blank_pages'


@benchmark.Enabled('has tabs')
# http://crbug.com/460084, http://crbug.com/488067
@benchmark.Disabled('android', 'linux')
class TabSwitchingToughEnergyCases(perf_benchmark.PerfBenchmark):
  """This test records the MPArch.RWH_TabSwitchPaintDuration histogram.

  The histogram is a measure of the time between when a tab was requested to be
  shown, and when first paint occurred. The script opens each page in a
  different tab, waits for them to load, and then switches to each tab and
  records the metric. The pages were written by hand to stress energy usage.
  """
  test = tab_switching.TabSwitching
  page_set = page_sets.ToughEnergyCasesPageSet
  options = {'pageset_repeat': 10}

  @classmethod
  def Name(cls):
    return 'tab_switching.tough_energy_cases'


@benchmark.Enabled('has tabs')
@benchmark.Disabled('android')  # http://crbug.com/460084
class TabSwitchingToughImageCases(perf_benchmark.PerfBenchmark):
  """This test records the MPArch.RWH_TabSwitchPaintDuration histogram.

  The histogram is a measure of the time between when a tab was requested to be
  shown, and when first paint occurred. The script opens each page in different
  tabs, waits for them to load, and then switches to each tab and records the
  metric. The pages were chosen by hand to stress the image decoding system.
  """
  test = tab_switching.TabSwitching
  page_set = page_sets.ToughImageCasesPageSet

  @classmethod
  def Name(cls):
    return 'tab_switching.tough_image_cases'


@benchmark.Disabled
class TabSwitchingFlashEnergyCases(perf_benchmark.PerfBenchmark):
  test = tab_switching.TabSwitching
  page_set = page_sets.FlashEnergyCasesPageSet
  options = {'pageset_repeat': 10}

  @classmethod
  def Name(cls):
    return 'tab_switching.flash_energy_cases'


@benchmark.Disabled
class TabSwitchingPluginPowerSaver(perf_benchmark.PerfBenchmark):
  test = tab_switching.TabSwitching
  page_set = page_sets.FlashEnergyCasesPageSet
  options = {'pageset_repeat': 10}

  def SetExtraBrowserOptions(self, options):
    options.AppendExtraBrowserArgs(['--enable-plugin-power-saver'])

  @classmethod
  def Name(cls):
    return 'tab_switching.plugin_power_saver'