AlkantarClanX12

Your IP : 18.119.108.233


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/profile.cpython-310.opt-2.pyc

o

6��fpY�@sx	ddlZddlZddlZddlZgd�ZGdd�d�Zddd�Zddd	�ZGd
d�d�Zdd
�Z	e
dkr:e	�dSdS)�N)�run�runctx�Profilec@s.eZdZ	dd�Zdd�Zdd�Zdd�Zd	S)
�_UtilscCs
||_dS�N)�profiler)�selfr�r	�./opt/alt/python310/lib64/python3.10/profile.py�__init__0�
z_Utils.__init__cCsd|��}z%z|�|�Wn	tyYnwW|�|||�dSW|�|||�dS|�|||�wr)rr�
SystemExit�_show)r�	statement�filename�sort�profr	r	r
r3s���"z
_Utils.runcCsh|��}z'z	|�|||�Wn	tyYnwW|�|||�dSW|�|||�dS|�|||�wr)rrr
r)rr�globals�localsrrrr	r	r
r<s���"z
_Utils.runctxcCs$|dur|�|�dS|�|�dSr)�
dump_stats�print_stats)rrrrr	r	r
rEsz_Utils._showN)�__name__�
__module__�__qualname__rrrrr	r	r	r
r*s		r���cCs	tt��|||�Sr)rrr)rrrr	r	r
rQs
rcCs	tt��|||||�Sr)rrr)rrrrrr	r	r
r^src@s�eZdZ	dZd3dd�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�Zd4d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd5d/d0�Zd1d2�ZdS)6rrNcCs�i|_d|_d|_d|_|dur|j}||_|s$tj|_|_|j	|_
n5||_|��}zt|�}WntyA||_|j	|_
Ynw|dkrK|j
|_
n|j|_
|tfdd�}||_|��|_|�d�dS)N��cSs
||��Srr	)�timer�sumr	r	r
�get_time_timer�rz(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�s2
�

zProfile.__init__cCs�|j}|�}|d|d|j|j}|dkr|j|_|j||||�r3|�}|d|d|_dS|�}|d|d||_dS)Nr��c_call�rr.r$rr#�dispatch)r�frame�event�argrr.�rr	r	r
r,�szProfile.trace_dispatchcC�V|j}|�|j|j}|dkr|j|_|j||||�r#|�|_dS|�||_dS�Nr1r2�rr4r5r6rr.r	r	r
r(��zProfile.trace_dispatch_icCsb|j}|�d|j|j}|dkr|j|_|j||||�r'|�d|_dS|�d||_dS)NgN@r1r2r:r	r	r
�trace_dispatch_mac�szProfile.trace_dispatch_maccCr8r9)r'r.r$rr#r3)rr4r5r6r'r.r	r	r
r-�r;zProfile.trace_dispatch_lc	CsD|j\}}}}}}||ur|r|�||�S|||||||f|_dS�Nr0)r!�trace_dispatch_return)	rr4r.�rpt�rit�ret�rfn�rframe�rcurr	r	r
�trace_dispatch_exception�s
z Profile.trace_dispatch_exceptioncCs�|jr |j|jdur |j\}}}}}}t|tj�s |�|d�|j}	|	j|	j|	j	f}
|dd|
||jf|_|j
}|
|vrR||
\}}
}}}||
d|||f||
<dSddddif||
<dS�N���rr0)r!�f_back�
isinstancer�
fake_framer>�f_code�co_filename�co_firstlineno�co_namer )rr4r.r?r@rArBrCrDZfcode�fnr �cc�ns�tt�ct�callersr	r	r
�trace_dispatch_calls�zProfile.trace_dispatch_callc
Cspdd|jf}|dd|||jf|_|j}||vr-||\}}}}}	||d|||	f||<dSddddif||<dS)Nrrr0)r#r!r )
rr4r.rOr rPrQrRrSrTr	r	r
�trace_dispatch_c_calls�zProfile.trace_dispatch_c_callcCs�||jdur|�|jdd�|j\}}}}}}||}||}|\}	}
}}}
}|	|
|||||
|f|_|j}||\}}}}}|sL||}|d}||vrY||d||<nd||<||d||||f||<dSrF)r!r>r )rr4r.r?r@rArBrDZframe_totalZpptZpitZpetZpfn�pframeZpcurr rPrQrRrSrTr	r	r
r>"s"zProfile.trace_dispatch_return)�callZ	exception�returnr1Zc_exceptionZc_returncCs"|jdrdS||_|�|�dS�Nr)r!r"r/)rr"r	r	r
�set_cmdXszProfile.set_cmdc@seZdZdd�Zdd�ZdS)zProfile.fake_codecCs||_||_||_d|_dS�Nr)rL�co_linerNrM)rr�line�namer	r	r
r^s
zProfile.fake_code.__init__cCst|j|j|jf�Sr)�reprrLr]rN�rr	r	r
�__repr__dszProfile.fake_code.__repr__N)rrrrrbr	r	r	r
�	fake_code]srcc@seZdZdd�ZdS)zProfile.fake_framecCs||_||_dSr)rKrH)r�codeZpriorr	r	r
rhs
zProfile.fake_frame.__init__N)rrrrr	r	r	r
rJgsrJcCsF|�dd|�}|jr|jd}nd}|�||�}|jd||d�dS)NZprofilerrGrX)rcr!rJr3)rr_rdrWr4r	r	r
r/lszProfile.simulate_callcCsR|j}|�|j}|jdr!|jd||jd|�d}|jds|�||_dS)NrrYrGr)r'r.r!r3)rr'r.r	r	r
�simulate_cmd_completexs

