mň %U˛Ic @sdZdkZdkZdkZdkZdklZddddgZedd„Z ed „Z d „Z ei d jodk Z e id „Zneed ƒoeid„Zndfd„ƒYZd„Zedjo+dZeid odGeGHeidƒndefd„ƒYZeeƒZee_eidddddddeƒeidddd dd!ddƒeiƒ\ZZ e ei(e!eiƒd"joNei"i#d"ei"i$eid"ƒƒe d#eid"fei%ei&ƒn dGeGHndS($s Class for profiling Python code.N(s OptionParsertruntrunctxthelptProfilei˙˙˙˙cCsatƒ}y|i|ƒ}Wntj onX|dj o|i|ƒn|i|ƒ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( RtprofRt statementt SystemExittfilenametNonet dump_statst print_statstsort(RRR R((t$/data/zmath/lib/python2.4/profile.pyR;s   cCsdtƒ}y|i|||ƒ}Wntj onX|dj o|i |ƒn |i ƒ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( RRRRtglobalstlocalsRRRR R (RR RRR((R RPs  cCsuxntiD]Z}tii|dƒ}tii|ƒo,tid|ƒ}|o dG|GHnPq q WdGdGHdS(Ns profile.docs${PAGER-more} s*** Pager exit status:s-Sorry, can't find the help file "profile.doc"salong the Python search path.( tsystpathtdirnametostjointfullnametexiststsystemtsts(RRR((R Rbs   tmaccCs |ƒdS(Nf60.0(ttimer(R((R t _get_time_macpsttimescCs|ƒ}|d|dS(Nii(Rtt(RR((R t_get_time_timests cBs?tZdZdZeed„Zd„Zd„Zd„Zd„Z d„Z d„Z d „Z d „Z hd e <d e <d e <de <de <de R:R;RR?R((R R2Ős      cCs{|i}|ƒ|i|i}|djo|i|_n|i||||ƒo|ƒ|_n|ƒ||_dS(NR9( R#RRR(R:R;R<R'R=R>(R#R>R:R;RR((R R1çs  cCs‡|i}|ƒd|i|i}|djo|i|_n|i||||ƒo|ƒd|_n|ƒd||_dS(Nf60.0R9( R#RRR(R:R;R<R'R=R>(R#R>R:R;RR((R R,ös  cCs{|i}|ƒ|i|i}|djo|i|_n|i||||ƒo|ƒ|_n|ƒ||_dS(NR9( R#R.RR(R:R;R<R'R=R>(R#R>R:R;RR.((R R6s  c Csf|i\}}}}}}||j o|o|i ||ƒSn|||||||f|_dS(Ni( R#R%trpttrittrettrfntrframetrcurR>ttrace_dispatch_returnR( R#R>RR@RERDRBRCRA((R ttrace_dispatch_exceptions cCs|io]|i|idj oF|i\}}}}}}t |t i ƒp|i |dƒqgn|i} | i| i| if}|dd|||if|_|i} || jo:| |\} }} }} | |d| || f| |tf_backR@RARBRCRDREt isinstanceRt fake_frameRFtf_codetfcodet co_filenametco_firstlinenotco_nametfnRR$tcctnsttttcttcallers(R#R>RRRR@RERDRBRCRLR$RURSRQRPRART((R ttrace_dispatch_calls!   !c Cs dd|if}|dd|||if|_|i}|i|ƒo:||\}}}} }||d|| |f||R%R$thas_keyRQRRRSRTRU( R#R>RRQR$RURSRRRPRT((R ttrace_dispatch_c_call5s !cCs,||idj o|i|iddƒn|i\}}}} }}||}||}|\}}} }}} |||| |||| f|_|i} | | \}}} }}|p||}|d}n||jo||d||R#R%RFR@RARBRCRERt frame_totaltppttpittpettpfntpframetpcurR$RQRRRSRTRU(R#R>RRURYR@RERRRBRCR$R\R_RSRQRZR^R]R[RART((R RF@s$  #    !tcallt exceptiontreturnR9t c_exceptiontc_returncCs0|idodSn||_|i|ƒdS(Ni˙˙˙˙(R#R%R&R7(R#R&((R tset_cmdvs t fake_codecBstZd„Zd„ZRS(NcCs(||_||_||_d|_dS(Ni(RR#RMtlinetco_lineR)RORN(R#RRgR)((R R8|s   cCst|i|i|ifƒS(N(treprR#RMRhRO(R#((R t__repr__‚s(R<t __module__R8Rj(((R Rf{s RJcBstZd„ZRS(NcCs||_||_dS(N(tcodeR#RKtpriorRH(R#RlRm((R R8†s (R<RkR8(((R RJ…scCsc|idd|ƒ}|io|id}nd}|i||ƒ}|i d||dƒdS(Ntprofileiiţ˙˙˙R`( R#RfR)RlR%R^RRJR>R=(R#R)RlR^R>((R R7Šs  cCsg|i}|ƒ|i}x7|ido(|id||id|ƒd}qW|ƒ||_dS(Ni˙˙˙˙Rbiţ˙˙˙i(R#R.RR%R=(R#R.R((R tsimulate_cmd_complete–s  i˙˙˙˙cCs/dk}|i|ƒiƒi|ƒiƒdS(N(tpstatstStatsR#t strip_dirst sort_statsR R (R#R Rp((R R Ąs cCs:t|dƒ}|iƒti|i|ƒ|iƒdS(Ntwb( topentfiletfR#t create_statstmarshaltdumptstatstclose(R#RvRw((R R Śs cCs|iƒ|iƒdS(N(R#Rotsnapshot_stats(R#((R RxŹs c Cs‹h|_x{|iiƒD]j\}\}}}}}|i ƒ}d}x|i ƒD]}||7}qSW|||||f|i|tdefaults-ss--sortR s?Sort order when printing to stdout, based on pstats.Stats classis execfile(%r)('RĄRRR0RytoptparseRŁt__all__RRRRR)R*R+RR/RRRRqR<R¤targvtexitR˘tparsertFalsetallow_interspersed_argst add_optiont parse_argstoptionsRˆR3RtinsertRRŚR (R*R˘RqRRŹRRŠRR¤RRŁRRˆRRRyR0RRą((R t? sF        ˙Ď      &(