[pypy-dev] why doesn't this code dump jit debug info ?

David Malcolm dmalcolm at redhat.com
Thu Dec 8 17:12:35 EST 2016


On Thu, 2016-12-08 at 21:49 +0000, Shubha Ramani via pypy-dev wrote:
> import py                                                            
>                                 
> import binary_trees                                                  
>                                 
> import os                                                            
>                                 
> from rpython.rlib.rjitlog import rjitlog                             
>                                  
>                                                                      
>                                 
> def test_binary_trees():                                             
>                                  
>     file = ('./jit.log')                                             
>                                  
>     fileno = os.open(file, os.O_WRONLY | os.O_CREAT)                 
>                                  
>     enable_jitlog = lambda: rjitlog.enable_jitlog(fileno)            
>                                 
>     os.system("./binary_trees.py 100 100")                           
>                                  
>                                                                      
>                                 
>                    



> running it as  /opt/pypy/pytest.py test_shubha.py
> 
> The log gets created but it is empty 

Firstly, are you actually calling test_binary_trees?  If not, you're
just importing some modules, and defining a function, then exiting.

Secondly: os.system will run the binary_trees.py in a separate process,
invoking it via whatever is in the shebang line.  That won't inherit
any of the jitlog settings you've done in this process (and if it's
#!/usr/bin/python, it could be CPython you're invoking).


Hope this is helpful
Dave


More information about the pypy-dev mailing list