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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/deep_memory_profiler/visualizer/index.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/deep_memory_profiler/visualizer/template.py
diff --git a/tools/deep_memory_profiler/visualizer/template.py b/tools/deep_memory_profiler/visualizer/template.py
new file mode 100755
index 0000000000000000000000000000000000000000..790adbd3fa20eaa773c1a87ab17c0c5380523234
--- /dev/null
+++ b/tools/deep_memory_profiler/visualizer/template.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import commands
+import json
+import sys
+from string import Template
+
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.
+_TEMPLATE = """
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="stylesheet" href="index.css">
+<link rel="stylesheet" href="third_party/jqTree/jqtree.css">
+
+<script src="../../../third_party/flot/jquery.min.js"></script>
+<script src="../../../third_party/flot/jquery.flot.min.js"></script>
+<script src="../../../third_party/flot/jquery.flot.stack.min.js"></script>
+<script src="third_party/jqTree/tree.jquery.js"></script>
+<script src="utility.js"></script>
+<script src="profiler.js"></script>
+<script src="graph-view.js"></script>
+<script src="dropdown-view.js"></script>
+<script src="menu-view.js"></script>
+<script type="text/javascript">
+ $(function() {
+ var data = $DATA;
+ var profiler = new Profiler(data);
+ var graphView = new GraphView(profiler);
+ var dropdownView = new DropdownView(profiler);
+ var menuView = new MenuView(profiler);
+
+ profiler.reparse();
+});
+</script>
+
+<body>
+ <h2>Deep Memory Profiler Visulaizer</h2>
+ <div id="graph-div"></div>
+ <div id="info-div">
+ <div id="subs-dropdown"></div>
+ <div id="category-menu"></div>
+ </div>
+</body>
+"""
+
+def main(argv):
+ # Fill in the template of index.js.
+ 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.
+ 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.
+ html.write(Template(_TEMPLATE).safe_substitute({ 'DATA': data }))
+ html.close()
+ # Open index page in chrome automatically if can.
+ 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.
+ commands.getstatusoutput('google-chrome index.html')
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
« 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