�zProfile.simulate_cmd_completercCs$ddl}|�|����|���dSr\)�pstatsZStatsZ
strip_dirsZ
sort_statsr)rrrfr	r	r
r�s
zProfile.print_statscCsFt|d��}|��t�|j|�Wd�dS1swYdS)N�wb)�open�create_stats�marshal�dump�stats)r�file�fr	r	r
r�s"�zProfile.dump_statscCs|��|��dSr)re�snapshot_statsrar	r	r
ri�szProfile.create_statsc	Cs^i|_|j��D]$\}\}}}}}|��}d}|��D]}||7}q|||||f|j|<qdSr\)rlr �items�copy�values)	r�funcrPrQrRrSrTZncZcallcntr	r	r
ro�s
�zProfile.snapshot_statscCsddl}|j}|�|||�Sr\)�__main__�__dict__r)rr"rt�dictr	r	r
r�szProfile.runc	Cs@|�|�t�|j�zt|||�Wt�d�|St�d�wr)r[�sys�
setprofiler)�exec)rr"rrr	r	r
r�s

�zProfile.runctxc	OsB|�t|��t�|j�z
||i|��Wt�d�St�d�wr)r[r`rwrxr))rrs�args�kwr	r	r
�runcall�s
zProfile.runcallcCs<|jtur	td��|j}d|_z
|�||�W||_S||_w)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�}||�|�}||�|�}||}|r&td|�t�}	|�}|	�dt�t��|�}||}
|rCtd|
�d}d}|	j��D]\\}
}}\}}}}}|d	vrd||7}||7}qL|rqtd
|�td|�||dkr}td
|��||d|}|r�td|�|S)NcSst|�D]}d}qdSr=��range)�n�i�xr	r	r
�f1�s�z$Profile._calibrate_inner.<locals>.f1cSst|�D]}|d�qdS)N�dr�)rr�r�r	r	r
rn�s
�z#Profile._calibrate_inner.<locals>.fz elapsed time without profiling =zf(m)zelapsed time with profiling =g)rnr�z!'CPU seconds' profiler reported =ztotal # calls =r0z internal error: total calls = %dg@z+mean stopwatch overhead per profile event =)	r'�printrrrrr rp�
ValueError)rrr�r'r�rnZt0�t1Zelapsed_noprofile�pZelapsed_profileZtotal_callsZ
reported_timerr^�funcnamerPrQrRrSrTZmeanr	r	r
r~�sD

��


zProfile._calibrate_inner)NN)r)r)rrrr$rr,r(r<r-rErUrVr>r3r[rcrJr/rerrrirorrr|r�r~r	r	r	r
rgsB&
''�




1rc
Cs�ddl}ddlm}d}||d�}d|_|jdddd	dd
�|jddd
ddd�|jdddddd
�tjdd�sB|��t�d�|�	�\}}|tjdd�<|j
dur\|j�|j
�|_
t
|�dkr�|jrtddl}d}|j|dd�}n3|d}	tj�d|j�|	��t�|	��}
t|
��|	d�}Wd�n1s�wY|	dddd�}z
t||d|j
|j�W|Sty�}zdt_t�|j�WYd}~|Sd}~ww|��|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 classrr0rz(run_module(modname, run_name='__main__'))�
run_module�modnameryrt)�__file__r�__package__�
__cached__)�osZoptparser�Zallow_interspersed_argsZ
add_optionrw�argvZprint_usage�exit�
parse_argsr��path�abspathr*r��runpyr��insert�dirname�io�	open_code�compile�readrr�BrokenPipeError�stdout�errno)r�r�r��parserZoptionsrzr�rdZglobsZprogname�fp�excr	r	r
�main)sd

�
�
�

������r�rtrZ)r�rwr%rj�__all__rrrrr�rr	r	r	r
�<module>s"

'

	E9
