3 \ ã @ sz d Z dddgZddlZddlZddd„Zddd„Zejj e_ ejj e_ G d d„ dejƒZd d„ Z dd „ Z edkrve ƒ dS )zUPython interface for the 'lsprof' profiler. Compatible with the 'profile' module. ÚrunÚrunctxÚProfileé Né c C s t jtƒj| ||ƒS )N)Ú _pyprofileÚ_Utilsr r )Ú statementÚfilenameÚsort© r ú /usr/lib64/python3.6/cProfile.pyr s c C s t jtƒj| ||||ƒS )N)r r r r )r ÚglobalsÚlocalsr r r r r r s c @ sJ e Zd ZdZddd„Zdd„ Zdd„ Zd d „ Zdd„ Zd d„ Z dd„ Z dS )r a` Profile(timer=None, timeunit=None, subcalls=True, builtins=True) Builds a profiler object using the specified timer function. The default timer is a fast built-in one based on real time. For custom timer functions returning integers, timeunit can be a float specifying a scale (i.e. how long each integer unit is, in seconds). r c C s$ dd l }|j| ƒjƒ j|ƒjƒ d S )Nr )ÚpstatsÚStatsZ strip_dirsZ sort_statsÚprint_stats)Úselfr r r r r r ( s zProfile.print_statsc C s8 dd l }t|dƒ�}| jƒ |j| j|ƒ W d Q R X d S )Nr Úwb)ÚmarshalÚopenÚcreate_statsÚdumpÚstats)r Úfiler Úfr r r Ú dump_stats, s zProfile.dump_statsc C s | j ƒ | jƒ d S )N)ÚdisableÚsnapshot_stats)r r r r r 2 s zProfile.create_statsc C s6 | j ƒ }i | _i }xX|D ]P}t|jƒ}|j}||j }|j}|j}i } | |t|jƒ<