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

Unified Diff: chrome/test/functional/perf_endure.py

Issue 11368097: Apply other policies of Deep Memory Profiler in Chrome Endure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed Created 8 years, 1 month 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: chrome/test/functional/perf_endure.py
diff --git a/chrome/test/functional/perf_endure.py b/chrome/test/functional/perf_endure.py
index e0a1cd6f00da79dc96d95065dffe6ad929d551b9..03cd22e3454802ba1aa9889af27e4bf4202b4d2e 100755
--- a/chrome/test/functional/perf_endure.py
+++ b/chrome/test/functional/perf_endure.py
@@ -54,6 +54,7 @@ class DeepMemoryProfiler(object):
os.path.dirname(__file__), os.pardir, os.pardir, os.pardir,
'tools', 'deep_memory_profiler')
_DMPROF_SCRIPT_PATH = os.path.join(_DMPROF_DIR_PATH, 'dmprof')
+ _POLICIES = ['l0', 'l1', 'l2', 't0']
def __init__(self):
self._enabled = self.GetEnvironmentVariable(
@@ -63,7 +64,9 @@ class DeepMemoryProfiler(object):
self._json_file = None
self._last_json_filename = ''
self._proc = None
- self._last_time = -1.0
+ self._last_time = {}
+ for policy in self._POLICIES:
+ self._last_time[policy] = -1.0
def __nonzero__(self):
return self._enabled
@@ -179,31 +182,34 @@ class DeepMemoryProfiler(object):
return
results = {}
- if self._last_json_filename:
- json_data = {}
- with open(self._last_json_filename) as json_f:
- json_data = json.load(json_f)
- if json_data['version'] == 'JSON_DEEP_1':
- results = json_data['snapshots']
- elif json_data['version'] == 'JSON_DEEP_2':
- results = json_data['policies']['l2']['snapshots']
- if results and results[-1]['second'] > self._last_time:
- started = False
- for legend in json_data['policies']['l2']['legends']:
- if legend == 'FROM_HERE_FOR_TOTAL':
- started = True
- elif legend == 'UNTIL_HERE_FOR_TOTAL':
- break
- elif started:
- output_perf_graph_value(
- legend.encode('utf-8'), [
- (int(round(snapshot['second'])), snapshot[legend] / 1024)
- for snapshot in results
- if snapshot['second'] > self._last_time],
- 'KB',
- graph_name='%s%s-DMP' % (webapp_name, test_description),
- units_x='seconds', is_stacked=True)
- self._last_time = results[-1]['second']
+ for policy in self._POLICIES:
+ if self._last_json_filename:
+ json_data = {}
+ with open(self._last_json_filename) as json_f:
+ json_data = json.load(json_f)
+ if json_data['version'] == 'JSON_DEEP_1':
+ results[policy] = json_data['snapshots']
+ elif json_data['version'] == 'JSON_DEEP_2':
+ results[policy] = json_data['policies'][policy]['snapshots']
+ for policy, result in results.iteritems():
+ if result and result[-1]['second'] > self._last_time[policy]:
+ started = False
+ for legend in json_data['policies'][policy]['legends']:
+ if legend == 'FROM_HERE_FOR_TOTAL':
+ started = True
+ elif legend == 'UNTIL_HERE_FOR_TOTAL':
+ break
+ elif started:
+ output_perf_graph_value(
+ legend.encode('utf-8'), [
+ (int(round(snapshot['second'])), snapshot[legend] / 1024)
+ for snapshot in result
+ if snapshot['second'] > self._last_time[policy]],
+ 'KB',
+ graph_name='%s%s-%s-DMP' % (
+ webapp_name, test_description, policy),
+ units_x='seconds', is_stacked=True)
+ self._last_time[policy] = result[-1]['second']
def _WaitForDeepMemoryProfiler(self):
"""Waits for the Deep Memory Profiler to finish if running."""
« 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