Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/__pycache__/profile.cpython-37.opt-2.pyc

B

YI~d�W�@slddlZddlZddlZdddgZGdd�d�Zddd�Zdd	d�ZGd
d�d�Zdd�Ze	d
krhe�dS)�N�run�runctx�Profilec@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_UtilscCs
||_dS)N)�profiler)�selfr�r�,/opt/alt/python37/lib64/python3.7/profile.py�__init__/sz_Utils.__init__cCsF|��}z(y|�|�Wntk
r,YnXWd|�|||�XdS)N)rr�
SystemExit�_show)r�	statement�filename�sort�profrrr	r2s
z
_Utils.runcCsJ|��}z,y|�|||�Wntk
r0YnXWd|�|||�XdS)N)rrrr)rr
�globals�localsrrrrrr	r;s
z
_Utils.runctxcCs"|dk	r|�|�n
|�|�dS)N)�
dump_stats�print_stats)rrrrrrr	rDsz_Utils._showN)�__name__�
__module__�__qualname__r
rrrrrrr	r)s		r���cCstt��|||�S)N)rrr)r
rrrrr	rPscCstt��|||||�S)N)rrr)r
rrrrrrr	r]sc@s�eZdZdZd3dd�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|_|dkr&|j}||_|sHtj|_|_|j	|_
nl||_|��}yt|�}Wn"tk
r�||_|j	|_
Yn0X|dkr�|j
|_
n|j|_
|tfdd�}||_|��|_|�d�dS)N��cSs
||��S)Nr)�timer�sumrrr	�get_time_timer�sz(Profile.__init__.<locals>.get_time_timerr)�timings�cur�cmd�c_func_name�bias�timeZprocess_timer�get_time�trace_dispatch_i�
dispatcher�len�	TypeError�trace_dispatch�trace_dispatch_lr�t�
simulate_call)rrr"r+�lengthrrrr	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+�rrrr	r)�szProfile.trace_dispatchcCsT|j}|�|j|j}|dkr(|j|_|j||||�rD|�|_n|�||_dS)Nr/)rr+r"rr!r0)rr1r2r3rr+rrr	r%�s
zProfile.trace_dispatch_icCs`|j}|�d|j|j}|dkr,|j|_|j||||�rL|�d|_n|�d||_dS)NgN@r/)rr+r"rr!r0)rr1r2r3rr+rrr	�trace_dispatch_mac�szProfile.trace_dispatch_maccCsT|j}|�|j|j}|dkr(|j|_|j||||�rD|�|_n|�||_dS)Nr/)r$r+r"rr!r0)rr1r2r3r$r+rrr	r*�s
zProfile.trace_dispatch_lc	CsD|j\}}}}}}||k	r*|r*|�||�S|||||||f|_dS)Nr.)r�trace_dispatch_return)	rr1r+�rpt�rit�ret�rfn�rframe�rcurrrr	�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_framer6�f_code�co_filename�co_firstlineno�co_namer)rr1r+r7r8r9r:r;r<Zfcode�fnr�cc�ns�tt�ct�callersrrr	�trace_dispatch_callszProfile.trace_dispatch_callc
Csndd|jf}|dd|||jf|_|j}||krX||\}}}}}	||d|||	f||<nddddif||<dS)Nrrr.)r!rr)
rr1r+rFrrGrHrIrJrKrrr	�trace_dispatch_c_callszProfile.trace_dispatch_c_callcCs�||jdk	r |�|jdd�|j\}}}}}}||}||}|\}	}
}}}
}|	|
|||||
|f|_|j}||\}}}}}|s�||}|d}||kr�||d||<nd||<||d||||f||<dS)Nr>rr.)rr6r)rr1r+r7r8r9r:r<Zframe_totalZpptZpitZpetZpfn�pframeZpcurrrGrHrIrJrKrrr	r6!s"zProfile.trace_dispatch_return)�callZ	exception�returnr/Zc_exceptionZc_returncCs"|jdrdS||_|�|�dS)Nr)rr r,)rr rrr	�set_cmdWs
zProfile.set_cmdc@seZdZdd�Zdd�ZdS)zProfile.fake_codecCs||_||_||_d|_dS)Nr)rC�co_linerErD)rr�line�namerrr	r
]szProfile.fake_code.__init__cCst|j|j|jf�S)N)�reprrCrRrE)rrrr	�__repr__cszProfile.fake_code.__repr__N)rrrr
rVrrrr	�	fake_code\srWc@seZdZdd�ZdS)zProfile.fake_framecCs||_||_dS)N)rBr?)r�codeZpriorrrr	r
gszProfile.fake_frame.__init__N)rrrr
rrrr	rAfsrAcCsF|�dd|�}|jr |jd}nd}|�||�}|jd||d�dS)NZprofilerr>rO)rWrrAr0)rrTrXrNr1rrr	r,kszProfile.simulate_callcCsN|j}|�|j}x*|jdr<|jd||jd|�d}qW|�||_dS)NrrPr>r)r$r+rr0)rr$r+rrr	�simulate_cmd_completewszProfile.simulate_cmd_completercCs$ddl}|�|����|���dS)Nr)�pstatsZStatsZ
strip_dirsZ
sort_statsr)rrrZrrr	r�szProfile.print_statsc	Cs0t|d��}|��t�|j|�WdQRXdS)N�wb)�open�create_stats�marshal�dump�stats)r�file�frrr	r�szProfile.dump_statscCs|��|��dS)N)rY�snapshot_stats)rrrr	r]�szProfile.create_statsc	Csfi|_xZ|j��D]L\}\}}}}}|��}d}x|��D]}||7}q:W|||||f|j|<qWdS)Nr)r`r�items�copy�values)	r�funcrGrHrIrJrKZncZcallcntrrr	rc�szProfile.snapshot_statscCsddl}|j}|�|||�S)Nr)�__main__�__dict__r)rr rh�dictrrr	r�szProfile.runc	Cs8|�|�t�|j�zt|||�Wdt�d�X|S)N)rQ�sys�
setprofiler&�exec)rr rrrrr	r�s
zProfile.runctxc	Os�t|�dkr|^}}}n>|s&td��n0d|krB|�d�}|^}}ntdt|�d��|�t|��t�|j�z
|||�St�d�XdS)Nrz:descriptor 'runcall' of 'Profile' object needs an argumentrgz7runcall expected at least 1 positional argument, got %dr.)r'r(�poprQrUrkrlr&)�args�kwrrgrrr	�runcall�s



