+
    :i24                         ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt  ! R R4      t ! R	 R
4      t]! R. RO4      tR t ! R R4      t]! RRR.4      t ! R R]4      tR# )    N)
namedtuple)Sequence)contextmanager)cached_property)configc                   <   a  ] tR t^t o RtR.tR tR tR tRt	V t
R# )RecordLLVMPassTimingsLegacy9A helper context manager to track LLVM pass timings.
    _datac                2    \         P                  ! R4       V # ))Enables the pass timing in LLVM.
        T)llvmset_time_passesselfs   &Z/var/www/html/photoedit/myenv/lib/python3.14/site-packages/numba/misc/llvm_pass_timings.py	__enter__%RecordLLVMPassTimingsLegacy.__enter__   s     	T"    c                f    \         P                  ! 4       V n        \         P                  ! R4       R# )2Reset timings and save report internally.
        FN)r   report_and_reset_timingsr   r   r   exc_valexc_typeexc_tbs   &&&&r   __exit__$RecordLLVMPassTimingsLegacy.__exit__   s%     224
U#r   c                ,    \        V P                  4      # zTRetrieve timing data for processing.

Returns
-------
timings: ProcessedPassTimings
ProcessedPassTimingsr   r   s   &r   getRecordLLVMPassTimingsLegacy.get!        $DJJ//r   )r   N)__name__
__module____qualname____firstlineno____doc__	__slots__r   r   r#   __static_attributes____classdictcell____classdict__s   @r   r	   r	      s'      	I0 0r   r	   c                   D   a  ] tR t^+t o RtRR.tR tR tR tR t	Rt
V tR	# )
RecordLLVMPassTimingsr
   r   _pbc                     Wn         R V n        R # N)r2   r   )r   pbs   &&r   __init__RecordLLVMPassTimings.__init__1   s    
r   c                :    V P                   P                  4        V # )r   )r2   start_pass_timingr   s   &r   r   RecordLLVMPassTimings.__enter__5   s     	""$r   c                D    V P                   P                  4       V n        R# )r   N)r2   finish_pass_timingr   r   s   &&&&r   r   RecordLLVMPassTimings.__exit__;   s     XX002
r   c                ,    \        V P                  4      # r    r!   r   s   &r   r#   RecordLLVMPassTimings.getA   r%   r   )r   r2   N)r&   r'   r(   r)   r*   r+   r6   r   r   r#   r,   r-   r.   s   @r   r1   r1   +   s/      % I0 0r   r1   PassTimingRecordc                   aa V R,          oSP                   R8X  g   Q hV3R lpR Uu. uF
  q!! V4      NK  	  upo\        R V 4      pV3R lp\        \        WC4      4      # u upi )zAdjust timing records because of truncated information.

Details: The percent information can be used to improve the timing
information.

