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

Unified Diff: tools/perf/measurements/endure.py

Issue 23961002: Adding V8 and process memory information as metrics that endure tracks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased with update to v8 metric Created 7 years, 3 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/measurements/endure.py
diff --git a/tools/perf/measurements/endure.py b/tools/perf/measurements/endure.py
index 9cf4e75b482d1a2da1edaa5bdb64454b19d12d21..8d4fcf9734fae4610607b6161de38f3c3968633c 100644
--- a/tools/perf/measurements/endure.py
+++ b/tools/perf/measurements/endure.py
@@ -2,15 +2,40 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from metrics import v8_object_stats
from telemetry.page import page_measurement
import optparse
import time
+_V8_BYTES_COMMITED = [
+ 'V8.MemoryNewSpaceBytesCommitted',
+ 'V8.MemoryOldPointerSpaceBytesCommitted',
+ 'V8.MemoryOldDataSpaceBytesCommitted',
+ 'V8.MemoryCodeSpaceBytesCommitted',
+ 'V8.MemoryMapSpaceBytesCommitted',
+ 'V8.MemoryCellSpaceBytesCommitted',
+ 'V8.MemoryPropertyCellSpaceBytesCommitted',
+ 'V8.MemoryLoSpaceBytesCommitted'
+]
+_V8_BYTES_USED = [
+ 'V8.MemoryNewSpaceBytesUsed',
+ 'V8.MemoryOldPointerSpaceBytesUsed',
+ 'V8.MemoryOldDataSpaceBytesUsed',
+ 'V8.MemoryCodeSpaceBytesUsed',
+ 'V8.MemoryMapSpaceBytesUsed',
+ 'V8.MemoryCellSpaceBytesUsed',
+ 'V8.MemoryPropertyCellSpaceBytesUsed',
+ 'V8.MemoryLoSpaceBytesUsed'
+]
+_V8_MEMORY_ALLOCATED = [
+ 'V8.OsMemoryAllocated'
+]
class Endure(page_measurement.PageMeasurement):
def __init__(self):
super(Endure, self).__init__('endure')
+ self._browser = None
self._test_start_time = None
# Timestamp of the last memory retrieval.
@@ -25,6 +50,13 @@ class Endure(page_measurement.PageMeasurement):
help='Time interval between perf dumps (secs)')
parser.add_option_group(group)
+ def DidStartBrowser(self, browser):
+ # Save the browser for memory_stats.
+ self._browser = browser
+
+ def CustomizeBrowserOptions(self, options):
+ v8_object_stats.V8ObjectStatsMetric.CustomizeBrowserOptions(options)
+
def CanRunForPage(self, page):
return hasattr(page, 'endure')
@@ -44,19 +76,59 @@ class Endure(page_measurement.PageMeasurement):
elapsed_time = int(round(now - self._test_start_time))
# DOM Nodes
- dom_node_count = tab.dom_stats['node_count']
+ dom_stats = tab.dom_stats
+ dom_node_count = dom_stats['node_count']
self._SaveToResults(results, 'TotalDOMNodeCount_X',
'seconds', elapsed_time)
self._SaveToResults(results, 'TotalDOMNodeCount_Y',
'nodes', dom_node_count)
# Event Listeners
- event_listener_count = tab.dom_stats['event_listener_count']
+ event_listener_count = dom_stats['event_listener_count']
self._SaveToResults(results, 'EventListenerCount_X',
'seconds', elapsed_time)
self._SaveToResults(results, 'EventListenerCount_Y',
'listeners', event_listener_count)
+ # Memory stats
+ memory_stats = self._browser.memory_stats
+ browser_vm = memory_stats['Browser'].get('VM', 0) / 1024.0
+ self._SaveToResults(results, 'BrowserVirtualMemory_X',
+ 'seconds', elapsed_time)
+ self._SaveToResults(results, 'BrowserVirtualMemory_Y',
+ 'KB', browser_vm)
+ renderer_vm = memory_stats['Renderer'].get('VM', 0) / 1024.0
+ self._SaveToResults(results, 'RendererVirtualMemory_X',
+ 'seconds', elapsed_time)
+ self._SaveToResults(results, 'RendererVirtualMemory_Y',
+ 'KB', renderer_vm)
+
+ # V8 stats
+ v8_bytes_commited = v8_object_stats.V8ObjectStatsMetric.GetV8StatsTable(
+ tab, _V8_BYTES_COMMITED)
+ v8_bytes_commited = sum(v8_bytes_commited.values()) / 1024.0
+ self._SaveToResults(results, 'V8BytesCommited_X',
+ 'seconds', elapsed_time)
+ self._SaveToResults(results, 'V8BytesCommited_Y',
+ 'KB', v8_bytes_commited)
+
+ v8_bytes_used = v8_object_stats.V8ObjectStatsMetric.GetV8StatsTable(
+ tab, _V8_BYTES_USED)
+ print v8_bytes_used
+ v8_bytes_used = sum(v8_bytes_used.values()) / 1024.0
+ self._SaveToResults(results, 'V8BytesUsed_X',
+ 'seconds', elapsed_time)
+ self._SaveToResults(results, 'V8BytesUsed_Y',
+ 'KB', v8_bytes_used)
+
+ v8_mem_allocated = v8_object_stats.V8ObjectStatsMetric.GetV8StatsTable(
+ tab, _V8_MEMORY_ALLOCATED)
+ v8_mem_allocated = sum(v8_mem_allocated.values()) / 1024.0
+ self._SaveToResults(results, 'V8MemoryAllocated_X',
+ 'seconds', elapsed_time)
+ self._SaveToResults(results, 'V8MemoryAllocated_Y',
+ 'KB', v8_mem_allocated)
+
def _SaveToResults(self, results, trace_name, units, value,
chart_name=None, data_type='default'):
results.Add(trace_name, units, value, chart_name, data_type)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698