Hacked By AnonymousFox

Current Path : /usr/lib64/python3.8/__pycache__/
Upload File :
Current File : //usr/lib64/python3.8/__pycache__/profile.cpython-38.opt-2.pyc

U

e5d�[�@stddlZddlZddlZddlZdddgZGdd�d�Zddd�Zdd	d�ZGd
d�d�Zdd�Z	e
d
krpe	�dS)�N�run�runctx�Profilec@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_UtilscCs
||_dS�N)�profiler)�selfr�r	�/usr/lib64/python3.8/profile.py�__init__0sz_Utils.__init__cCsF|��}z(z|�|�Wntk
r,YnXW5|�|||�XdSr)r�_showr�
SystemExit)r�	statement�filename�sort�profr	r	r
r3s
z
_Utils.runcCsJ|��}z,z|�|||�Wntk
r0YnXW5|�|||�XdSr)rrrr
)rr�globals�localsrrrr	r	r
r<s
z
_Utils.runctxcCs"|dk	r|�|�n
|�|�dSr)�
dump_stats�print_stats)rrrrr	r	r
rEsz_Utils._showN)�__name__�
__module__�__qualname__rrrrr	r	r	r
r*s		r���cCstt��|||�Sr)rrr)rrrr	r	r
rQscCstt��|||||�Sr)rrr)rrrrrr	r	r
r^sc@s�eZdZdZd4dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Ze
e	eeeed�Z
dd�ZGdd�d�ZGdd�d�Zdd�Zdd�Zd5d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/e_d6d0d1�Zd2d3�ZdS)7rrNcCs�i|_d|_d|_d|_|dkr&|j}||_|sHtj|_|_|j	|_
nl||_|��}zt|�}Wn"tk
r�||_|j	|_
Yn0X|dkr�|j
|_
n|j|_
|tfdd�}||_|��|_|�d�dS)N��cSs
||��Srr	)�timer�sumr	r	r
�get_time_timer�sz(Profile.__init__.<locals>.get_time_timerr)�timings�cur�cmd�c_func_name�bias�time�process_timer�get_time�trace_dispatch_i�
dispatcher�len�	TypeError�trace_dispatch�trace_dispatch_lr�t�
simulate_call)rrr#r-Zlengthrr	r	r
r�s0


