AlkantarClanX12

Your IP : 3.147.82.252


Current Path : /opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/__pycache__/profile.cpython-33.pyo

�
��f�Sc@s�dZddlZddlZddlZddlZddlmZdddgZeddd�Z	edd	d�Z
Gd
d�d�Zdd�Ze
d
kr�e�ndS(u Class for profiling Python code.iN(uOptionParserurunurunctxuProfileicCs^t�}y|j|�}Wntk
r0YnX|dk	rM|j|�n
|j|�SdS(uRun statement under profiler optionally saving results in filename

    This function takes a single argument that can be passed to the
    "exec" statement, and an optional file name.  In all cases this
    routine attempts to "exec" its first argument and gather profiling
    statistics from the execution. If no file name is present, then this
    function automatically prints a simple profiling report, sorted by the
    standard name string (file/line/function-name) that is presented in
    each line.
    N(uProfileurunu
SystemExituNoneu
dump_statsuprint_stats(u	statementufilenameusortuprof((u,/opt/alt/python33/lib64/python3.3/profile.pyurun0s	
cCsdt�}y|j|||�}Wntk
r6YnX|dk	rS|j|�n
|j|�SdS(u�Run statement under profiler, supplying your own globals and locals,
    optionally saving results in filename.

    statement and filename have the same semantics as profile.run
    N(uProfileurunctxu
SystemExituNoneu
dump_statsuprint_stats(u	statementuglobalsulocalsufilenameusortuprof((u,/opt/alt/python33/lib64/python3.3/profile.pyurunctxEs	
cBs~|EeZdZdZdZd8d8dd�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zied6ed6ed6e
d6ed6ed6Zdd�ZGdd�d�ZGdd �d �Zd!d"�Zd#d$�Zd9d&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zdd4d5�Zd6d7�Zd8S(:uProfileuProfiler class.

    self.cur is always a tuple.  Each such tuple corresponds to a stack
    frame that is currently active (self.cur[-2]).  The following are the
    definitions of its members.  We use this external "parallel stack" to
    avoid contaminating the program that we are profiling. (old profiler
    used to write into the frames local dictionary!!) Derived classes
    can change the definition of some entries, as long as they leave
    [-2:] intact (frame and previous tuple).  In case an internal error is
    detected, the -3 element is used as the function name.

    [ 0] = Time that needs to be charged to the parent frame's function.
           It is used so that a function call will not have to access the
           timing data for the parent frame.
    [ 1] = Total time spent in this frame's function, excluding time in
           subfunctions (this latter is tallied in cur[2]).
    [ 2] = Total time spent in subfunctions, excluding time executing the
           frame's function (this latter is tallied in cur[1]).
    [-3] = Name of the function that corresponds to this frame.
    [-2] = Actual frame that we correspond to (used to sync exception handling).
    [-1] = Our parent 6-tuple (corresponds to frame.f_back).

    Timing data for each function is stored as a 5-tuple in the dictionary
    self.timings[].  The index is always the name stored in self.cur[-3].
    The following are the definitions of the members:

    [0] = The number of times this function was called, not counting direct
          or indirect recursion,
    [1] = Number of times this function appears on the stack, minus one
    [2] = Total time spent internal to this function
    [3] = Cumulative time that this function was present on the stack.  In
          non-recursive functions, this is the total execution time from start
          to finish of each invocation of a function, including time spent in
          all subfunctions.
    [4] = A dictionary indicating for each function name, the number of times
          it was called by us.
    icCsi|_d|_d|_d|_|dkr<|j}n||_|smtj|_|_	|j
|_n�||_|j�}yt|�}Wn't
k
r�||_	|j
|_YnCX|dkr�|j|_n|j|_|tdd�}||_	|j	�|_|jd�dS(NuicSs
||��S(N((utimerusum((u,/opt/alt/python33/lib64/python3.3/profile.pyuget_time_timer�su(Profile.__init__.<locals>.get_time_timeruprofiler(utimingsuNoneucurucmduc_func_nameubiasutimeuprocess_timeutimeruget_timeutrace_dispatch_iu
dispatcherulenu	TypeErrorutrace_dispatchutrace_dispatch_lusumutu
simulate_call(uselfutimerubiasutulengthuget_time_timer((u,/opt/alt/python33/lib64/python3.3/profile.pyu__init__s0						
		uProfile.__init__cCs�|j}|�}|d|d|j|j}|dkrM|j|_n|j||||�r�|�}|d|d|_n"|�}|d|d||_dS(Niiuc_call(utimerutubiasu__name__uc_func_nameudispatch(uselfuframeueventuargutimerutur((u,/opt/alt/python33/lib64/python3.3/profile.pyutrace_dispatch�s		 		uProfile.trace_dispatchcCsw|j}|�|j|j}|dkr;|j|_n|j||||�rc|�|_n|�||_dS(Nuc_call(utimerutubiasu__name__uc_func_nameudispatch(uselfuframeueventuargutimerut((u,/opt/alt/python33/lib64/python3.3/profile.pyutrace_dispatch_i�s	uProfile.trace_dispatch_icCs�|j}|�d|j|j}|dkr?|j|_n|j||||�rk|�d|_n|�d||_dS(NgN@uc_call(utimerutubiasu__name__uc_func_nameudispatch(uselfuframeueventuargutimerut((u,/opt/alt/python33/lib64/python3.3/profile.pyutrace_dispatch_mac�s	uProfile.trace_dispatch_maccCsw|j}|�|j|j}|dkr;|j|_n|j||||�rc|�|_n|�||_dS(Nuc_call(uget_timeutubiasu__name__uc_func_nameudispatch(uselfuframeueventuarguget_timeut((u,/opt/alt/python33/lib64/python3.3/profile.pyutrace_dispatch_l�s	uProfile.trace_dispatch_lc	Cs`|j\}}}}}}||k	r=|r=|j||�S|||||||f|_dS(Ni(ucurutrace_dispatch_return(	uselfuframeuturpturitureturfnurframeurcur((u,/opt/alt/python33/lib64/python3.3/profile.pyutrace_dispatch_exception�s
u Profile.trace_dispatch_exceptioncCs|jrb|j|jdk	rb|j\}}}}}}t|tj�sb|j|d�qbn|j}	|	j|	j|	j	f}
|dd|
||jf|_|j
}|
|kr�||
\}}
}}}||
d|||f||
<nddddif||
<dS(Niiii����(ucuruf_backu
isinstanceuProfileu
fake_frameutrace_dispatch_returnuf_codeuco_filenameuco_firstlinenouco_nameutimings(uselfuframeuturpturitureturfnurframeurcurufcodeufnutimingsuccunsuttuctucallers((u,/opt/alt/python33/lib64/python3.3/profile.pyutrace_dispatch_call�s		 uProfile.trace_dispatch_callc
Cs�dd|jf}|dd|||jf|_|j}||kr~||\}}}}}	||d|||	f||<nddddif||<dS(Nuii(uc_func_nameucurutimings(
uselfuframeutufnutimingsuccunsuttuctucallers((u,/opt/alt/python33/lib64/python3.3/profile.pyutrace_dispatch_c_calls	 uProfile.trace_dispatch_c_callcCs&||jdk	r-|j|jdd�n|j\}}}}}}||}||}|\}	}
}}}
}|	|
|||||
|f|_|j}||\}}}}}|s�||}|d}n||kr�||d||<n
d||<||d||||f||<dS(Niiii����i����(ucurutrace_dispatch_returnutimings(uselfuframeuturpturitureturfnurcuruframe_totalupptupitupetupfnupframeupcurutimingsuccunsuttuctucallers((u,/opt/alt/python33/lib64/python3.3/profile.pyutrace_dispatch_returns"

#	


!uProfile.trace_dispatch_returnucallu	exceptionureturnuc_calluc_exceptionuc_returncCs+|jdrdS||_|j|�dS(Nii����(ucurucmdu
simulate_call(uselfucmd((u,/opt/alt/python33/lib64/python3.3/profile.pyuset_cmdGs
	uProfile.set_cmdcBs,|EeZdZdd�Zdd�ZdS(uProfile.fake_codecCs(||_||_||_d|_dS(Ni(uco_filenameuco_lineuco_nameuco_firstlineno(uselfufilenameulineuname((u,/opt/alt/python33/lib64/python3.3/profile.pyu__init__Ms			uProfile.fake_code.__init__cCst|j|j|jf�S(N(urepruco_filenameuco_lineuco_name(uself((u,/opt/alt/python33/lib64/python3.3/profile.pyu__repr__SsuProfile.fake_code.__repr__N(u__name__u
__module__u__qualname__u__init__u__repr__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/profile.pyu	fake_codeLsu	fake_codecBs |EeZdZdd�ZdS(uProfile.fake_framecCs||_||_dS(N(uf_codeuf_back(uselfucodeuprior((u,/opt/alt/python33/lib64/python3.3/profile.pyu__init__Ws	uProfile.fake_frame.__init__N(u__name__u
__module__u__qualname__u__init__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/profile.pyu
fake_frameVsu
fake_framecCsa|jdd|�}|jr.|jd}nd}|j||�}|jd||d�dS(Nuprofileiiucalli����(u	fake_codeucuruNoneu
fake_frameudispatch(uselfunameucodeupframeuframe((u,/opt/alt/python33/lib64/python3.3/profile.pyu
simulate_call[s	uProfile.simulate_callcCse|j}|�|j}x5|jdrP|jd||jd|�d}qW|�||_dS(Niureturniii����i����(uget_timeutucurudispatch(uselfuget_timeut((u,/opt/alt/python33/lib64/python3.3/profile.pyusimulate_cmd_completegs	
uProfile.simulate_cmd_completeicCs2ddl}|j|�j�j|�j�dS(Ni(upstatsuStatsu
strip_dirsu
sort_statsuprint_stats(uselfusortupstats((u,/opt/alt/python33/lib64/python3.3/profile.pyuprint_statsrsuProfile.print_statscCs:t|d�}|j�tj|j|�|j�dS(Nuwb(uopenucreate_statsumarshaludumpustatsuclose(uselfufileuf((u,/opt/alt/python33/lib64/python3.3/profile.pyu
dump_statsws
uProfile.dump_statscCs|j�|j�dS(N(usimulate_cmd_completeusnapshot_stats(uself((u,/opt/alt/python33/lib64/python3.3/profile.pyucreate_stats}s
uProfile.create_statsc	Cs�i|_x{|jj�D]j\}\}}}}}|j�}d}x|j�D]}||7}qSW|||||f|j|<qWdS(Ni(ustatsutimingsuitemsucopyuvalues(	uselfufuncuccunsuttuctucallersuncucallcnt((u,/opt/alt/python33/lib64/python3.3/profile.pyusnapshot_stats�s	+uProfile.snapshot_statscCs(ddl}|j}|j|||�S(Ni(u__main__u__dict__urunctx(uselfucmdu__main__udict((u,/opt/alt/python33/lib64/python3.3/profile.pyurun�s	uProfile.runcCsF|j|�tj|j�zt|||�Wdtjd�X|S(N(uset_cmdusysu
setprofileu
dispatcheruexecuNone(uselfucmduglobalsulocals((u,/opt/alt/python33/lib64/python3.3/profile.pyurunctx�s
uProfile.runctxcOsI|jt|��tj|j�z|||�SWdtjd�XdS(N(uset_cmdureprusysu
setprofileu
dispatcheruNone(uselfufuncuargsukw((u,/opt/alt/python33/lib64/python3.3/profile.pyuruncall�s
uProfile.runcallcCsU|jtk	rtd��n|j}d|_z|j||�SWd||_XdS(Nu&Subclasses must override .calibrate().i(u	__class__uProfileu	TypeErrorubiasu_calibrate_inner(uselfumuverboseu
saved_bias((u,/opt/alt/python33/lib64/python3.3/profile.pyu	calibrate�s		uProfile.calibratecCs�|j}dd�}|dd�}||�|�}||�|�}||}|rjtd|�nt�}	|�}|	jdt�t��|�}||}
|r�td|
�nd}d}xX|	jj�D]G\\}
}}\}}}}}|dkr�||7}||7}q�q�W|rHtd|�td|�n||d
krktd|��n||d|}|r�td|�n|S(NcSs!xt|�D]}d}q
WdS(Ni(urange(unuiux((u,/opt/alt/python33/lib64/python3.3/profile.pyuf1�su$Profile._calibrate_inner.<locals>.f1cSs%xt|�D]}|d�q
WdS(Nid(urange(umuf1ui((u,/opt/alt/python33/lib64/python3.3/profile.pyuf�su#Profile._calibrate_inner.<locals>.fu elapsed time without profiling =uf(m)uelapsed time with profiling =gufuf1u!'CPU seconds' profiler reported =utotal # calls =iu internal error: total calls = %dg@u+mean stopwatch overhead per profile event =(ufuf1(	uget_timeuprintuProfileurunctxuglobalsulocalsutimingsuitemsu
ValueError(uselfumuverboseuget_timeuf1ufut0ut1uelapsed_noprofileupuelapsed_profileutotal_callsu
reported_timeufilenameulineufuncnameuccunsuttuctucallersumean((u,/opt/alt/python33/lib64/python3.3/profile.pyu_calibrate_inner�sB	
	
	
			
1

uProfile._calibrate_innerNi����(u__name__u
__module__u__qualname__u__doc__ubiasuNoneu__init__utrace_dispatchutrace_dispatch_iutrace_dispatch_macutrace_dispatch_lutrace_dispatch_exceptionutrace_dispatch_callutrace_dispatch_c_callutrace_dispatch_returnudispatchuset_cmdu	fake_codeu
fake_frameu
simulate_callusimulate_cmd_completeuprint_statsu
dump_statsucreate_statsusnapshot_statsurunurunctxuruncallu	calibrateu_calibrate_inner(u
__locals__((u,/opt/alt/python33/lib64/python3.3/profile.pyuProfileVs@%'&




1cCsnd}td|�}d|_|jddddddd	d�|jd
ddddd
d	d�tjdd�s�|j�tjd�n|j	�\}}|tjdd�<t
|�dkr`|d}tjjdt
jj|��t|d��}t|j�|d�}WdQXi|d6dd6dd6dd6}t||d|j|j�n
|j�|S(Nu?profile.py [-o output_file_path] [-s sort] scriptfile [arg] ...uusageu-ou	--outfileudestuoutfileuhelpuSave stats to <outfile>udefaultu-su--sortusortu?Sort order when printing to stdout, based on pstats.Stats classiiiurbuexecu__file__u__main__u__name__u__package__u
__cached__Fi����(uOptionParseruFalseuallow_interspersed_argsu
add_optionuNoneusysuargvuprint_usageuexitu
parse_argsulenupathuinsertuosudirnameuopenucompileureadurunctxuoutfileusort(uusageuparseruoptionsuargsuprognameufpucodeuglobs((u,/opt/alt/python33/lib64/python3.3/profile.pyumains4	




umainu__main__(u__doc__usysuosutimeumarshaluoptparseuOptionParseru__all__uNoneurunurunctxuProfileumainu__name__(((u,/opt/alt/python33/lib64/python3.3/profile.pyu<module>	s��"