Current File : //lib64/python3.6/__pycache__/cProfile.cpython-36.opt-1.pyc
3
\�@szdZdddgZddlZddlZddd�Zddd�Zejje_ejje_Gd d�dej�Zd
d�Z dd
�Z
edkrve
�dS)zUPython interface for the 'lsprof' profiler.
Compatible with the 'profile' module.
�run�runctx�Profile�N�cCstjt�j|||�S)N)�
_pyprofile�_Utilsrr)� statement�filename�sort�r� /usr/lib64/python3.6/cProfile.pyrscCstjt�j|||||�S)N)rrrr)r�globals�localsr r
rrrrsc@sJeZdZdZddd�Zdd�Zdd�Zd d
�Zdd�Zd
d�Z dd�Z
dS)ra`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).
rcCs$ddl}|j|�j�j|�j�dS)Nr)�pstats�StatsZ
strip_dirsZ
sort_stats�print_stats)�selfr
rrrrr(szProfile.print_statsc
Cs8ddl}t|d��}|j�|j|j|�WdQRXdS)Nr�wb)�marshal�open�create_stats�dump�stats)r�filer�frrr�
dump_stats,szProfile.dump_statscCs|j�|j�dS)N)�disable�snapshot_stats)rrrrr2szProfile.create_statscCs6|j�}i|_i}xX|D]P}t|j�}|j}||j}|j}|j}i} | |t|j�<||||| f|j|<qWx�|D]�}|j rrt|j�}x�|j D]�}
y|t|
j�} Wnt
k
r�w�YnX|
j}||
j}|
j}|
j}|| k�r| |}||d7}||d7}||d7}||d7}||||f| |<q�WqrWdS)Nrr��)Zgetstatsr�label�codeZ callcountZreccallcountZ
inlinetimeZ totaltime�idZcalls�KeyError)rZentriesZcallersdicts�entry�funcZncZccZttZctZcallersZsubentry�prevrrrr6s>
zProfile.snapshot_statscCsddl}|j}|j|||�S)Nr)�__main__�__dict__r)r�cmdr'�dictrrrr\szProfile.runc
Cs(|j�zt|||�Wd|j�X|S)N)�enable�execr)rr)r
rrrrras
zProfile.runctxc
Os"|j�z
|||�S|j�XdS)N)r+r)rr%�args�kwrrr�runcalljs
zProfile.runcallN���)r0)�__name__�
__module__�__qualname__�__doc__rrrrrrr/rrrrrs
& cCs(t|t�rdd|fS|j|j|jfSdS)N�~r)�
isinstance�str�co_filename�co_firstlineno�co_name)r!rrrr ss
r c
Cs&ddl}ddl}ddl}ddlm}d}||d�}d|_|jdddd dd
�|jddd
ddt|jj �d�|j
dd�s�|j�|jd�|j
�\}}||j
dd�<t|�dk�r|d}|jjd|jj|��t|d��} t| j�|d�}
WdQRX|dddd�}t|
|d|j|j�n|j�|S)Nr)�OptionParserz@cProfile.py [-o output_file_path] [-s sort] scriptfile [arg] ...)�usageFz-oz --outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-sz--sortr
z?Sort order when printing to stdout, based on pstats.Stats classr)r>r?r@�choicesr�rbr,r')�__file__r1�__package__�
__cached__r0)�os�sysrZoptparser;Zallow_interspersed_argsZ
add_option�sortedrZsort_arg_dict_default�argvZprint_usage�exit�
parse_args�len�path�insert�dirnamer�compile�readrr=r
)rFrGrr;r<�parserZoptionsr-Zprogname�fpr!Zglobsrrr�main{s8
rTr'r0)Nr0r0)Nr0)r4�__all__Z_lsprofZprofilerrrZProfilerrr rTr1rrrr�<module>s
X%