zfc@sdZddddgZddlZdddZdddZd Zdejfd YZd Z d Z e d kre ndS(sUPython interface for the 'lsprof' profiler. Compatible with the 'profile' module. truntrunctxthelptProfileiNcCsmt}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_statst print_stats(t statementtfilenametsorttproftresult((s /usr/lib64/python2.7/cProfile.pyRs   cCsst}d}z1y|j|||}Wntk r>nXWd|dk r_|j|n|j|}X|S(sRun 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 R R ((s /usr/lib64/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 /usr/lib64/python2.7/cProfile.pyR<scBsPeZdZddZdZdZdZdZdZdZ RS( s`Profile(timer=None, timeunit=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, timeunit can be a float specifying a scale (i.e. how long each integer unit is, in seconds). icCs2ddl}|j|jj|jdS(Ni(tpstatstStatst strip_dirst sort_statsR(tselfR R((s /usr/lib64/python2.7/cProfile.pyROs cCsFddl}t|d}|j|j|j||jdS(Nitwb(tmarshaltopent create_statstdumptstatstclose(RtfileRtf((s /usr/lib64/python2.7/cProfile.pyRSs   cCs|j|jdS(N(tdisabletsnapshot_stats(R((s /usr/lib64/python2.7/cProfile.pyRZs c Cs|j}i|_i}xz|D]r}t|j}|j}||j}|j}|j}i} | |t|j<||||| f|j|                 cCs(ddl}|j}|j|||S(Ni(t__main__t__dict__R(RtcmdR4tdict((s /usr/lib64/python2.7/cProfile.pyRs  cBs*|jz|||UWd|jX|S(N(tenableR(RR6R R((s /usr/lib64/python2.7/cProfile.pyRs   cOs-|jz|||SWd|jXdS(N(R8R(RR,targstkw((s /usr/lib64/python2.7/cProfile.pytruncalls ( t__name__t __module__t__doc__RRRRRRR;(((s /usr/lib64/python2.7/cProfile.pyRBs    &  cCs6t|trdd|fS|j|j|jfSdS(Nt~i(t isinstancetstrt co_filenametco_firstlinenotco_name(R!((s /usr/lib64/python2.7/cProfile.pyR s c Csddl}ddl}ddl}ddlm}d}|d|}t|_|jddddd d d d|jd d ddd dd ddt |j j |j ds|j |jdn|j\}}||j (t|dkr|d}|jjd|jj|t|d} t| j|d} WdQXi|d6dd6dd6} t| | d|j|jn |j |S(Ni(t OptionParsers@cProfile.py [-o output_file_path] [-s sort] scriptfile [arg] ...tusages-os --outfiletdesttoutfileRsSave stats to tdefaults-ss--sortR s?Sort order when printing to stdout, based on pstats.Stats classtchoicesiiitrbtexect__file__R4R<t __package__(tostsysRtoptparseREtFalsetallow_interspersed_argst add_optionRtsortedRtsort_arg_dict_defaulttargvt print_usagetexitt parse_argstlentpathtinserttdirnameRtcompiletreadRRHR ( RORPRRERFtparsertoptionsR9tprognametfpR!tglobs((s /usr/lib64/python2.7/cProfile.pytmains8$        R4( R>t__all__t_lsprofRRRRtProfilerRR RfR<(((s /usr/lib64/python2.7/cProfile.pyts  Y  $