Jit Log Query Interface¶
This command line interface can be used to pretty print optimized program parts. If you are unfamiliar with the JIT compiler built into PyPy, we highly recommend reading the docs for it.
It is discouraged to run the query API on a remote server. As soon as the query parameter (-q) is parameterized, arbitrary code execution can be performed. Note that this is fine as long one can trust the user.
Let’s go ahead and inspect the example.py program in this repository. It is assumed that the reader setup vmprof for pypy already (e.g. in a virtualenv).
Now run the following command to generate the log:
# run your program and output the log pypy -m vmprof -o log.jit example.py
This generates the file that normally is sent to vmprof.com whenever –web is provided.
The query interface is a the flag ‘-q’ which incooperates a small query language. Here is an example:
pypy -m jitlog log.jit -q 'bridges & op("int_add_ovf")' ... # will print the filtered traces
Brand new. Subject to change!
Filter: Reduces the output to loops only
Filter: Reduces the output to bridges only
Filter: Selects a trace if it happens to optimize the function containing the name.
Filter: Only selects a traces if it contains the IR operation name.