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

Side by Side Diff: tools/deep_memory_profiler/visualizer/template.py

Issue 23933002: Fill json data in index.html template for dmprof visualizer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delete redundant file unit-test.html Created 7 years, 3 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
« no previous file with comments | « tools/deep_memory_profiler/visualizer/index.js ('k') | 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
(Empty)
1 #!/usr/bin/env python
2 #
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
5 # found in the LICENSE file.
6
7 import commands
8 import json
9 import sys
10 from string import Template
11
Dai Mikurube (NOT FULLTIME) 2013/09/04 04:06:40 nit: better to have two empty lines between top-le
junjianx 2013/09/04 06:55:37 Done.
12 _TEMPLATE = """
13 <!DOCTYPE html>
14 <meta charset="utf-8">
15 <link rel="stylesheet" href="index.css">
16 <link rel="stylesheet" href="third_party/jqTree/jqtree.css">
17
18 <script src="../../../third_party/flot/jquery.min.js"></script>
19 <script src="../../../third_party/flot/jquery.flot.min.js"></script>
20 <script src="../../../third_party/flot/jquery.flot.stack.min.js"></script>
21 <script src="third_party/jqTree/tree.jquery.js"></script>
22 <script src="utility.js"></script>
23 <script src="profiler.js"></script>
24 <script src="graph-view.js"></script>
25 <script src="dropdown-view.js"></script>
26 <script src="menu-view.js"></script>
27 <script type="text/javascript">
28 $(function() {
29 var data = $DATA;
30 var profiler = new Profiler(data);
31 var graphView = new GraphView(profiler);
32 var dropdownView = new DropdownView(profiler);
33 var menuView = new MenuView(profiler);
34
35 profiler.reparse();
36 });
37 </script>
38
39 <body>
40 <h2>Deep Memory Profiler Visulaizer</h2>
41 <div id="graph-div"></div>
42 <div id="info-div">
43 <div id="subs-dropdown"></div>
44 <div id="category-menu"></div>
45 </div>
46 </body>
47 """
48
49 def main(argv):
50 # Fill in the template of index.js.
51 data = json.dumps(json.load(file(argv[1], 'r')))
Dai Mikurube (NOT FULLTIME) 2013/09/04 04:06:40 Do we need to json.load() and then json.dumps()? J
junjianx 2013/09/04 06:55:37 Done.
52 html = open('index.html', 'w')
Dai Mikurube (NOT FULLTIME) 2013/09/04 04:06:40 1) Let's fix the directory to put the temporary ht
junjianx 2013/09/04 06:55:37 Done.
53 html.write(Template(_TEMPLATE).safe_substitute({ 'DATA': data }))
54 html.close()
55 # Open index page in chrome automatically if can.
56 if commands.getoutput('type google-chrome') != 'google-chrome not found':
Dai Mikurube (NOT FULLTIME) 2013/09/04 04:06:40 'type' works only for bash. Also, the user may not
junjianx 2013/09/04 06:55:37 Done.
57 commands.getstatusoutput('google-chrome index.html')
58
59 if __name__ == '__main__':
60 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « tools/deep_memory_profiler/visualizer/index.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698