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
):
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
):
30 def CustomizeBrowserOptions(self
, options
):
31 memory
.MemoryMetric
.CustomizeBrowserOptions(options
)
32 # Since this is a memory benchmark, we want to sample memory histograms at
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
)