Returns
-------
res: List[PassTimingRecord]
Totalc                 `   <aaa V  R 2oV  R2o\         P                  ! S4      oVVVV3R lpV# )_time_percentc                L   < S! S4      pWS,          ,          R,          pW S&   V # )z'Compute percent x total_time = adjustedg{Gz? )dtotaladjustedpercent_attr	time_attrtime_getter	total_recs   &  r   adjust6_adjust_timings.<locals>.make_adjuster.<locals>.adjustn   s*    	*E.5H#iLHr   )operator
attrgetter)attrrO   rK   rL   rM   rN   s   & @@@r   make_adjuster&_adjust_timings.<locals>.make_adjusteri   s;    fEN	x()))4	 	 r   c                 "    V P                  4       # r4   )_asdictxs   &r   <lambda>!_adjust_timings.<locals>.<lambda>}   s
    !))+r   c                 <   < S F  pV! V 4      p K  	  \        R/ V B # )NrG   )r@   )rH   fnadj_fnss   & r   chained _adjust_timings.<locals>.chained   s&    B1A   $!$$r   )usersystemuser_systemwall)	pass_namemaplist)recordsrT   rY   dictsr_   r^   rN   s   &    @@r   _adjust_timingsrk   \   st     I')))  #L"KQa"KG
 %w/E% G#$$s   A#c                   h   a  ] tR t^t o RtR tR tR tR tR t	R t
RR lt]R	 4       tR
 tRtV tR# )r"   zA class for processing raw timing report from LLVM.

The processing is done lazily so we don't waste time processing unused
timing information.
c                    Wn         R # r4   	_raw_data)r   raw_datas   &&r   r6   ProcessedPassTimings.__init__   s    !r   c                ,    \        V P                  4      # r4   )boolro   r   s   &r   __bool__ProcessedPassTimings.__bool__   s    DNN##r   c                    V P                   # )z7Returns the raw string data.

Returns
-------
res: str
rn   r   s   &r   get_raw_data!ProcessedPassTimings.get_raw_data   s     ~~r   c                D    V P                  4       R,          P                  # )zHCompute the total time spend in all passes.

Returns
-------
res: float
ra   )list_records	wall_timer   s   &r   get_total_time#ProcessedPassTimings.get_total_time   s       "2&000r   c                    V P                   # )z[Get the processed data for the timing report.

Returns
-------
res: List[PassTimingRecord]
)
_processedr   s   &r   rz   !ProcessedPassTimings.list_records   s     r   c                    V P                  4       p\        P                  ! R4      p\        P                  ! WRR V4      # )aG  Returns the top(n) most time-consuming (by wall-time) passes.

Parameters
----------
n: int
    This limits the maximum number of items to show.
    This function will show the ``n`` most time-consuming passes.

Returns
-------
res: List[PassTimingRecord]
    Returns the top(n) most time-consuming passes in descending order.
r{   Nra   )rz   rQ   rR   heapqnlargest)r   nri   keys   &&  r   list_topProcessedPassTimings.list_top   s9     ##%!!+.~~a"s33r   c           	     $  aa . oRV,          oVV3R lpV! RV P                  4       R R24       V! R4       V P                  V4       F4  pV! RVP                  R RVP                  R	 R
VP                   24       K6  	  RP                  S4      # )aJ  Return a string summarizing the timing information.

Parameters
----------
topn: int; optional
    This limits the maximum number of items to show.
    This function will show the ``topn`` most time-consuming passes.
indent: int; optional
    Set the indentation level. Defaults to 0 for no indentation.

Returns
-------
res: str
 c                 2   < SP                  S V  24       R # r4   )append)argbufprefixs   &r   ap(ProcessedPassTimings.summary.<locals>.ap   s    JJ&#'(r   zTotal .4fszTop timings:z  zs (5z%) 
)r|   r   r{   wall_percentrf   join)r   topnindentr   pr   r   s   &&&  @@r   summaryProcessedPassTimings.summary   s     v	) 	VD'')#.a01
>t$AAKK$Cq'9Q[[MJK %yy~r   c                "    V P                  4       # )zdA cached property for lazily processing the data and returning it.

See ``_process()`` for details.
)_processr   s   &r   r   ProcessedPassTimings._processed   s     }}r   c                T    R p\        V! V P                  4      4      p\        V4      # )zParses the raw string data from LLVM timing report and attempts
to improve the data by recomputing the times
(See `_adjust_timings()``).
c              3  F  "   V P                  4       pRpRV R2p\        V4      pRRRRRR	R
RRRRR/pV F_  p\        P                  ! W64      pV'       g   K#  \        P                  ! RV4      pV U	u. uF  qV	P                  4       ,          NK  	  p
p	 M	  X
R,          R8X  g   Q h. pRpRpV
RR  FL  p	V	R8X  d   W,          pK  VP                  V	 R24       VP                  V	 R24       VRV RV R2,          pKN  	  / p\        P                   F  p	W9  g   K  V	R8w  g   K  RW&   K  	  VR,          pV F  p\        P                  ! W4      pVf   K  \        VP                  4       4      p \        W4       U	Uu/ uF  w  rYe   \        V4      MRbK  	  pp	pVP                  V4       V R,          p\        R RV/VB pVx  VP                  R8X  g   K   M	  RP                  V4      pRV9   d   R# V'       d   \!        RV 24      hR# u up	i u upp	i 5i)!z_A generator that parses the raw_data line-by-line to extract
timing information for each pass.
z[a-zA-Z+ ]+z(?:\s*-+z-+)+z	User Timerb   zSystem Timerc   zUser+Systemrd   z	Wall Timere   InstrinstructionNamerf   z[a-zA-Z][a-zA-Z+ ]+z\s*((?:[0-9]+\.)?[0-9]+) NrD   rE   z\s+(?:z\s*\(z%\)|-+)g        z\s*(.*)rB   r   z Analysis execution timing reportz'unexpected text after parser finished:
ra   rG   )
splitlinesiterrematchfindallstripr   r@   _fieldsrh   groupszipfloatupdaterf   r   
ValueError)rp   lines	colheadermulticolheaders	line_iter
header_maplnmraw_headerskheadersattrsr   patmissingvdatarf   rec	remainings   &                   r   parse,ProcessedPassTimings._process.<locals>.parse   sN     '')E&I!))D9OUI Vx}VJ  HH_11"$**-CR"HK>IJk!'')44kGJ   2;+---E+ACSb\%HCLLA3e-LLA3h0fQCuQCw77C " G%-->a;&6!$GJ . :CHHS%=#AHHJ/H(+E(<>(< =uQxcA(<  >KK( (I* "+/3C I}}/    		),I 2Y> >ykJ  [ K6>sC   AH!H!4HB	H!!H!*-H!'H!H<H! %H!H!)rh   ro   rk   )r   r   ri   s   &  r   r   ProcessedPassTimings._process   s)    H	V uT^^,-w''r   rn   N)   r   )r&   r'   r(   r)   r*   r6   rt   rw   r|   rz   r   r   r   r   r   r,   r-   r.   s   @r   r"   r"      sM     "$14$6  R( R(r   r"   NamedTimingsnametimingsc                      a  ] tR tRt o RtR t]R 4       t]R 4       tR t	R t
R t]R	 4       tRR
 ltR tR tR tRtV tR# )PassTimingsCollectioni>  z|A collection of pass timings.