zProfile.runcallcCs8|jtk	rtd��|j}d|_z|�||�S||_XdS)Nz&Subclasses must override .calibrate().r)�	__class__rr(r"�_calibrate_inner)r�m�verboseZ
saved_biasrrr	�	calibrate�s
zProfile.calibratecCs"|j}dd�}|fdd�}||�|�}||�|�}||}|rLtd|�t�}	|�}|	�dt�t��|�}||}
|r�td|
�d}d}x>|	j��D]0\\}
}}\}}}}}|d	kr�||7}||7}q�W|r�td
|�td|�||dkr�td
|��||d|}|�rtd|�|S)NcSsxt|�D]}d}q
WdS)Nr.)�range)�n�i�xrrr	�f1�sz$Profile._calibrate_inner.<locals>.f1cSsxt|�D]}|d�q
WdS)N�d)rw)rtr{ryrrr	rbsz#Profile._calibrate_inner.<locals>.fz elapsed time without profiling =zf(m)zelapsed time with profiling =g)rbr{z!'CPU seconds' profiler reported =ztotal # calls =r.z internal error: total calls = %dg@z+mean stopwatch overhead per profile event =)	r$�printrrrrrrd�
ValueError)rrtrur$r{rbZt0Zt1Zelapsed_noprofile�pZelapsed_profileZtotal_callsZ
reported_timerrS�funcnamerGrHrIrJrKZmeanrrr	rs�sB

"


zProfile._calibrate_inner)NN)r)r)rrrr"r
r)r%r5r*r=rLrMr6r0rQrWrAr,rYrrr]rcrrrqrvrsrrrr	rfs<'
''




=
c
	Cs
ddl}ddlm}d}||d�}d|_|jdddd	dd
�|jddd
ddd
�tjdd�sp|��t�d�|�	�\}}|tjdd�<t
|�dkr�|d}tj�d|j�
|��t|d��}t|��|d�}WdQRX|dddd�}	t||	d|j|j�n|��|S)Nr)�OptionParserz?profile.py [-o output_file_path] [-s sort] scriptfile [arg] ...)�usageFz-oz	--outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-sz--sortrz?Sort order when printing to stdout, based on pstats.Stats classrr.r�rbrmrh)�__file__r�__package__�
__cached__)�osZoptparser�Zallow_interspersed_argsZ
add_optionrk�argv�print_usage�exit�
parse_argsr'�path�insert�dirnamer\�compile�readrr�r)
r�r�r��parser�optionsroZprogname�fprXZglobsrrr	�main4s6




r�rh)Nr)Nr)
rkr#r^�__all__rrrrr�rrrrr	�<module>s

'

	Q%

Hacked By AnonymousFox1.0, Coded By AnonymousFox