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

Side by Side Diff: tools/deep_memory_profiler/graph.py

Issue 299443007: dmprof: Bug fix: The label 'Timestamp' should be on the horizontal axis (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 import json 7 import json
8 import sys 8 import sys
9 from string import Template 9 from string import Template
10 10
11 11
12 _HTML_TEMPLATE = """<!DOCTYPE html> 12 _HTML_TEMPLATE = """<!DOCTYPE html>
13 <script src="https://www.google.com/jsapi"></script> 13 <script src="https://www.google.com/jsapi"></script>
14 <script> 14 <script>
15 var all_data = $ALL_DATA; 15 var all_data = $ALL_DATA;
16 google.load('visualization', '1', {packages:['corechart', 'table']}); 16 google.load('visualization', '1', {packages:['corechart', 'table']});
17 google.setOnLoadCallback(drawVisualization); 17 google.setOnLoadCallback(drawVisualization);
18 function drawVisualization() { 18 function drawVisualization() {
19 // Apply policy 'l2' by default. 19 // Apply policy 'l2' by default.
20 var default_policy = 'l2'; 20 var default_policy = 'l2';
21 document.getElementById(default_policy).style.fontWeight = 'bold'; 21 document.getElementById(default_policy).style.fontWeight = 'bold';
22 turnOn(default_policy); 22 turnOn(default_policy);
23 } 23 }
24 24
25 function turnOn(policy) { 25 function turnOn(policy) {
26 var data = google.visualization.arrayToDataTable(all_data[policy]); 26 var data = google.visualization.arrayToDataTable(all_data[policy]);
27 var charOptions = { 27 var charOptions = {
28 title: 'DMP Graph (Policy: ' + policy + ')', 28 title: 'DMP Graph (Policy: ' + policy + ')',
29 vAxis: {title: 'Timestamp', titleTextStyle: {color: 'red'}}, 29 hAxis: {title: 'Timestamp', titleTextStyle: {color: 'red'}},
30 isStacked : true 30 isStacked : true
31 }; 31 };
32 var chart = new google.visualization.AreaChart( 32 var chart = new google.visualization.AreaChart(
33 document.getElementById('chart_div')); 33 document.getElementById('chart_div'));
34 chart.draw(data, charOptions); 34 chart.draw(data, charOptions);
35 var table = new google.visualization.Table( 35 var table = new google.visualization.Table(
36 document.getElementById('table_div')); 36 document.getElementById('table_div'));
37 table.draw(data); 37 table.draw(data);
38 } 38 }
39 39
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 {'POLICIES': policies, 85 {'POLICIES': policies,
86 'ALL_DATA': json.dumps(all_data)}) 86 'ALL_DATA': json.dumps(all_data)})
87 87
88 88
89 def main(argv): 89 def main(argv):
90 _GenerateGraph(json.load(file(argv[1], 'r'))) 90 _GenerateGraph(json.load(file(argv[1], 'r')))
91 91
92 92
93 if __name__ == '__main__': 93 if __name__ == '__main__':
94 sys.exit(main(sys.argv)) 94 sys.exit(main(sys.argv))
OLDNEW
« 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