QfBZ ddlZddlZddlZddlZddlZgdZGddZd dZd dZ GddZ d Z e d k(re yy) N)runrunctxProfilec&eZdZ dZdZdZdZy)_Utilsc||_yN)profiler)selfr s ./opt/alt/python312/lib64/python3.12/profile.py__init__z_Utils.__init__1s   c|j} |j||j|||y#t$rYwxYw#|j|||wxYwr )r r SystemExit_show)r statementfilenamesortprofs r rz _Utils.run4sW}} - HHY  JJtXt ,    JJtXt ,s!7 AAAAAc|j} |j||||j|||y#t$rYwxYw#|j|||wxYwr )r rrr)r rglobalslocalsrrrs r rz _Utils.runctx=s[}} - KK 7F 3 JJtXt ,    JJtXt ,s!9 AAAAAcN||j|y|j|yr ) dump_stats print_stats)r rrrs r rz _Utils._showFs"   OOH %   T "rN)__name__ __module__ __qualname__r rrrrr rr+s !--#rrcD ttj|||Sr )rrr)rrrs r rrRs"  '?  y(D 99rcH ttj|||||Sr )rrr)rrrrrs r rr_s& '? ! !)Wfh MMrceZdZ dZddZdZdZdZdZdZ d Z d Z d Z e e e e e e d Z d ZGddZGddZdZdZddZdZdZdZdZdZdZddZdZy) rrNci|_d|_d|_d|_| |j}||_|s.t j x|_|_|j|_ n\||_|j} t|}|dk(r|j|_ n|j|_ |tfd}||_|j|_|j#dy#t$r||_|j|_ YJwxYw)Nc||Sr r)timersums r get_time_timerz(Profile.__init__..get_time_timersuw<'rr )timingscurcmd c_func_namebiastime process_timer'get_timetrace_dispatch_i dispatcherlentrace_dispatchtrace_dispatch_lr( TypeErrort simulate_call)r r'r.r8lengthr)s r r zProfile.__init__s  <99D )-):): :DJ"33DODJ A /Q Q;&*&9&9DO&*&;&;DO */C( .  :&# 8 % "&"7"7 8s: C%%!D D c2|j}|}|d|dz|jz |jz }|dk(r|j|_|j ||||r|}|d|dz|_y|}|d|dz|z |_y)Nrc_callr'r8r.rr-dispatch)r frameeventargr'r8rs r r5zProfile.trace_dispatchs  G aD1Q4K$&& 499 , H "||D  4== eA .AqTAaD[DFAqTAaD[1_DFrc|j}||jz |jz }|dk(r|j|_|j ||||r ||_y||z |_yNr=r>r r@rArBr'r8s r r2zProfile.trace_dispatch_ise  Gdff tyy ( H "||D  4== eQ /WDFWq[DFrc|j}|dz |jz |jz }|dk(r|j|_|j ||||r|dz |_y|dz |z |_y)NgN@r=r>rFs r trace_dispatch_maczProfile.trace_dispatch_macsr  GDL466 !DII - H "||D  4== eQ /WT\DFWT\A%DFrc|j}||jz |jz }|dk(r|j|_|j ||||r ||_y||z |_yrE)r1r8r.rr-r?)r r@rArBr1r8s r r6zProfile.trace_dispatch_lse== J $)) + H "||D  4== eQ /ZDFZ!^DFrcz|j\}}}}}}||ur|r|j||S|||z||||f|_yNr<)r+trace_dispatch_return) r r@r8rptritretrfnrframercurs r trace_dispatch_exceptionz Profile.trace_dispatch_exceptionsP+/88(S#sFD % T--fa8 8AsC5rc|jrZ|j|jdur?|j\}}}}}}t|tjs|j |d|j } | j| j| jf} |dd| ||jf|_|j} | | vr| | \} } }}}| | dz|||f| | <yddddif| | <yNrr<) r+f_back isinstancer fake_framerLf_code co_filenameco_firstlinenoco_namer*)r r@r8rMrNrOrPrQrRfcodefnr*ccnsttctcallerss r trace_dispatch_callzProfile.trace_dispatch_calls 88 DHHRL8/3xx ,Cc3fg&8&89**615 !5!5u}} Eq!R1,, =&-bk #BBGb1fb"g5GBKQ1b.GBKrcdd|jf}|dd|||jf|_|j}||vr||\}}}}} ||dz||| f||<yddddif||<y)Nr$rr<)r-r+r*) r r@r8r_r*r`rarbrcrds r trace_dispatch_c_callzProfile.trace_dispatch_c_calls!T%% &q!R1,, =&-bk #BBGbdBG3GBKQ1b.GBKrcf||jdur|j|jdd|j\}}}}}}||z}||z}|\} } } } } }| | |z| |z| | |f|_|j}||\}}}}}|s ||z}|dz}| |vr || dz|| <nd|| <||dz ||z||f||<yrU)r+rLr*)r r@r8rMrNrOrPrR frame_totalpptpitpetpfnpframepcurr*r`rarbrcrds r rLzProfile.trace_dispatch_return#s  $  & &txx|Q 7 +/(('S#sE4AgCi +/(S#sFDc 3#4c64G,,")#,BB k!BaB '>"3>+g ,!2r2w6DJJt  0DrcHddl}|j}|j|||Sr|)__main____dict__r)r r,rdicts r rz Profile.runs#  {{3d++rc|j|tj|j t |||tjd|S#tjdwxYwr )rxsys setprofiler3exec)r r,rrs r rzProfile.runctxsP S t' ! gv & NN4   NN4 s AA-c|jt|tj|j ||i|tjdS#tjdwxYwr )rxrrrr3)r rargskws r runcallzProfile.runcallsM T$Z  t' !$$ NN4 CNN4 s AA/c|jtur td|j}d|_ |j ||||_S#||_wxYw)Nz&Subclasses must override .calibrate().r) __class__rr7r._calibrate_inner)r mverbose saved_biass r calibratezProfile.calibratesN >> (DE EYY   #((G4"DI DIs A Ac<|j}d}|fd}|||}|||}||z }|r td|t} |}| jdt t |}||z } |r td| d} d} | j jD]\\} }}\}}}}}|dvs| |z } | |z } |rtd| td | | |d zk7rtd | z| |z d z | z }|r td ||S)Nc(t|D]}d}yrKrange)nixs r f1z$Profile._calibrate_inner..f1s1Xrc4t|D] }|d y)Ndr)rrrs r rz#Profile._calibrate_inner..fs1X3rz elapsed time without profiling =zf(m)zelapsed time with profiling =g)rrz!'CPU seconds' profiler reported =ztotal # calls =r<z internal error: total calls = %dg@z+mean stopwatch overhead per profile event =) r1printrrrrr*r ValueError)r rrr1rrt0t1elapsed_noprofilepelapsed_profile total_calls reported_timerr~funcnamer`rarbrcrdmeans r rzProfile._calibrate_innersN==   !Z ! ZG  46G H I Z FH- Zr'  1? C   ! B &XtX(ARR;&r! # "  5} E #[ 1 !a% ?+MN N  11S8;F  ? F r)NN)rw)r)rrrr.r r5r2rHr6rSrergrLr?rxrrYr9rrrrrrrrrrrrr rrhs$L D#'N %$ ! & $&, #N$-'',)  H  HH  .  ( 7, !b #<rrcddl}ddlm}d}||}d|_|j dddd d |j d d d dd|j ddddd t j dds%|jt jd|j\}}|t j dd|j*|jj|j|_ t|dkDr|jrddl}d}|j |dd}n|d} t jj#d|jj%| t'j(| 5} t+| j-| d}dddt.j0j3dd| } | | j4| j6ddd} t9|d|j|j:|S|j|S#1swYxYw#t<$r5} dt _t j| j@Yd} ~ |Sd} ~ wwxYw)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 classrwr<r%z(run_module(modname, run_name='__main__')) run_modulemodnamerr)rloaderorigin)__spec____file__r __package__ __cached__)!osoptparserallow_interspersed_args add_optionrargv print_usageexit parse_argsrpathabspathr4rrunpyrinsertdirnameio open_codecompileread importlib machinery ModuleSpecrrrrBrokenPipeErrorstdouterrno) rrrparseroptionsrrrglobsprognamefpspecexcs r mainr*s % [E  &F%*F" dKi &6 d, (%9 dH6 N 88AB<  '')OWdCHHQK"''//'//: 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)*IIrrv) importlib.machineryrrrr/r__all__rrrrrrrrr rs]'$  &##N :N~~D9x zFr