[pypy-commit] jitviewer default: use new features to be able to display assembler, disabled by default

fijal noreply at buildbot.pypy.org
Fri Jul 8 15:22:23 CEST 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r138:9156677f07b3
Date: 2011-07-08 15:31 +0200
http://bitbucket.org/pypy/jitviewer/changeset/9156677f07b3/

Log:	use new features to be able to display assembler, disabled by
	default

diff --git a/_jitviewer/static/script.js b/_jitviewer/static/script.js
--- a/_jitviewer/static/script.js
+++ b/_jitviewer/static/script.js
@@ -18,6 +18,7 @@
             var elem = arg.callstack[index];
             $('#callstack').append('<div><a href="/" onClick="show_loop(' + no + ', \'' + elem[0] + '\'); return false">' + elem[1] + "</a></div>");
         }
+        $(".asm").hide();
     });
 }
 
@@ -57,9 +58,17 @@
     });
 }
 
-function toggle()
+function toggle(name, clsname, v)
 {
-    $('.operations').toggle();
+    var e = $("#" + name);
+    var e2 = $("." + clsname);
+    if (e.html().search("Show") != -1) {
+        e.html("Hide " + v);
+        e2.show();
+    } else {
+        e.html("Show " + v);
+        e2.hide();
+    }
 }
 
 function highlight_var(elem)
diff --git a/_jitviewer/static/style.css b/_jitviewer/static/style.css
--- a/_jitviewer/static/style.css
+++ b/_jitviewer/static/style.css
@@ -141,6 +141,12 @@
     margin-left: 3em;
 }
 
+.asm {
+    white-space: pre;
+    margin-left: 4em;
+    color: #bbb;
+}
+
 .inlined_call {
     font-size: 12px;
     font-weight: bold;
diff --git a/_jitviewer/templates/index.html b/_jitviewer/templates/index.html
--- a/_jitviewer/templates/index.html
+++ b/_jitviewer/templates/index.html
@@ -17,7 +17,8 @@
 <body>
   <header>
     <span>Menu</span><br/>
-    <a href="/" onClick="toggle(); return false">Toggle operations</a>
+    <a id="optoggler" href="/" onClick="toggle('optoggler', 'operations', 'operations'); return false">Hide operations</a><br/>
+    <a id="asmtoggler" href="/" onClick="toggle('asmtoggler', 'asm', 'assembler'); return false">Show assembler</a>
     <div id="callstack">
     </div>
   </header>
diff --git a/_jitviewer/templates/loop.html b/_jitviewer/templates/loop.html
--- a/_jitviewer/templates/loop.html
+++ b/_jitviewer/templates/loop.html
@@ -15,6 +15,9 @@
                         <span id="loop-{{op.bridge.no}}" class="guard single-operation">{{op.html_repr()}}</span> <a href="/" onClick="replace_from(this, {{op.bridge.no}}); return false">&gt;&gt;show bridge</a> (taken {{op.percentage}}%)<br/>
                       {% else %}
                         <span class="single-operation">{{op.html_repr()}}</span><br/>
+                        {% if op.asm %}
+                            <p class="asm">{{op.asm}}</p>
+                        {% endif %}
                       {% endif %}
                    {% endfor %}
                  {% else %}
diff --git a/bin/jitviewer.py b/bin/jitviewer.py
--- a/bin/jitviewer.py
+++ b/bin/jitviewer.py
@@ -43,7 +43,7 @@
 import time
 from pypy.tool.logparser import parse_log_file, extract_category
 from pypy.tool.jitlogparser.storage import LoopStorage
-from pypy.tool.jitlogparser.parser import adjust_bridges
+from pypy.tool.jitlogparser.parser import adjust_bridges, import_log
 #
 from _jitviewer.parser import ParserWithHtmlRepr, FunctionHtml, parse_log_counts
 from _jitviewer.display import CodeRepr, CodeReprNoFile
@@ -180,15 +180,13 @@
         print __doc__
         sys.exit(1)
     filename = sys.argv[1]
-    log = parse_log_file(filename)
     extra_path = os.path.dirname(filename)
     if len(sys.argv) != 3:
         port = 5000
     else:
         port = int(sys.argv[2])
     storage = CheckingLoopStorage(extra_path)
-    loops = [ParserWithHtmlRepr.parse_from_input(l)
-             for l in extract_category(log, "jit-log-opt-")]
+    log, loops = import_log(filename, ParserWithHtmlRepr)
     parse_log_counts(extract_category(log, 'jit-backend-count'), loops)
     storage.reconnect_loops(loops)
     app = OverrideFlask('__name__', root_path=PATH)


More information about the pypy-commit mailing list