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

Side by Side Diff: tools/perf/metrics/memory.py

Issue 116043006: [Telemetry]: Assert that page measurement results don't contain a '.' in their name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 6 years, 11 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 unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import sys 5 import sys
6 6
7 from metrics import histogram_util 7 from metrics import histogram_util
8 from metrics import Metric 8 from metrics import Metric
9 9
10 _HISTOGRAMS = [ 10 _HISTOGRAMS = [
11 {'name': 'V8.MemoryExternalFragmentationTotal', 'units': 'percent', 11 {'name': 'V8.MemoryExternalFragmentationTotal', 'units': 'percent',
12 'display_name': 'V8_MemoryExternalFragmentationTotal',
12 'type': histogram_util.RENDERER_HISTOGRAM}, 13 'type': histogram_util.RENDERER_HISTOGRAM},
13 {'name': 'V8.MemoryHeapSampleTotalCommitted', 'units': 'kb', 14 {'name': 'V8.MemoryHeapSampleTotalCommitted', 'units': 'kb',
15 'display_name': 'V8_MemoryHeapSampleTotalCommitted',
14 'type': histogram_util.RENDERER_HISTOGRAM}, 16 'type': histogram_util.RENDERER_HISTOGRAM},
15 {'name': 'V8.MemoryHeapSampleTotalUsed', 'units': 'kb', 17 {'name': 'V8.MemoryHeapSampleTotalUsed', 'units': 'kb',
18 'display_name': 'V8_MemoryHeapSampleTotalUsed',
16 'type': histogram_util.RENDERER_HISTOGRAM}, 19 'type': histogram_util.RENDERER_HISTOGRAM},
17 {'name': 'V8.MemoryHeapSampleMaximumCommitted', 'units': 'kb', 20 {'name': 'V8.MemoryHeapSampleMaximumCommitted', 'units': 'kb',
21 'display_name': 'V8_MemoryHeapSampleMaximumCommitted',
18 'type': histogram_util.RENDERER_HISTOGRAM}, 22 'type': histogram_util.RENDERER_HISTOGRAM},
19 {'name': 'Memory.RendererUsed', 'units': 'kb', 23 {'name': 'Memory.RendererUsed', 'units': 'kb',
24 'display_name': 'Memory_RendererUsed',
20 'type': histogram_util.RENDERER_HISTOGRAM}, 25 'type': histogram_util.RENDERER_HISTOGRAM},
21 {'name': 'Memory.BrowserUsed', 'units': 'kb', 26 {'name': 'Memory.BrowserUsed', 'units': 'kb',
27 'display_name': 'Memory_BrowserUsed',
22 'type': histogram_util.BROWSER_HISTOGRAM}] 28 'type': histogram_util.BROWSER_HISTOGRAM}]
23 29
24 class MemoryMetric(Metric): 30 class MemoryMetric(Metric):
25 """MemoryMetric gathers memory statistics from the browser object. 31 """MemoryMetric gathers memory statistics from the browser object.
26 32
27 This includes both per-page histogram stats, most about javascript 33 This includes both per-page histogram stats, most about javascript
28 memory usage, and overall memory stats from the system for the whole 34 memory usage, and overall memory stats from the system for the whole
29 test run.""" 35 test run."""
30 36
31 def __init__(self, browser): 37 def __init__(self, browser):
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 86
81 # Optional argument trace_name is not in base class Metric. 87 # Optional argument trace_name is not in base class Metric.
82 # pylint: disable=W0221 88 # pylint: disable=W0221
83 def AddResults(self, tab, results, trace_name=None): 89 def AddResults(self, tab, results, trace_name=None):
84 """Add results for this page to the results object.""" 90 """Add results for this page to the results object."""
85 assert self._histogram_delta, 'Must call Stop() first' 91 assert self._histogram_delta, 'Must call Stop() first'
86 for h in _HISTOGRAMS: 92 for h in _HISTOGRAMS:
87 # Histogram data may not be available 93 # Histogram data may not be available
88 if h['name'] not in self._histogram_start: 94 if h['name'] not in self._histogram_start:
89 continue 95 continue
90 results.Add(h['name'], h['units'], self._histogram_delta[h['name']], 96 results.Add(h['display_name'], h['units'],
97 self._histogram_delta[h['name']],
91 data_type='unimportant-histogram') 98 data_type='unimportant-histogram')
92 self._memory_stats = self._browser.memory_stats 99 self._memory_stats = self._browser.memory_stats
93 if not self._memory_stats['Browser']: 100 if not self._memory_stats['Browser']:
94 return 101 return
95 102
96 metric = 'resident_set_size' 103 metric = 'resident_set_size'
97 if sys.platform == 'win32': 104 if sys.platform == 'win32':
98 metric = 'working_set' 105 metric = 'working_set'
99 106
100 def AddResultsForProcessTypes(process_types_memory, process_type_trace): 107 def AddResultsForProcessTypes(process_types_memory, process_type_trace):
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 end_commit_charge = self._memory_stats['SystemCommitCharge'] 151 end_commit_charge = self._memory_stats['SystemCommitCharge']
145 commit_charge_difference = end_commit_charge - self._start_commit_charge 152 commit_charge_difference = end_commit_charge - self._start_commit_charge
146 results.Add(trace_name or 'commit_charge', 'kb', 153 results.Add(trace_name or 'commit_charge', 'kb',
147 commit_charge_difference, 154 commit_charge_difference,
148 chart_name='commit_charge', 155 chart_name='commit_charge',
149 data_type='unimportant') 156 data_type='unimportant')
150 results.Add(trace_name or 'processes', 'count', 157 results.Add(trace_name or 'processes', 'count',
151 self._memory_stats['ProcessCount'], 158 self._memory_stats['ProcessCount'],
152 chart_name='processes', 159 chart_name='processes',
153 data_type='unimportant') 160 data_type='unimportant')
OLDNEW
« no previous file with comments | « tools/perf/measurements/tab_switching.py ('k') | tools/telemetry/telemetry/page/page_measurement_results.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698