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

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

Issue 809393002: Added support for improvement_direction to relevant values, which is propogated to chartjson. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix linter issues Created 5 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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 from metrics import memory 5 from metrics import memory
6 from metrics import Metric 6 from metrics import Metric
7 from telemetry.value import improvement_direction
7 from telemetry.value import scalar 8 from telemetry.value import scalar
8 9
9 10
10 class SystemMemoryMetric(Metric): 11 class SystemMemoryMetric(Metric):
11 """SystemMemoryMetric gathers system memory statistic. 12 """SystemMemoryMetric gathers system memory statistic.
12 13
13 This metric collects system memory stats per test. It reports the difference 14 This metric collects system memory stats per test. It reports the difference
14 (delta) in system memory starts from the start of the test to the end of it. 15 (delta) in system memory starts from the start of the test to the end of it.
15 """ 16 """
16 17
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 return 58 return
58 exclude_metrics = exclude_metrics or {} 59 exclude_metrics = exclude_metrics or {}
59 memory.AddResultsForProcesses(results, memory_stats, 60 memory.AddResultsForProcesses(results, memory_stats,
60 metric_trace_name=trace_name, chart_trace_name='delta', 61 metric_trace_name=trace_name, chart_trace_name='delta',
61 exclude_metrics=exclude_metrics) 62 exclude_metrics=exclude_metrics)
62 63
63 if 'SystemCommitCharge' not in exclude_metrics: 64 if 'SystemCommitCharge' not in exclude_metrics:
64 results.AddValue(scalar.ScalarValue( 65 results.AddValue(scalar.ScalarValue(
65 results.current_page, 66 results.current_page,
66 'commit_charge_delta.%s' % (trace_name or 'commit_charge'), 'kb', 67 'commit_charge_delta.%s' % (trace_name or 'commit_charge'), 'kb',
67 memory_stats['SystemCommitCharge'], important=False)) 68 memory_stats['SystemCommitCharge'], important=False,
69 improvement_direction=improvement_direction.DOWN))
68 70
69 if 'ProcessCount' not in exclude_metrics: 71 if 'ProcessCount' not in exclude_metrics:
70 results.AddValue(scalar.ScalarValue( 72 results.AddValue(scalar.ScalarValue(
71 results.current_page, 73 results.current_page,
72 'processes_delta.%s' % (trace_name or 'processes'), 'count', 74 'processes_delta.%s' % (trace_name or 'processes'), 'count',
73 memory_stats['ProcessCount'], important=False)) 75 memory_stats['ProcessCount'], important=False,
76 improvement_direction=improvement_direction.DOWN))
74 77
75 78
76 def _SubtractMemoryStats(end_memory_stats, start_memory_stats): 79 def _SubtractMemoryStats(end_memory_stats, start_memory_stats):
77 """Computes the difference in memory usage stats. 80 """Computes the difference in memory usage stats.
78 81
79 Each of the two stats arguments is a dict with the following format: 82 Each of the two stats arguments is a dict with the following format:
80 {'Browser': {metric: value, ...}, 83 {'Browser': {metric: value, ...},
81 'Renderer': {metric: value, ...}, 84 'Renderer': {metric: value, ...},
82 'Gpu': {metric: value, ...}, 85 'Gpu': {metric: value, ...},
83 'ProcessCount': value, 86 'ProcessCount': value,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 memory_stats[process_type] = end_process_memory - start_value 118 memory_stats[process_type] = end_process_memory - start_value
116 else: 119 else:
117 for metric in end_process_memory: 120 for metric in end_process_memory:
118 end_value = end_process_memory[metric] 121 end_value = end_process_memory[metric]
119 start_value = start_memory_stats[process_type][metric] or 0 122 start_value = start_memory_stats[process_type][metric] or 0
120 if 'Peak' in metric: 123 if 'Peak' in metric:
121 memory_stats[process_type][metric] = end_value 124 memory_stats[process_type][metric] = end_value
122 else: 125 else:
123 memory_stats[process_type][metric] = end_value - start_value 126 memory_stats[process_type][metric] = end_value - start_value
124 return memory_stats 127 return memory_stats
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698