ok

Mini Shell

Direktori : /proc/thread-self/root/proc/thread-self/root/usr/lib64/python2.7/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/usr/lib64/python2.7/profile.pyo

�
]цdc@s$dZddlZddlZddlZddlZddlmZddddgZedd�Z	edd	�Z
d
�Zeed�r�ej
d�Znd
Zy+ddlZd�Zed�ZdZWnek
r�nXdfd��YZd�Zd�Zedkr e�ndS(s Class for profiling Python code.i����N(tOptionParsertruntrunctxthelptProfilecCs]t�}y|j|�}Wntk
r/nX|dk	rL|j|�n
|j|�SdS(sRun 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(RRt
SystemExittNonet
dump_statstprint_stats(t	statementtfilenametsorttprof((s/usr/lib64/python2.7/profile.pyR0s	
cCsct�}y|j|||�}Wntk
r5nX|dk	rR|j|�n
|j|�SdS(s�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(RRRRRR(R	tglobalstlocalsR
RR((s/usr/lib64/python2.7/profile.pyREs	
cCsdGHdGHdS(Ns2Documentation for the profile module can be found s?in the Python Library Reference, section 'The Python Profiler'.((((s/usr/lib64/python2.7/profile.pyRWsttimescCs|�}|d|dS(Nii((ttimertt((s/usr/lib64/python2.7/profile.pyt_get_time_times\s	icCstjtj�S(N(tresourcet	getrusagetRUSAGE_SELF(((s/usr/lib64/python2.7/profile.pyt<lambda>gscCs|�}|d|dS(Nii((RR((s/usr/lib64/python2.7/profile.pyt_get_time_resourcehs	icBs3eZdZdZd"d"d�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
ied6e
d6e
d
6ed6e
d6e
d6Zd�Zdd#d��YZdd$d��YZd�Zd�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zdd �Zd!�ZRS(%sProfiler 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.
    icCs�i|_d|_d|_d|_|dkr<|j}n||_|s�trrt|_|j	|_
t|_q�t
td�r�tj|_|_|j|_
q�t
td�r�tj|_|j	|_
t|_q�tj|_|_|j|_
n�||_|j�}yt|�}Wn&tk
rE||_|j|_
n@X|dkra|j	|_
n|j|_
|td�}||_|j�|_|jd�dS(NttclockRicSs
||��S(N((Rtsum((s/usr/lib64/python2.7/profile.pytget_time_timer�stprofiler(ttimingsRtcurtcmdtc_func_nametbiast_has_restresgetrusageRttrace_dispatcht
dispatcherRtget_timethasattrttimeRttrace_dispatch_itosRRtlent	TypeErrorttrace_dispatch_lRRt
simulate_call(tselfRR!RtlengthR((s/usr/lib64/python2.7/profile.pyt__init__�sF							
		cCs�|j}|�}|d|d|j|j}|dkrM|j|_n|j||||�r�|�}|d|d|_n"|�}|d|d||_dS(Niitc_call(RRR!t__name__R tdispatch(R/tframeteventtargRRtr((s/usr/lib64/python2.7/profile.pyR$�s		 		cCsw|j}|�|j|j}|dkr;|j|_n|j||||�rc|�|_n|�||_dS(NR2(RRR!R3R R4(R/R5R6R7RR((s/usr/lib64/python2.7/profile.pyR)�s	cCs�|j}|�d|j|j}|dkr?|j|_n|j||||�rk|�d|_n|�d||_dS(NgN@R2(RRR!R3R R4(R/R5R6R7RR((s/usr/lib64/python2.7/profile.pyttrace_dispatch_mac�s	cCsw|j}|�|j|j}|dkr;|j|_n|j||||�rc|�|_n|�||_dS(NR2(R&RR!R3R R4(R/R5R6R7R&R((s/usr/lib64/python2.7/profile.pyR-�s	c	Cs`|j\}}}}}}||k	r=|r=|j||�S|||||||f|_dS(Ni(Rttrace_dispatch_return(	R/R5Rtrpttrittrettrfntrframetrcur((s/usr/lib64/python2.7/profile.pyttrace_dispatch_exception
s
cCs|jrb|j|jdk	rb|j\}}}}}}t|tj�sb|j|d�qbn|j}	|	j|	j|	j	f}
|dd|
||jf|_|j
}|
|kr�||
\}}
}}}||
d|||f||
<nddddif||
<dS(Ni����ii(Rtf_backt
isinstanceRt
fake_frameR:tf_codetco_filenametco_firstlinenotco_nameR(R/R5RR;R<R=R>R?R@tfcodetfnRtcctnsttttcttcallers((s/usr/lib64/python2.7/profile.pyttrace_dispatch_calls		 c
Cs�dd|jf}|dd|||jf|_|j}||kr~||\}}}}}	||d|||	f||<nddddif||<dS(NRii(R RR(
R/R5RRJRRKRLRMRNRO((s/usr/lib64/python2.7/profile.pyttrace_dispatch_c_call+s	 cCs&||jdk	r-|j|jdd�n|j\}}}}}}||}||}|\}	}
}}}
}|	|
|||||
|f|_|j}||\}}}}}|s�||}|d}n||kr�||d||<n
d||<||d||||f||<dS(Ni����ii(RR:R(R/R5RR;R<R=R>R@tframe_totaltppttpittpettpfntpframetpcurRRKRLRMRNRO((s/usr/lib64/python2.7/profile.pyR:6s"

#	


!tcallt	exceptiontreturnR2tc_exceptiontc_returncCs+|jdrdS||_|j|�dS(Ni����(RRR.(R/R((s/usr/lib64/python2.7/profile.pytset_cmdls
	t	fake_codecBseZd�Zd�ZRS(cCs(||_||_||_d|_dS(Ni(RFtco_lineRHRG(R/R
tlinetname((s/usr/lib64/python2.7/profile.pyR1rs			cCst|j|j|jf�S(N(treprRFR`RH(R/((s/usr/lib64/python2.7/profile.pyt__repr__xs(R3t
__module__R1Rd(((s/usr/lib64/python2.7/profile.pyR_qs	RDcBseZd�ZRS(cCs||_||_dS(N(RERB(R/tcodetprior((s/usr/lib64/python2.7/profile.pyR1|s	(R3ReR1(((s/usr/lib64/python2.7/profile.pyRD{scCsa|jdd|�}|jr.|jd}nd}|j||�}|jd||d�dS(Ntprofileii����RY(R_RRRDR4(R/RbRfRWR5((s/usr/lib64/python2.7/profile.pyR.�s	cCse|j}|�|j}x5|jdrP|jd||jd|�d}qW|�||_dS(Ni����R[i����i(R&RRR4(R/R&R((s/usr/lib64/python2.7/profile.pytsimulate_cmd_complete�s	
i����cCs2ddl}|j|�j�j|�j�dS(Ni����(tpstatstStatst
strip_dirst
sort_statsR(R/RRj((s/usr/lib64/python2.7/profile.pyR�scCs:t|d�}|j�tj|j|�|j�dS(Ntwb(topentcreate_statstmarshaltdumptstatstclose(R/tfiletf((s/usr/lib64/python2.7/profile.pyR�s
cCs|j�|j�dS(N(Ritsnapshot_stats(R/((s/usr/lib64/python2.7/profile.pyRp�s
c	Cs�i|_x{|jj�D]j\}\}}}}}|j�}d}x|j�D]}||7}qSW|||||f|j|<qWdS(Ni(RsRt	iteritemstcopyt
itervalues(	R/tfuncRKRLRMRNROtnctcallcnt((s/usr/lib64/python2.7/profile.pyRw�s	+cCs(ddl}|j}|j|||�S(Ni����(t__main__t__dict__R(R/RR~tdict((s/usr/lib64/python2.7/profile.pyR�s	cBs@|j|�ej|j�z|||UWdejd�X|S(N(R^tsyst
setprofileR%R(R/RR
R((s/usr/lib64/python2.7/profile.pyR�s
cOsI|jt|��tj|j�z|||�SWdtjd�XdS(N(R^RcR�R�R%R(R/R{targstkw((s/usr/lib64/python2.7/profile.pytruncall�s
cCsU|jtk	rtd��n|j}d|_z|j||�SWd||_XdS(Ns&Subclasses must override .calibrate().i(t	__class__RR,R!t_calibrate_inner(R/tmtverboset
saved_bias((s/usr/lib64/python2.7/profile.pyt	calibrate�s		cCs}|j}d�}|d�}||�|�}||�|�}||}|r`dG|GHnt�}	|�}|	jdt�t��|�}||}
|r�dG|
GHnd}d}xX|	jj�D]G\\}
}}\}}}}}|dkr�||7}||7}q�q�W|r2d	G|GHd
G|GHn||dkrUtd|��n||d
|}|rydG|GHn|S(NcSs!xt|�D]}d}q
WdS(Ni(trange(tntitx((s/usr/lib64/python2.7/profile.pytf1scSs%xt|�D]}|d�q
WdS(Nid(R�(R�R�R�((s/usr/lib64/python2.7/profile.pyRvss elapsed time without profiling =sf(m)selapsed time with profiling =gRvR�s!'CPU seconds' profiler reported =stotal # calls =is internal error: total calls = %dg@s+mean stopwatch overhead per profile event =(Rvsf1(R&RRR
RRtitemst
ValueError(R/R�R�R&R�Rvtt0tt1telapsed_noprofiletptelapsed_profilettotal_callst
reported_timeR
RatfuncnameRKRLRMRNROtmean((s/usr/lib64/python2.7/profile.pyR��sB		
	
	
			
1
	N(((R3Ret__doc__R!RR1R$R)R9R-RARPRQR:R4R^R_RDR.RiRRRpRwRRR�R�R�(((s/usr/lib64/python2.7/profile.pyRos@%3								&

	
					
		
	1cGs	dGHdS(Ns7Report generating functions are in the "pstats" module((R�((s/usr/lib64/python2.7/profile.pyRk=sc	CsXd}td|�}t|_|jddddddd	d�|jd
ddddd
d	d�tjds�|j�tjd�n|j	�\}}|tj(t
|�dkrJ|d}tjjdt
jj|��t|d��}t|j�|d�}WdQXi|d6dd6dd6}t||d|j|j�n
|j�|S(Ns?profile.py [-o output_file_path] [-s sort] scriptfile [arg] ...tusages-os	--outfiletdesttoutfileRsSave stats to <outfile>tdefaults-ss--sortRs?Sort order when printing to stdout, based on pstats.Stats classi����iiitrbtexect__file__R~R3t__package__(RtFalsetallow_interspersed_argst
add_optionRR�targvtprint_usagetexitt
parse_argsR+tpathtinsertR*tdirnameRotcompiletreadRR�R(R�tparsertoptionsR�tprognametfpRftglobs((s/usr/lib64/python2.7/profile.pytmain@s2	






R~(R�R�R*R(RqtoptparseRt__all__RRRRR'RRR"RR#RtImportErrorRRkR�R3(((s/usr/lib64/python2.7/profile.pyt<module>	s2		

��		!

Zerion Mini Shell 1.0