Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/cProfile.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^c@s�dZddddgZddlZddd�Zddd�Zd	�Zdejfd
��YZd�Z	d�Z
ed
kr�e
�ndS(sUPython interface for the 'lsprof' profiler.
   Compatible with the 'profile' module.
truntrunctxthelptProfilei�NcCsmt�}d}z+y|j|�}Wntk
r8nXWd|dk	rY|j|�n|j|�}X|S(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(RtNoneRt
SystemExitt
dump_statstprint_stats(t	statementtfilenametsorttproftresult((s/sys/lib/python2.7/cProfile.pyRs	
cCsst�}d}z1y|j|||�}Wntk
r>nXWd|dk	r_|j|�n|j|�}X|S(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(RtglobalstlocalsR	R
RR((s/sys/lib/python2.7/cProfile.pyR's	
cCsdGHdGHdS(Ns<Documentation for the profile/cProfile modules can be found s?in the Python Library Reference, section 'The Python Profiler'.((((s/sys/lib/python2.7/cProfile.pyR<scBsPeZdZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(	siProfile(custom_timer=None, time_unit=None, subcalls=True, builtins=True)

    Builds a profiler object using the specified timer function.
    The default timer is a fast built-in one based on real time.
    For custom timer functions returning integers, time_unit can
    be a float specifying a scale (i.e. how long each integer unit
    is, in seconds).
    i�cCs2ddl}|j|�j�j|�j�dS(Ni�(tpstatstStatst
strip_dirst
sort_statsR(tselfR
R((s/sys/lib/python2.7/cProfile.pyROscCsFddl}t|d�}|j�|j|j|�|j�dS(Ni�twb(tmarshaltopentcreate_statstdumptstatstclose(RtfileRtf((s/sys/lib/python2.7/cProfile.pyRSs

cCs|j�|j�dS(N(tdisabletsnapshot_stats(R((s/sys/lib/python2.7/cProfile.pyRZs
cCs�|j�}i|_i}xz|D]r}t|j�}|j}||j}|j}|j}i}	|	|t|j�<|||||	f|j|<q"Wx�D]�|j	r�t|j�}x�|j	D]�}
y|t|
j�}	Wnt
k
r�q�nX|
j}||
j}|
j}|
j}||	krt|	|}||d7}||d7}||d7}||d7}n||||f|	|<q�Wq�q�WdS(Niiii(tgetstatsRtlabeltcodet	callcounttreccallcountt
inlinetimet	totaltimetidtcallstKeyError(Rtentriestcallersdictstentrytfunctnctccttttcttcallerstsubentrytprev((s/sys/lib/python2.7/cProfile.pyR^s>	
	
		 
	
	
		
cCs(ddl}|j}|j|||�S(Ni�(t__main__t__dict__R(RtcmdR4tdict((s/sys/lib/python2.7/cProfile.pyR�s	cBs*|j�z|||UWd|j�X|S(N(tenableR(RR6R
R((s/sys/lib/python2.7/cProfile.pyR�s

cOs-|j�z|||�SWd|j�XdS(N(R8R(RR,targstkw((s/sys/lib/python2.7/cProfile.pytruncall�s
(
t__name__t
__module__t__doc__RRRRRRR;(((s/sys/lib/python2.7/cProfile.pyRBs			&			cCs6t|t�rdd|fS|j|j|jfSdS(Nt~i(t
isinstancetstrtco_filenametco_firstlinenotco_name(R!((s/sys/lib/python2.7/cProfile.pyR �s
c	Cs�ddl}ddl}ddlm}d}|d|�}t|_|jddddd	d
dd�|jdd
ddd	ddd�|jds�|j	�|j
d�n|j�\}}||j(t|�dkrr|d}|j
jd|j
j|��t|d��}t|j�|d�}	WdQXi|d6dd6dd6}
t|	|
d|j|j�n
|j	�|S(Ni�(tOptionParsers@cProfile.py [-o output_file_path] [-s sort] scriptfile [arg] ...tusages-os	--outfiletdesttoutfileRsSave stats to <outfile>tdefaults-ss--sortR
s?Sort order when printing to stdout, based on pstats.Stats classiiitrbtexect__file__R4R<t__package__(tostsystoptparseREtFalsetallow_interspersed_argst
add_optionRtargvtprint_usagetexitt
parse_argstlentpathtinserttdirnameRtcompiletreadRRHR
(RNRORERFtparsertoptionsR9tprognametfpR!tglobs((s/sys/lib/python2.7/cProfile.pytmain�s6	






R4(R>t__all__t_lsprofRRRRtProfilerRR RcR<(((s/sys/lib/python2.7/cProfile.pyt<module>s	Y		#

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.