Current File : //proc/3/cwd/opt/alt/python35/lib64/python3.5/__pycache__/cProfile.cpython-35.pyc
�q�\��@s�dZdddgZddlZddlZdddd�Zdddd�Zejje_ejje_Gd d�dej�Zd
d�Z dd
�Z
edkr�e
�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�-/opt/alt/python35/lib64/python3.5/cProfile.pyrscCs"tjt�j|||||�S)N)rrrr)r�globals�localsr r
rrrrsc@smeZdZdZddd�Zdd�Zdd�Zd d
�Zdd�Zd
d�Z dd�Z
dS)raiProfile(custom_timer=None, time_unit=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, time_unit can
be a float specifying a scale (i.e. how long each integer unit
is, in seconds).
rcCs2ddl}|j|�j�j|�j�dS)Nr)�pstatsZStatsZ
strip_dirsZ
sort_stats�print_stats)�selfr
rrrrr(szProfile.print_statsc
CsFddl}t|d��$}|j�|j|j|�WdQRXdS)Nr�wb)�marshal�open�create_stats�dump�stats)r�filer�frrr�
dump_stats,s
zProfile.dump_statscCs|j�|j�dS)N)�disable�snapshot_stats)rrrrr2s
zProfile.create_statscCs�|j�}i|_i}xz|D]r}t|j�}|j}||j}|j}|j}i} | |t|j�<||||| f|j|<q"Wx�|D]�}|j r�t|j�}x�|j D]�}
y|t|
j�} Wnt
k
r�w�YnX|
j}||
j}|
j}|
j}|| krr| |}||d7}||d7}||d7}||d7}||||f| |<q�Wq�WdS)Nrr��)Zgetstatsr�label�codeZ callcountZreccallcountZ
inlinetimeZ totaltime�idZcalls�KeyError)r�entriesZcallersdicts�entry�funcZncZccZttZctZcallersZsubentry�prevrrrr6s>
zProfile.snapshot_statscCs(ddl}|j}|j|||�S)Nr)�__main__�__dict__r)r�cmdr'�dictrrrr\s zProfile.runc
Cs0|j�zt|||�Wd|j�X|S)N)�enable�execr)rr)r
rrrrras
zProfile.runctxc
Os-|j�z|||�SWd|j�XdS)N)r+r)rr%�args�kwrrr�runcalljs
zProfile.runcallN���)�__name__�
__module__�__qualname__�__doc__rrrrrrr/rrrrrs& cCs6t|t�rdd|fS|j|j|jfSdS)N�~r)�
isinstance�str�co_filename�co_firstlineno�co_name)r rrrrss
rcCs�ddl}ddl}ddlm}d}|d|�}d|_|jdddd d
ddd�|jd
dddd
ddd�|jdd�s�|j�|jd�|j �\}}||jdd�<t
|�dkr�|d}|jjd|jj
|��t|d��}t|j�|d�} WdQRXd|ddddddi}
t| |
d|j|j�n
|j�|S)Nr)�OptionParserz@cProfile.py [-o output_file_path] [-s sort] scriptfile [arg] ...�usageFz-oz --outfile�dest�outfile�helpzSave stats to <outfile>�defaultz-sz--sortr
z?Sort order when printing to stdout, based on pstats.Stats classrr�rbr,�__file__r1r'�__package__�
__cached__r0)�os�sysZoptparser;Zallow_interspersed_argsZ
add_option�argvZprint_usage�exit�
parse_args�len�path�insert�dirnamer�compile�readrr>r
)rErFr;r<�parserZoptionsr-Zprogname�fpr Zglobsrrr�main{s6
rRr'r0r0)r4�__all__Z_lsprofZprofilerrrZProfilerrrrRr1rrrr�<module>sX$