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

Unified Diff: tools/perf/metrics/v8_object_stats.py

Issue 23963002: Update V8ObjectStatsMetric to work as a standalone metric (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding rmcilroy TODO for --no-sandbox option 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/metrics/v8_object_stats.py
diff --git a/tools/perf/metrics/v8_object_stats.py b/tools/perf/metrics/v8_object_stats.py
index 79b0fad92e0d8f57e7d6c9ceb456fc1465b9fdef..c5140654761f221e6c50cfbc54b6d09e1c1abc93 100644
--- a/tools/perf/metrics/v8_object_stats.py
+++ b/tools/perf/metrics/v8_object_stats.py
@@ -32,7 +32,7 @@ _COUNTER_NAMES = [
'V8.MemoryPropertyCellSpaceBytesUsed',
'V8.MemoryLoSpaceBytesAvailable',
'V8.MemoryLoSpaceBytesCommitted',
- 'V8.MemoryLoSpaceBytesUsed)',
+ 'V8.MemoryLoSpaceBytesUsed',
'V8.SizeOf_ACCESSOR_PAIR_TYPE',
'V8.SizeOf_ACCESS_CHECK_INFO_TYPE',
'V8.SizeOf_ALIASED_ARGUMENTS_ENTRY_TYPE',
@@ -164,6 +164,26 @@ class V8ObjectStatsMetric(Metric):
options.AppendExtraBrowserArg('--enable-benchmarking')
options.AppendExtraBrowserArg(
'--js-flags=--track_gc_object_stats --expose_gc')
+ # TODO(rmcilroy): This is needed for --enable-stats-table. Update once
+ # https://codereview.chromium.org/22911027/ lands.
+ options.AppendExtraBrowserArg('--no-sandbox')
+
+ @staticmethod
+ def GetV8StatsTable(tab, counters=None):
+ counters = counters or _COUNTER_NAMES
+
+ return tab.EvaluateJavaScript("""
+ (function(counters) {
+ var results = {};
+ if (!window.chrome || !window.chrome.benchmarking)
+ return results;
+ window.gc(); // Trigger GC to ensure stats are checkpointed.
+ for (var i = 0; i < counters.length; i++)
+ results[counters[i]] =
+ chrome.benchmarking.counterForRenderer(counters[i]);
+ return results;
+ })(%s);
+ """ % json.dumps(counters))
def Start(self, page, tab):
"""Do Nothing."""
@@ -171,17 +191,7 @@ class V8ObjectStatsMetric(Metric):
def Stop(self, page, tab):
"""Get the values in the stats table after the page is loaded."""
- self._results = tab.EvaluateJavaScript("""
- (function(counters) {
- var results = {};
- if (!window.chrome || !window.chrome.benchmarking)
- return results;
- window.gc(); // Trigger GC to ensure stats are checkpointed.
- for (var i = 0; i < counters.length; i++)
- results[counters[i]] = chrome.benchmarking.counterForRenderer(counters[i]);
- return results;
- })(%s);
- """ % json.dumps(_COUNTER_NAMES))
+ self._results = V8ObjectStatsMetric.GetV8StatsTable(tab)
if not self._results:
logging.warning('No V8 object stats from website: ' + page.display_url)
« 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