Commits

Maciej Fijalkowski  committed 9156677

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

  • Participants
  • Parent commits 5af6019

Comments (0)

Files changed (5)

File _jitviewer/static/script.js

             var elem = arg.callstack[index];
             $('#callstack').append('<div><a href="/" onClick="show_loop(' + no + ', \'' + elem[0] + '\'); return false">' + elem[1] + "</a></div>");
         }
+        $(".asm").hide();
     });
 }
 
     });
 }
 
-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)

File _jitviewer/static/style.css

     margin-left: 3em;
 }
 
+.asm {
+    white-space: pre;
+    margin-left: 4em;
+    color: #bbb;
+}
+
 .inlined_call {
     font-size: 12px;
     font-weight: bold;

File _jitviewer/templates/index.html

 <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>

File _jitviewer/templates/loop.html

                         <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 %}

File bin/jitviewer.py

 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
         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)