Commit f0c8bb74 authored by tonyg@chromium.org's avatar tonyg@chromium.org

[Telemetry] Allow page cycler to run on devices that don't report CommitCharge.

BUG=400734

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287756 0039d316-1c4b-4281-b951-d872f2087c98
parent eae6aa4e
...@@ -59,7 +59,10 @@ class MemoryMetric(Metric): ...@@ -59,7 +59,10 @@ class MemoryMetric(Metric):
def __init__(self, browser): def __init__(self, browser):
super(MemoryMetric, self).__init__() super(MemoryMetric, self).__init__()
self._browser = browser self._browser = browser
self._start_commit_charge = self._browser.memory_stats['SystemCommitCharge'] start_memory_stats = self._browser.memory_stats
self._start_commit_charge = None
if 'SystemCommitCharge' in start_memory_stats:
self._start_commit_charge = start_memory_stats['SystemCommitCharge']
self._memory_stats = None self._memory_stats = None
self._histogram_start = dict() self._histogram_start = dict()
self._histogram_delta = dict() self._histogram_delta = dict()
...@@ -125,13 +128,14 @@ class MemoryMetric(Metric): ...@@ -125,13 +128,14 @@ class MemoryMetric(Metric):
AddResultsForProcesses(results, self._memory_stats, AddResultsForProcesses(results, self._memory_stats,
metric_trace_name=trace_name) metric_trace_name=trace_name)
end_commit_charge = self._memory_stats['SystemCommitCharge'] if self._start_commit_charge:
commit_charge_difference = end_commit_charge - self._start_commit_charge end_commit_charge = self._memory_stats['SystemCommitCharge']
results.AddValue(scalar.ScalarValue( commit_charge_difference = end_commit_charge - self._start_commit_charge
results.current_page, results.AddValue(scalar.ScalarValue(
'commit_charge.' + (trace_name or 'commit_charge'), results.current_page,
'kb', commit_charge_difference, important=False, 'commit_charge.' + (trace_name or 'commit_charge'),
description='System commit charge (committed memory pages).')) 'kb', commit_charge_difference, important=False,
description='System commit charge (committed memory pages).'))
results.AddValue(scalar.ScalarValue( results.AddValue(scalar.ScalarValue(
results.current_page, 'processes.' + (trace_name or 'processes'), results.current_page, 'processes.' + (trace_name or 'processes'),
'count', self._memory_stats['ProcessCount'], important=False, 'count', self._memory_stats['ProcessCount'], important=False,
......
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