Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Unified Diff: tools/perf/perf_tools/memory_benchmark.py

Issue 11273081: Adding a test for measuring memory usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/perf/perf_tools/memory_benchmark.py
diff --git a/tools/perf/perf_tools/memory_benchmark.py b/tools/perf/perf_tools/memory_benchmark.py
new file mode 100644
index 0000000000000000000000000000000000000000..5f0506a9dd4c8079d91b151f5b63d808ce779bfb
--- /dev/null
+++ b/tools/perf/perf_tools/memory_benchmark.py
@@ -0,0 +1,29 @@
+# Copyright (c) 2012 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 import multi_page_benchmark
+
+MEMORY_HISTOGRAMS = [
+ {'name': 'V8.MemoryExternalFragmentationTotal', 'units': 'percent'},
+ {'name': 'V8.MemoryHeapSampleTotalCommitted', 'units': 'kb'},
+ {'name': 'V8.MemoryHeapSampleTotalUsed', 'units': 'kb'}]
+
+class MemoryBenchmark(multi_page_benchmark.MultiPageBenchmark):
+ def __init__(self):
+ super(MemoryBenchmark, self).__init__()
+
+ def CustomizeBrowserOptions(self, options):
+ options.AppendExtraBrowserArg('--dom-automation')
+
+ def CanRunForPage(self, page):
+ return hasattr(page, 'stress_memory')
+
+ def MeasurePage(self, page, tab, results):
+ for histogram in MEMORY_HISTOGRAMS:
+ name = histogram['name']
+ data = tab.runtime.Evaluate(
+ 'window.domAutomationController.getHistogram("%s")' % name)
+ results.Add(name, histogram['units'], data, data_type='histogram')
+
+ def GetInteractionName(self):
nduca 2012/11/12 20:58:12 why not an init-time constructor? if it was init
marja 2012/11/12 21:35:26 Hmm? Init-time constructor of which class? Do you
marja 2012/11/13 09:47:40 Ok, made it a ctor parameter for PageTest. But we
+ return 'stress_memory'
« no previous file with comments | « no previous file | tools/telemetry/telemetry/browser_options.py » ('j') | tools/telemetry/telemetry/multi_page_benchmark.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698