+
     þÎj*  ã                  óš   € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHtHt  ^ RI	t	Rt
]
tR R ltR R	 lt ! R
 R4      tR#   ] d    Rt
 L%i ; i)a  
Memory monitoring utilities for measuring memory usage.

Example usage:
    tracker = MemoryTracker("my_function")
    with tracker.monitor():
        my_function()
    # Access data: tracker.rss_delta, tracker.duration, etc.
    # Get formatted string: tracker.get_summary()
)ÚannotationsN)ÚDictÚOptionalTFc               ó   € V ^8„  d   QhRR/# )é   ÚreturnzOptional[int]© )Úformats   "ÚL/opt/data/home/.local/lib/python3.14/site-packages/numba/misc/memoryutils.pyÚ__annotate__r      s   € ÷ ñ ˜mñ ó    c                 ó†   € \         '       d#    \        P                  ! 4       p V P                  # R#   \         d     R# i ; i)z¼
Get current available system memory in bytes.

Used for memory threshold checking in parallel test execution.

Returns:
    int or None: Available memory in bytes, or None if unavailable
N)Ú_HAS_PSUTILÚpsutilÚvirtual_memoryÚ	availableÚ	Exception)Úsys_mems    r
   Úget_available_memoryr      sD   € ÷ ƒ{ð	Ü×+Ò+Ó-ˆGØ×$Ñ$Ð$ñ øô ô 	Øáð	ús   Ž 1 ±A ¿A c               ó   € V ^8„  d   QhRR/# )r   r   zDict[str, Optional[int]]r   )r	   s   "r
   r   r   /   s   € ÷ "ñ "Ð2ñ "r   c                 ó‚  € / p \         '       dn    \        P                  ! \        P                  ! 4       4      pVP                  4       pVP                  V R&   \        P                  ! 4       pVP                  V R&   RV 9  d   RV R&   RV 9  d   RV R&   V #   \        P                  \        P                  3 d     LAi ; i)a>  
Get memory usage information needed for monitoring.

Returns only RSS and available memory which are the fields
actually used by the MemoryTracker.

Returns:
    dict: Memory usage information including:
        - rss: Current process RSS (physical memory currently used)
        - available: Available system memory
Úrssr   N)r   r   ÚProcessÚosÚgetpidÚmemory_infor   r   r   ÚNoSuchProcessÚAccessDenied)r   ÚprocessÚmem_infor   s       r
   Úget_memory_usager    /   s´   € ð €Kçƒ{ð	ä—n’n¤R§Y¢Y£[Ó1ˆGØ×*Ñ*Ó,ˆHØ!)§¡ˆK˜Ñô ×+Ò+Ó-ˆGØ'.×'8Ñ'8ˆK˜Ñ$ð �KÔØ!ˆ�EÑØ˜+Ô%Ø#'ˆ�KÑ àÐøô ×$Ñ$¤f×&9Ñ&9Ð:ô 	Ùð	ús   �A,B Â%B>Â=B>c                  ó¨   € ] tR t^Tt$ RtR]R&   R]R&   R]R&   R]R&   R	]R
&   R	]R&   R]R&   R]R&   R R lt]P                  R 4       t	R R lt
RtR# )ÚMemoryTrackerz¿
A simple memory monitor that tracks RSS delta and timing.

Stores monitoring data in instance attributes for later access.
Each instance is typically used for monitoring a single operation.
ÚintÚpidÚstrÚnamezfloat | NoneÚ
start_timeÚend_timezDict[str, int | None] | NoneÚstart_memoryÚ
end_memoryÚdurationz
int | NoneÚ	rss_deltac               ó   € V ^8„  d   QhRR/# )r   r&   r%   r   )r	   s   "r
   r   ÚMemoryTracker.__annotate__d   s   € ÷ 	ñ 	˜Sñ 	r   c                óš   € \         P                  ! 4       V n        Wn        RV n        RV n        RV n        RV n        RV n        RV n	        R# )z6Initialize a MemoryTracker with empty monitoring data.N)
r   r   r$   r&   r'   r(   r)   r*   r+   r,   )Úselfr&   s   &&r
   Ú__init__ÚMemoryTracker.__init__d   s?   € ä—9’9“;ˆŒØŒ	ØˆŒØˆŒØ ˆÔØˆŒØˆŒØˆŽr   c              #  ó  "  € \         P                   ! 4       V n        \        4       V n         V x € \         P                   ! 4       V n        \        4       V n        V P                  V P                  ,
          V n        V P                  P                  R^ 4      pV P
                  P                  R^ 4      pV'       d   V'       d	   W!,
          M^ V n        R#   \         P                   ! 4       T n        \        4       T n        T P                  T P                  ,
          T n        T P                  P                  R^ 4      pT P
                  P                  R^ 4      pT'       d   T'       d   Y!,
          T n        i ^ T n        i ; i5i)a_  
Context manager to monitor memory usage during function execution.

Records start/end memory usage and timing, calculates RSS delta,
and stores all data in instance attributes.

Args:
    name (str): Name/identifier for the function or operation being
                monitored

