Commit 8e74bddb authored by cmumford@chromium.org's avatar cmumford@chromium.org

Allowing V8ObjectStatsMetric users to specify metrics to capture.

V8ObjectStatsMetric would previously capture all V8 statistics.
Added a constructor parameter so that users could capture a subset
of the V8 statistics if desired. Default is as before: capture them
all.

Making this change so that the IndexedDB perf tests (indexeddb_perf)
can be modified to report only a few metrics to simplify the test
results.

Review URL: https://codereview.chromium.org/99903009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243394 0039d316-1c4b-4281-b951-d872f2087c98
parent 331e4dba
...@@ -162,9 +162,10 @@ class V8ObjectStatsMetric(Metric): ...@@ -162,9 +162,10 @@ class V8ObjectStatsMetric(Metric):
these statistics from the StatsTableMetric. these statistics from the StatsTableMetric.
""" """
def __init__(self): def __init__(self, counters=None):
super(V8ObjectStatsMetric, self).__init__() super(V8ObjectStatsMetric, self).__init__()
self._results = None self._results = None
self._counters = counters or _COUNTER_NAMES
@classmethod @classmethod
def CustomizeBrowserOptions(cls, options): def CustomizeBrowserOptions(cls, options):
...@@ -178,8 +179,7 @@ class V8ObjectStatsMetric(Metric): ...@@ -178,8 +179,7 @@ class V8ObjectStatsMetric(Metric):
]) ])
@staticmethod @staticmethod
def GetV8StatsTable(tab, counters=None): def GetV8StatsTable(tab, counters):
counters = counters or _COUNTER_NAMES
return tab.EvaluateJavaScript(""" return tab.EvaluateJavaScript("""
(function(counters) { (function(counters) {
...@@ -204,7 +204,7 @@ class V8ObjectStatsMetric(Metric): ...@@ -204,7 +204,7 @@ class V8ObjectStatsMetric(Metric):
def Stop(self, page, tab): def Stop(self, page, tab):
"""Get the values in the stats table after the page is loaded.""" """Get the values in the stats table after the page is loaded."""
self._results = V8ObjectStatsMetric.GetV8StatsTable(tab) self._results = V8ObjectStatsMetric.GetV8StatsTable(tab, self._counters)
if not self._results: if not self._results:
logging.warning('No V8 object stats from website: ' + page.display_name) logging.warning('No V8 object stats from website: ' + page.display_name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment