Commits

Konstantin Lopuhin  committed 1a6b391 Merge

Merged pypy/jitviewer into default

  • Participants
  • Parent commits 0f572e6, 9c39467

Comments (0)

Files changed (7)

 
 On Mac OSX you will also need to install binutils, to make objdump available.
 
-To create a virtualenv:
+To create a virtualenv (note that mkvirtualenv only accepts absolute paths):
 
     mkvirtualenv --python=/path/to/pypy pypy-viewer
 
 Now install the dependencies:
 
-    pip install flask pygments simplejson
+    pip install -r requirements.txt
 
 or
 

File _jitviewer/app.py

 import inspect
 import threading
 import time
-from pypy.tool.logparser import extract_category
+try:
+    from rpython.tool.logparser import extract_category
+except ImportError:
+    from pypy.tool.logparser import extract_category
 from pypy.tool.jitlogparser.storage import LoopStorage
 from pypy.tool.jitlogparser.parser import adjust_bridges, import_log,\
      parse_log_counts, parse_statprof_log
                                                       loop.startlineno)))
                 loop = loop.chunks[int(e)]
                 path_so_far.append(e)
-        callstack.append((','.join(path_so_far), '%s in %s at %d' % (loop.name,
+        callstack.append((','.join(path_so_far), '%s in %s:%d' % (loop.name,
                                         loop.filename, loop.startlineno)))
 
         if not loop.has_valid_code() or loop.filename is None:

File _jitviewer/display.py

             else:
                 no = last_lineno
             self.lines[no - self.firstlineno].chunks.append(chunk)
-    
-        
-

File _jitviewer/parser.py

File contents unchanged.

File _jitviewer/static/script.js

 
 var glob_bridge_state = {
     'asm': false,
+    'bytecodepos': false,
     'op': true,
 };
 
         if (!glob_bridge_state.asm) {
             $(".asm").hide();
         }
+        if (!glob_bridge_state.bytecodepos) {
+            $(".bytecodepos").hide();
+        }
     });
 }
 
             if (!glob_bridge_state.asm) {
                 $(".asm").hide();
             }
+            if (!glob_bridge_state.bytecodepos) {
+                $(".bytecodepos").hide();
+            }
             $.scrollTo($("#loop-" + bridge_id), {axis:'y'});
         });
     });
     }
 }
 
+function bytecodepos_toggle()
+{
+    var e = $("#bytecodepos_toggler");
+    var e2 = $(".bytecodepos");
+    if (e.html().search("Show") != -1) {
+        glob_bridge_state.bytecodepos = true;
+        e.html("Hide bytecode position");
+        e2.show();
+    } else {
+        glob_bridge_state.bytecodepos = false;
+        e.html("Show bytecode position");
+        e2.hide();
+    }
+}
+
 function highlight_var(elem)
 {
     $('.' + elem.className).addClass("variable_highlight");

File _jitviewer/templates/index.html

 <body>
   <header>
     <span>Menu</span><br/>
-    <a id="asmtoggler" href="/" onClick="asmtoggle(); return false">Show assembler</a>
+    <a id="asmtoggler" href="/" onClick="asmtoggle(); return false">Show assembler</a><br>
+    <a id="bytecodepos_toggler" href="/" onClick="bytecodepos_toggle(); return false">Show bytecode position</a>
     <div id="callstack">
     </div>
   </header>

File _jitviewer/templates/loop.html

           <div class="operations">
               {% for chunk in sourceline.chunks %}
                  {% if chunk.is_bytecode %}
-                   <span class="{{chunk.cssclass}}">{{chunk.html_repr()}}</span><br/>
+                   <span class="{{chunk.cssclass}}"><span class="bytecodepos">{{chunk.bytecode_no}} </span>{{chunk.html_repr()}}</span><br/>
                    {% for op in chunk.operations %}
                       {% if op.name != "debug_merge_point" %}
                         {% if op.bridge %}