edZSrSSKrSSKrSSKrSSKrSSKr/SQr"SS5rS Sjr S Sjr "SS 5r S r \ S :Xa\ "5 gg) z Class for profiling Python code.N)runrunctxProfilec0\rSrSrSrSrSrSrSrSr g) _Utils+z~Support class for utility functions which are shared by profile.py and cProfile.py modules. Not supposed to be used directly. cXlgNprofiler)selfr s -/opt/imh/python3.13/lib/python3.13/profile.py__init___Utils.__init__1s cUR5nURU5 URXBU5 g![a Nf=f!URXBU5 f=fr )r r SystemExit_show)r statementfilenamesortprofs rr _Utils.run4sS}} - HHY  JJtt ,    JJtt ,s!6 AAAAAcUR5nURXU5 URXdU5 g![a Nf=f!URXdU5 f=fr )r rrr)r rglobalslocalsrrrs rr _Utils.runctx=sU}} - KK F 3 JJtt ,    JJtt ,s!7 AAAAAcPUbURU5 gURU5 gr ) dump_stats print_stats)r rrrs rr _Utils._showFs"   OOH %   T "rr N) __name__ __module__ __qualname____firstlineno____doc__rrrr__static_attributes__rrrr+s !--#rrc@[[5RXU5$)aRun 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. )rrr)rrrs rrrRs '?  yD 99rcB[[5RXX#U5$)zRun statement under profiler, supplying your own globals and locals, optionally saving results in filename. statement and filename have the same semantics as profile.run )rrr)rrrrrs rrr_s '? ! !)f MMrc\rSrSrSrSrS SjrSrSrSr S r S r S r S r S r\ \ \\ \\S.rSr"SS5r"SS5rSrSrS!SjrSrSrSrSrSrSrS"SjrSrSrg)#rhaProfiler 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. rNc"0UlSUlSUlSUlUc URnX lU(d.[ R =UlUlURUl O\XlUR5n[U5nUS:XaURUl OURUl U[4SjnXPlUR5UlUR#S5 g![a XlURUl NJf=f)NcU"U"55$r r()timersums rget_time_timer(Profile.__init__..get_time_timersuw<'rr )timingscurcmd c_func_namebiastime process_timer1get_timetrace_dispatch_i dispatcherlentrace_dispatchtrace_dispatch_lr2 TypeErrort simulate_call)r r1r9rClengthr3s rrProfile.__init__s  <99D )-):): :DJ"33DOJ A /Q Q;&*&9&9DO&*&;&;DO */C( .  :&# 8 % "&"7"7 8s> C**!D Dc<URnU"5nUSUS-UR- UR- nUS:XaURUlUR U"XU5(aU"5nUSUS-UlgU"5nUSUS-U- Ulg)Nrc_callr1rCr9r"r8dispatch)r frameeventargr1rCrs rr@Profile.trace_dispatchs  G aD1Q4K$&& 499 , H "||D  == A . .AqTAaD[DFAqTAaD[1_DFrcURnU"5UR- UR- nUS:XaURUlUR U"XU5(a U"5UlgU"5U- UlgNrIrJr rLrMrNr1rCs rr=Profile.trace_dispatch_isd  Gdff tyy ( H "||D  == Q / /WDFWq[DFrc URnU"5S- UR- UR- nUS:XaURUlUR U"XU5(aU"5S- UlgU"5S- U- Ulg)NgN@rIrJrSs rtrace_dispatch_macProfile.trace_dispatch_macsq  GDL466 !DII - H "||D  == Q / /WT\DFWT\A%DFrcURnU"5UR- UR- nUS:XaURUlUR U"XU5(a U"5UlgU"5U- UlgrR)r<rCr9r"r8rK)r rLrMrNr<rCs rrAProfile.trace_dispatch_lsd== J $)) + H "||D  == Q / /ZDFZ!^DFrcvURup4pVpxXqLaU(aURXr5$X4U-XVXx4UlgNrH)r6trace_dispatch_return) r rLrCrptritretrfnrframercurs rtrace_dispatch_exception Profile.trace_dispatch_exceptions@+/88(#F  T--f8 8As5rcUR(aURURSLaURup4pVpx[U[R5(dURURLdSUXwRXR45eUR US5 URb2URURSLdSURS45eUR n U RU RU R4n USSXUR4UlURn X;aXuppnXS-XU4X'gSSSS04X'g)NzBad callrrH) r6f_back isinstancer fake_framer\f_code co_filenameco_firstlinenoco_namer5)r rLrCr]r^r_r`rarbfcodefnr5ccnsttctcallerss rtrace_dispatch_callProfile.trace_dispatch_callsQ 88 DHHRL8/3xx ,Ccfg&8&899}} 4Lz37=}}7"3>+ ,!rw6DJJt  0DrcFSSKnURnURXU5$r)__main____dict__r)r r7rdicts rr Profile.runs!  {{3d++rcURU5 [R"UR5 [ XU5 [R"S5 U$![R"S5 f=fr )rsys setprofiler>exec)r r7rrs rrProfile.runctxsN S t' ! v & NN4   NN4 s AA/cUR[U55 [R"UR5 U"U0UD6[R"S5 $![R"S5 f=fr )rrrrr>)r rargskws rruncallProfile.runcallsM T$Z  t' !$$ NN4 CNN4 s AA2cUR[La [S5eURnSUlUR X5X0l$!X0lf=f)Nz&Subclasses must override .calibrate().r) __class__rrBr9_calibrate_inner)r mverbose saved_biass r calibrateProfile.calibratesH >> (DE EYY   #((4"I Is A AchURnSnU4SjnU"U5 U"5nU"U5 U"5nXv- nU(a [SU5 [5n U"5nU RS[ 5[ 55 U"5nXv- n U(a [SU 5 Sn Sn U R R5H!uupnunnnnnUS;dMU U- n U U- n M# U(a[SU 5 [S U 5 XS -:wa[S U -5eX- S - U - nU(a [S U5 U$)Nc,[U5HnSnM gr[range)nixs rf1$Profile._calibrate_inner..f1s1Xrc8[U5H nU"S5 M g)Ndr)rrrs rr#Profile._calibrate_inner..fs1X3rz elapsed time without profiling =zf(m)zelapsed time with profiling =g)rrz!'CPU seconds' profiler reported =ztotal # calls =rHz internal error: total calls = %dg@z+mean stopwatch overhead per profile event =) r<printrrrrr5r ValueError)r rrr<rrt0t1elapsed_noprofilepelapsed_profile total_calls reported_timerrfuncnamerqrrrsrtrumeans rrProfile._calibrate_innersC==   !Z ! ZG  46G H I Z FH- Z'  1? C   ! B &XX(ARR;&r! # "  5} E #[ 1 a% ?+MN N 1S8;F  ? F r) r9r8r7r6r>r<rrCr1r5)NN)r)r)r"r#r$r%r&r9rr@r=rVrArcrvryr\rKrrrjrDrr rrrrrrrrr'r(rrrrhs$L D#'N %$ ! & $&, #N$-'',)  H  HH  . H ( 7, !b #<rrcSSKnSSKJn SnU"US9nSUlUR SSSS SS 9 UR S S S SSS9 UR SSSSSS 9 [ R SS(d&UR5 [ R"S5 UR5upEU[ R SS&URb*URRUR5Ul [U5S:GaUR(aSSKnSnUR USS.nOUSn [ RR#SURR%U 55 [&R("U 5n [+U R-5U S5nSSS5 [.R0R3SSU S9n U U R4U R6SSS.n[9WUSURUR:5 U$UR5 U$!,(df  N=f![<a6n S[ l[ R"U R@5 Sn A U$Sn A ff=f)Nr) OptionParserzMprofile.py [-o output_file_path] [-s sort] [-m module | scriptfile] [arg] ...)usageFz-oz --outfileoutfilezSave stats to )desthelpdefaultz-mmodule store_truezProfile a library module.)ractionrrz-sz--sortrz?Sort order when printing to stdout, based on pstats.Stats classrrHr/z(run_module(modname, run_name='__main__')) run_modulemodnamerr)rloaderorigin)__spec____file__r" __package__ __cached__)!osoptparserallow_interspersed_args add_optionrargv print_usageexit parse_argsrpathabspathr?rrunpyrinsertdirnameio open_codecompileread importlib machinery ModuleSpecrrrrBrokenPipeErrorstdouterrno) rrrparseroptionsrrrglobsprognamefpspecexcs rmainr#+s % [E  &F%*F" dKi &6 d, (%9 dH6 N 88AB<  '')OWCHHQK"''//'//: 4y1} >> =D#..7E AwH HHOOArwwx8 9h'2rwwy(F;(&&11z$9A2CD! KK II#" E 4goow|| D M  M'(' CJ HHSYY   M  s$;H#H# H # I#-+II#rr)r&importlib.machineryrrrr:r__all__rrrrr#r"r(rrr&s]'$  &##N :NF9x zFr