Yields:
    self: The MemoryTracker instance for accessing stored data
r   N)	Útimer'   r    r)   r(   r*   r+   Úgetr,   )r0   Ú	start_rssÚend_rsss   &  r
   ÚmonitorÚMemoryTracker.monitoro   s  é € ô  Ÿ)š)›+ˆŒÜ,Ó.ˆÔð	?ØŠJô !ŸIšI›KˆDŒMÜ.Ó0ˆDŒOØ ŸM™M¨D¯O©OÕ;ˆDŒMð ×)Ñ)×-Ñ-¨e°QÓ7ˆIØ—o‘o×)Ñ)¨%°Ó3ˆGç!*¯wð  'Ö2Ø<=ð ŽNøô !ŸIšI›KˆDŒMÜ.Ó0ˆDŒOØ ŸM™M¨D¯O©OÕ;ˆDŒMð ×)Ñ)×-Ñ-¨e°QÓ7ˆIØ—o‘o×)Ñ)¨%°Ó3ˆGç!*¯wð  'Õ2ˆD�NØ<=ð �Nüs)   ‚*F­C ±BFÃFÃBE?Å)E?Å?Fc               ó   € V ^8„  d   QhRR/# )r   r   r%   r   )r	   s   "r
   r   r.   �   s   € ÷ 4ñ 4˜Sñ 4r   c                óX  € V P                   e   V P                  f   \        R4      hV P                  P                  R4      pRR lp\        P
                  ! R\        P                  ! V P                  4      4      pV P                   P                  R^ 4      pV P                  P                  R^ 4      pRV P                   2RV P                   2RV 2R	V P                  R
 R2RV! V4       2RV! V4       2RV! V P                  RR7       2RV! V4       2.pRP                  V4      # )at  
Return a formatted summary of the memory monitoring data.

Formats the stored monitoring data into a human-readable string
containing name, PID, RSS delta, available memory, duration,
and start time.

Returns:
    str: Formatted summary string with monitoring results

Note:
    Should be called after monitor() context has completed
    to ensure all data is available.
z$Memory monitoring data not availabler   c                óº   € V f   R# V ^ 8X  d   R# RpV'       d   V ^ 8  d   RMRp\        V 4      p R
 F  pV R8  d   V V R RV 2u # V R,          p K!  	  V V R R	2# )z&Convert bytes to human readable formatzN/Az0 BÚ Ú-Ú+g      �@z.2fÚ z TB)ÚBÚKBÚMBÚGB)Úabs)Ú	bytes_valÚ	show_signÚsignÚunits   &&  r
   Úformat_bytesÚ/MemoryTracker.get_summary.<locals>.format_bytes¤   s{   € àÒ ÙØ˜AŒ~ÙàˆDßØ'¨!œm‘s°�Ü˜I›ˆIã/�Ø˜vÔ%Ø"˜V I¨c ?°!°D°6Ð:Ò:Ø˜VÕ#’	ñ 0ð �V˜I c˜?¨#Ð.Ð.r   z%H:%M:%Sr   zName: zPID: zStart: z
Duration: z.3fÚszStart RSS: z	End RSS: zRSS delta: T)rG   zAvail memory: z | )F)r)   r*   Ú
ValueErrorr5   r4   ÚstrftimeÚ	localtimer'   r&   r$   r+   r,   Újoin)r0   Úcurrent_availablerJ   Ústart_tsr6   r7   Úbufs   &      r
   Úget_summaryÚMemoryTracker.get_summary�   s%  € ð ×ÑÒ$¨¯©Ò(?ÜÐCÓDÐDà ŸO™O×/Ñ/°Ó<Ðô	/ô$ —=’= ¬T¯^ª^¸D¿O¹OÓ-LÓMˆØ×%Ñ%×)Ñ)¨%°Ó3ˆ	Ø—/‘/×%Ñ% e¨QÓ/ˆð �T—Y‘Y�KÐ Ø�D—H‘H�:ÐØ�h�ZÐ Ø˜Ÿ™ sÐ+¨1Ð-Ø™, yÓ1Ð2Ð3Ø™ WÓ-Ð.Ð/Ø™, t§~¡~ÀÔFÐGÐHØ™\Ð*;Ó<Ð=Ð>ð	
ˆð �z‰z˜#‹Ðr   )r+   r*   r(   r&   r$   r,   r)   r'   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__r1   Ú
contextlibÚcontextmanagerr8   rT   Ú__static_attributes__r   r   r
   r"   r"   T   sa   ‡ ñð 
ƒHØ
ƒIØÓØÓØ.Ó.Ø,Ó,ØÓØÓõ	ð ×Ññ?ó ð?÷@4ñ 4r   r"   )rZ   Ú
__future__r   r   r\   r4   Útypingr   r   r   r   ÚImportErrorÚIS_SUPPORTEDr   r    r"   r   r   r
   Ú<module>rc      s]   ðñ	õ #Û 	Û Û ß !ðÛØ€Kð
 €õõ&"÷Jpó pøð ô Ø‚Kðús   ž> ¾	A
Á	A