zProfile.__init__cCs�|j}|�}|d|d|j|j}|dkr8|j|_|j||||�rd|�}|d|d|_n|�}|d|d||_dS)Nr��c_call�rr-r#rr"�dispatch)r�frame�event�argrr-�rr	r	r
r+�szProfile.trace_dispatchcCsT|j}|�|j|j}|dkr(|j|_|j||||�rD|�|_n|�||_dS�Nr0r1�rr3r4r5rr-r	r	r
r'�s
zProfile.trace_dispatch_icCs`|j}|�d|j|j}|dkr,|j|_|j||||�rL|�d|_n|�d||_dS)NgN@r0r1r8r	r	r
�trace_dispatch_mac�szProfile.trace_dispatch_maccCsT|j}|�|j|j}|dkr(|j|_|j||||�rD|�|_n|�||_dSr7)r&r-r#rr"r2)rr3r4r5r&r-r	r	r
r,�s
zProfile.trace_dispatch_lc	CsD|j\}}}}}}||k	r*|r*|�||�S|||||||f|_dS�Nr/)r �trace_dispatch_return)	rr3r-�rpt�rit�ret�rfn�rframe�rcurr	r	r
�trace_dispatch_exception�s
z Profile.trace_dispatch_exceptioncCs�|jr@|j|jdk	r@|j\}}}}}}t|tj�s@|�|d�|j}	|	j|	j|	j	f}
|dd|
||jf|_|j
}|
|kr�||
\}}
}}}||
d|||f||
<nddddif||
<dS�N���rr/)r �f_back�
isinstancer�
fake_framer;�f_code�co_filename�co_firstlineno�co_namer)rr3r-r<r=r>r?r@rAZfcode�fnr�cc�ns�tt�ct�callersr	r	r
�trace_dispatch_callszProfile.trace_dispatch_callc
Csndd|jf}|dd|||jf|_|j}||krX||\}}}}}	||d|||	f||<nddddif||<dS)Nrrr/)r"r r)
rr3r-rLrrMrNrOrPrQr	r	r
�trace_dispatch_c_callszProfile.trace_dispatch_c_callcCs�||jdk	r |�|jdd�|j\}}}}}}||}||}|\}	}
}}}
}|	|
|||||
|f|_|j}||\}}}}}|s�||}|d}||kr�||d||<nd||<||d||||f||<dSrC)r r;r)rr3r-r<r=r>r?rAZframe_totalZpptZpitZpetZpfn�pframeZpcurrrMrNrOrPrQr	r	r
r;"s"zProfile.trace_dispatch_return)�callZ	exception�returnr0Zc_exceptionZc_returncCs"|jdrdS||_|�|�dS)Nr)r r!r.)rr!r	r	r
�set_cmdXs
zProfile.set_cmdc@seZdZdd�Zdd�ZdS)zProfile.fake_codecCs||_||_||_d|_dS�Nr)rI�co_linerKrJ)rr�line�namer	r	r
r^szProfile.fake_code.__init__cCst|j|j|jf�Sr)�reprrIrYrK�rr	r	r
�__repr__dszProfile.fake_code.__repr__N)rrrrr^r	r	r	r
�	fake_code]sr_c@seZdZdd�ZdS)zProfile.fake_framecCs||_||_dSr)rHrE)r�codeZpriorr	r	r
rhszProfile.fake_frame.__init__N)rrrrr	r	r	r
rGgsrGcCsF|�dd|�}|jr |jd}nd}|�||�}|jd||d�dS)NZprofilerrDrU)r_r rGr2)rr[r`rTr3r	r	r
r.lszProfile.simulate_callcCsJ|j}|�|j}|jdr:|jd||jd|�d}q|�||_dS)NrrVrDr)r&r-r r2)rr&r-r	r	r
�simulate_cmd_completexs
zProfile.simulate_cmd_completercCs$ddl}|�|����|���dSrX)�pstatsZStatsZ
strip_dirsZ
sort_statsr)rrrbr	r	r
r�szProfile.print_statsc	Cs0t|d��}|��t�|j|�W5QRXdS)N�wb)�open�create_stats�marshal�dump�stats)r�file�fr	r	r
r�szProfile.dump_statscCs|��|��dSr)ra�snapshot_statsr]r	r	r
re�szProfile.create_statsc	Cs^i|_|j��D]H\}\}}}}}|��}d}|��D]}||7}q6|||||f|j|<qdSrX)rhr�items�copy�values)	r�funcrMrNrOrPrQZncZcallcntr	r	r
rk�s
zProfile.snapshot_statscCsddl}|j}|�|||�SrX)�__main__�__dict__r)rr!rp�dictr	r	r
r�szProfile.runc	Cs8|�|�t�|j�zt|||�W5t�d�X|Sr)rW�sys�
setprofiler(�exec)rr!rrr	r	r
r�s
zProfile.runctxc	Os�t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d��|�t|��t�	|j
�z|||�W�St�	d�XdS)	Nrz:descriptor 'runcall' of 'Profile' object needs an argumentrorz0Passing 'func' as keyword argument is deprecated)�
stacklevelz7runcall expected at least 1 positional argument, got %dr/)r)r*�pop�warnings�warn�DeprecationWarningrWr\rsrtr()�args�kwrrorxr	r	r
�runcall�s(

�
�zProfile.runcallz($self, func, /, *args, **kw)cCs<|jtk	rtd��|j}d|_z|�||�W�S||_XdS)Nz&Subclasses must override .calibrate().r)�	__class__rr*r#�_calibrate_inner)r�m�verboseZ
saved_biasr	r	r
�	calibrate�s
zProfile.calibratecCs|j}dd�}|fdd�}||�|�}||�|�}||}|rLtd|�t�}	|�}|	�dt�t��|�}||}
|r�td|
�d}d}|	j��D]0\\}
}}\}}}}}|d	kr�||7}||7}q�|r�td
|�td|�||dkr�td
|��||d|}|�rtd|�|S)NcSst|�D]}d}qdSr:��range)�n�i�xr	r	r
�f1sz$Profile._calibrate_inner.<locals>.f1cSst|�D]}|d�qdS)N�dr�)r�r�r�r	r	r
rjsz#Profile._calibrate_inner.<locals>.fz elapsed time without profiling =zf(m)zelapsed time with profiling =g)rjr�z!'CPU seconds' profiler reported =ztotal # calls =r/z internal error: total calls = %dg@z+mean stopwatch overhead per profile event =)	r&�printrrrrrrl�
ValueError)rr�r�r&r�rjZt0�t1Zelapsed_noprofile�pZelapsed_profileZtotal_callsZ
reported_timerrZ�funcnamerMrNrOrPrQZmeanr	r	r
r�sB

�



zProfile._calibrate_inner)NN)r)r)rrrr#rr+r'r9r,rBrRrSr;r2rWr_rGr.rarrrerkrrr}�__text_signature__r�rr	r	r	r
rgs@'
''�



+
c
Cs�ddl}ddlm}d}||d�}d|_|jdddd	dd
�|jddd
ddd�|jdddddd
�tjdd�s�|��t�d�|�	�\}}|tjdd�<|j
dk	r�|j�|j
�|_
t
|�dk�r�|jr�ddl}d}|j|dd�}nR|d}	tj�d|j�|	��t�|	��}
t|
��|	d�}W5QRX|	dddd�}zt||d|j
|j�Wn6tk
�r�}zdt_t�|j�W5d}~XYnXn|��|S)Nr)�OptionParserzMprofile.py [-o output_file_path] [-s sort] [-m module | scriptfile] [arg] ...)�usageFz-oz	--outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-m�module�
store_truezProfile a library module.)r��actionr�r�z-sz--sortrz?Sort order when printing to stdout, based on pstats.Stats classrr/rz(run_module(modname, run_name='__main__'))�
run_module�modnamerurp)�__file__r�__package__�
__cached__)�osZoptparser�Zallow_interspersed_argsZ
add_optionrs�argvZprint_usage�exit�
parse_argsr��path�abspathr)r��runpyr��insert�dirname�io�	open_code�compile�readrr�BrokenPipeError�stdout�errno)r�r�r��parserZoptionsr{r�r`ZglobsZprogname�fp�excr	r	r
�main9s^

�
�
�

�� r�rp)Nr)Nr)r�rsr$rf�__all__rrrrr�rr	r	r	r
�<module>s

'

	U9

Hacked By AnonymousFox1.0, Coded By AnonymousFox