[Session restore] Rename group name Enabled to Restore.
[chromium-blink-merge.git] / tools / perf / measurements / memory.py
blob198871e87af0e488359e8828408c342d5bce9719
1 # Copyright 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 from telemetry.page import page_test
7 from metrics import memory
8 from metrics import power
11 class Memory(page_test.PageTest):
12 def __init__(self):
13 super(Memory, self).__init__()
14 self._memory_metric = None
15 self._power_metric = None
17 def WillStartBrowser(self, platform):
18 self._power_metric = power.PowerMetric(platform)
20 def DidStartBrowser(self, browser):
21 self._memory_metric = memory.MemoryMetric(browser)
23 def DidNavigateToPage(self, page, tab):
24 self._memory_metric.Start(page, tab)
25 self._power_metric.Start(page, tab)
27 def CleanUpAfterPage(self, page, tab):
28 tab.CollectGarbage()
30 def CustomizeBrowserOptions(self, options):
31 memory.MemoryMetric.CustomizeBrowserOptions(options)
32 # Since this is a memory benchmark, we want to sample memory histograms at
33 # a high frequency.
34 options.AppendExtraBrowserArgs('--memory-metrics')
36 def ValidateAndMeasurePage(self, page, tab, results):
37 self._power_metric.Stop(page, tab)
38 self._memory_metric.Stop(page, tab)
39 self._memory_metric.AddResults(tab, results)
40 self._power_metric.AddResults(tab, results)