lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi List,

luatrace [1] now includes a -jannotate option for LuaJIT.  -jannotate offers less information than -jdump, but formats it differently in manner that I find easier to comprehend.

First, it tells you how many traces were compiled, how many were aborted and why (sorry, this will look awful if you're not reading your mail in a monospaced font):

Trace Status                                	         Traces	      Bytecodes	          Lines
------------                                	         ------	      ---------	          -----
Success                                     	     132 ( 85%)	    1956 ( 89%)	     540 ( 87%)
NYI: bytecode CAT                           	       4 (  2%)	     112 (  5%)	      32 (  5%)
NYI: FastFunc string.match                  	       8 (  5%)	      45 (  2%)	      13 (  2%)
NYI: unsupported C type conversion          	       1 (  0%)	      39 (  1%)	      12 (  1%)
inner loop in root trace                    	       1 (  0%)	      16 (  0%)	       5 (  0%)
NYI: FastFunc os.clock                      	       1 (  0%)	      11 (  0%)	       5 (  0%)
NYI: return to lower frame                  	       2 (  1%)	       8 (  0%)	       3 (  0%)
leaving loop in root trace                  	       4 (  2%)	       5 (  0%)	       4 (  0%)
NYI: FastFunc string.upper                  	       1 (  0%)	       4 (  0%)	       1 (  0%)
error thrown or hook called during recording	       1 (  0%)	       0 (  0%)	       0 (  0%)
--------------------------------------------	---------------	---------------	---------------
Total                                       	     155 (100%)	    2196 (100%)	     615 (100%)
============================================	===============	===============	===============


then the lines that aborted the traces:

Trace Status                                                           	         Traces	      Bytecodes	          Lines	Line
------------                                                           	         ------	      ---------	          -----	----
Success                                                                	     132 ( 85%)	    1956 ( 89%)	     540 ( 87%)	
./luasimplex/mps.lua:189 (NYI: bytecode CAT)                           	       3 (  1%)	      68 (  3%)	      24 (  3%)	      local name = r.name.."_SLACK"
./luasimplex/rsm.lua:223 (NYI: bytecode CAT)                           	       1 (  0%)	      44 (  2%)	       8 (  1%)	      M.variable_names[k] = M.constraint_names[i].."_ARTIFICIAL"
./luasimplex.lua:85 (NYI: unsupported C type conversion)               	       1 (  0%)	      39 (  1%)	      12 (  1%)	    M.indexes = luasimplex.iarray(nonzeroes)
...


and finally shows you the bytecode of the traces side-by-side with your source code (be careful here - bytecode order isn't always the same as source order.  I've tried to prefer source order):

Trace #5 (2 lines, 10 bytecodes, 1 attempts)
                                                                  | ./luasimplex/rsm.lua:210-211
0025  FORL    14 => 0019                                          |  210 |     for j = row_starts[i], row_starts[i+1]-1 do
0019  TGETV   18   6  17                                          |  211 |       z = z - elements[j] * I.x[indexes[j]]
0000  . . FUNCC           ; ffi.meta.__index                      |    . |
0020  TGETS   19   1   6  ; "x"                                   |    . |
0021  TGETV   20   5  17                                          |    . |
0000  . . FUNCC           ; ffi.meta.__index                      |    . |
0022  TGETV   19  19  20                                          |    . |
0000  . . FUNCC           ; ffi.meta.__index                      |    . |
0023  MULVV   18  18  19                                          |    . |
0024  SUBVV   13  13  18                                          |    . |


Cheers,
Geoff

[1] https://github.com/geoffleyland/luatrace