This class implements the ``Sequence`` protocol for accessing the
individual timing records.
c                     Wn         . V n        R # r4   _name_records)r   r   s   &&r   r6   PassTimingsCollection.__init__E  s    
r   c              #     "   \         P                  '       dM   \        4       ;_uu_ 4       pRx  RRR4       XP                  4       pV'       d   V P	                  W4       R# R# Rx  R#   + '       g   i     LC; i5i)zRecord new timings and append to this collection.

Note: this is mainly for internal use inside the compiler pipeline.

See also ``RecordLLVMPassTimingsLegacy``

Parameters
----------
name: str
    Name for the records.
N)r   LLVM_PASS_TIMINGSr	   r#   _append)r   r   r   r   s   &&  r   record_legacy#PassTimingsCollection.record_legacyI  sR      ###,..' /++-CT'   /.s!   )A>A+A>A>+A;	6A>c              #    "   \         P                  '       dN   \        V4      ;_uu_ 4       pRx  RRR4       XP                  4       pV'       d   V P	                  W4       R# R# Rx  R#   + '       g   i     LC; i5i)zRecord new timings and append to this collection.

Note: this is mainly for internal use inside the compiler pipeline.

See also ``RecordLLVMPassTimings``

Parameters
----------
name: str
    Name for the records.
N)r   r   r1   r#   r   )r   r   r5   r   r   s   &&&  r   recordPassTimingsCollection.recordb  sT      ###&r**g +++-CT'   +*s!   *A?A,A?A?,A<	7A?c                N    V P                   P                  \        W4      4       R# )zAppend timing records

Parameters
----------
name: str
    Name for the records.
timings: ProcessedPassTimings
    the timing records.
N)r   r   r   )r   r   r   s   &&&r   r   PassTimingsCollection._append{  s     	\$89r   c                b    V P                   '       d   \        R V P                    4       4      # R# )zComputes the sum of the total time across all contained timings.

Returns
-------
res: float or None
    Returns the total number of seconds or None if no timings were
    recorded
c              3   T   "   T F  qP                   P                  4       x  K   	  R # 5ir4   r   r|   ).0rs   & r   	<genexpr>7PassTimingsCollection.get_total_time.<locals>.<genexpr>  s     I=ayy//11=s   &(N)r   sumr   s   &r   r|   $PassTimingsCollection.get_total_time  s%     ===I4==IIIr   c                4    \        V P                  R RR7      # )zqReturns the timings in descending order of total time duration.

Returns
-------
res: List[ProcessedPassTimings]
c                 6    V P                   P                  4       # r4   r   rX   s   &r   rZ   :PassTimingsCollection.list_longest_first.<locals>.<lambda>  s    AII$<$<$>r   T)r   reverse)sortedr   r   s   &r   list_longest_first(PassTimingsCollection.list_longest_first  s     dmm>"$ 	$r   c                $    V P                   '       * # )z	
        r   r   s   &r   is_emptyPassTimingsCollection.is_empty  s     ==  r   c                   V P                   '       d   R# . pVP                  pV! RV P                   24       V P                  4       pV! RVR 24       \	        V P
                  4       Fu  w  rVV! RV RVP                   24       VP                  P                  4       V,          ^d,          pV! RVR R	24       V! VP                  P                  V^R
7      4       Kw  	  RP                  V4      # )a1  Return a string representing the summary of the timings.

Parameters
----------
topn: int; optional, default=5.
    This limits the maximum number of items to show.
    This function will show the ``topn`` most time-consuming passes.

Returns
-------
res: str

See also ``ProcessedPassTimings.summary()``
zNo pass timings were recordedzPrinting pass timings for zTotal time: r   z== #r   z
 Percent: z.1f%)r   r   r   )
r   r   r   r|   	enumerater   r   r   r   r   )r   r   r   r   overall_timeir   percents   &&      r   r   PassTimingsCollection.summary  s     ===2CB+DJJ<89..0Ll3/01!$--0T!AaffX&'))224|CcIZ}A./199$$$q$9:	 1
 99S>!r   c                (    V P                   V,          # )zGet the i-th timing record.

Returns
-------
res: (name, timings)
    A named tuple with two fields:

    - name: str
    - timings: ProcessedPassTimings
r   )r   r   s   &&r   __getitem__!PassTimingsCollection.__getitem__  s     }}Qr   c                ,    \        V P                  4      # )z#Length of this collection.
        )lenr   r   s   &r   __len__PassTimingsCollection.__len__  s     4==!!r   c                "    V P                  4       # r4   )r   r   s   &r   __str__PassTimingsCollection.__str__  s    ||~r   r   N)r   )r&   r'   r(   r)   r*   r6   r   r   r   r   r|   r   propertyr   r   r   r   r   r,   r-   r.   s   @r   r   r   >  ss       0  0
:	$ ! !
"< "
 r   r   )
	user_timeuser_percentsystem_timesystem_percentuser_system_timeuser_system_percentr{   r   rf   r   )r   rQ   r   collectionsr   collections.abcr   
contextlibr   	functoolsr   
numba.corer   llvmlite.bindingbindingr   r	   r1   r@   rk   r"   r   r   rG   r   r   <module>r     s~    	   " $ % %  0 0:0 0@  "*%Zo( o(d .69*=>YH Yr   