Ë
    èÿæiÜ  ã                   óÂ   — d dl Zd dlZd dlZd dlZd dlZd dlZd dlm	Z	m
Z
 d dlmZ d dlZd„ Zd„ Zd„ Z G d„ dej"                  «      Zed	k(  r ej(                  «        yy)
é    N)ÚjitÚtypes)Ú
needs_blasc                  óŽ   — t        t        j                  d d d…   t        j                  d d d…   f«      d„ «       } d| _        | | fS )Né   c                 óX   — d}t        t        | «      «      D ]  }|| |   ||   z  z  }Œ |S )Nr   )ÚrangeÚlen©ÚaÚbÚsumÚis       ún/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/numba/tests/test_profiler.pyÚdotz'generate_standard_dot_case.<locals>.dot   s4   € àˆÜ”s˜1“v–ˆAØ�1�Q‘4˜˜!™‘9Ñ‰Cð àˆ
ó    T©r   r   Úfloat32Ú_enable_sysmon)r   s    r   Úgenerate_standard_dot_caser      sK   € äŒ%�-‰-™˜!˜Ñ
œeŸm™m©C¨a¨CÑ0Ð	2Ó3ñó 4ðð €CÔØ�ˆ8€Or   c                  óš   ‡— t        t        j                  d d d…   t        j                  d d d…   f«      d„ «       Šd‰_        ˆfd„} ‰| fS )Nr   c                 ój   — d}t        t        | «      «      D ]  }|| |   ||   z  z  }Œ t        d«      ‚)Nr   zproblem with dot)r	   r
   Ú
ValueErrorr   s       r   Úraising_dotz.generate_raising_dot_case.<locals>.raising_dot   s=   € ð ˆÜ”s˜1“v–ˆAØ�1�Q‘4˜˜!™‘9Ñ‰Cð äÐ+Ó,Ð,r   Tc                 ó8   •— 	  ‰| |«       y # t         $ r Y y w xY w©N)r   )r   r   r   s     €r   Úcall_raising_dotz3generate_raising_dot_case.<locals>.call_raising_dot'   s$   ø€ ð	Ù˜˜1ÕøÜò 	Ùð	ús   ƒ	 �	˜r   )r   r   s    @r   Úgenerate_raising_dot_caser      sV   ø€ äŒ%�-‰-™˜!˜Ñ
œeŸm™m©C¨a¨CÑ0Ð	2Ó3ñ-ó 4ð-ð "&€KÔôð Ð(Ð(Ð(r   c                 ó.   — t        j                  | |«      S r   )Únpr   )r   r   s     r   Únp_dotr!   0   s   € Ü�6‰6�!�Q‹<Ðr   c                   ó4   — e Zd Zd„ Zd„ Zd„ Zed„ «       Zd„ Zy)ÚTestProfilerc                 ó$  ‡ — t        j                  dt         j                  ¬«      }t        j                  dt         j                  ¬«      }d}t        j                  «       }|j                  «        	 t        |«      D ]  } |||«       Œ 	 |j                  «        t        j                  |«      j                  «       }ˆ fd„}	 |	||j                  j                  |«       ||ur |	||j                  |«       yy# |j                  «        w xY w)zy
        Make sure the jit-compiled function shows up in the profile stats
        as a regular Python function.
        é   )Údtypeé{   c                 ó
  •— t         j                  j                  |j                  «      |j                  |j
                  f}‰j                  || j                  «       | j                  |   }‰j                  |d d ||f«       y )Né   )	ÚosÚpathÚbasenameÚco_filenameÚco_firstlinenoÚco_nameÚassertInÚstatsÚassertEqual)r1   ÚcodeÚn_callsÚexpected_keyÚ
func_statsÚselfs        €r   Úcheck_stats_for_keyz<TestProfiler.check_profiler_dot.<locals>.check_stats_for_keyG   so   ø€ ÜŸG™G×,Ñ,¨T×-=Ñ-=Ó>Ø ×/Ñ/Ø ŸL™LðˆLð
 �M‰M˜,¨¯©Ô4àŸ™ \Ñ2ˆJØ×Ñ˜Z¨¨˜^¨g°wÐ-?Õ@r   N)r    Úaranger   ÚprofilerÚProfileÚenabler	   ÚdisableÚpstatsÚStatsÚ
strip_dirsÚpy_funcÚ__code__)
r7   ÚcallerÚcfuncr   r   r4   ÚpÚ_r1   r8   s
   `         r   Úcheck_profiler_dotzTestProfiler.check_profiler_dot6   sÐ   ø€ ô
 �I‰I�b¤§
¡
Ô+ˆÜ�I‰I�b¤§
¡
Ô+ˆØˆÜ×ÑÓˆØ	�‰Œ
ð	Ü˜7–^�Ù�q˜!•ñ $ð �I‰IŒKÜ—‘˜Q“×*Ñ*Ó,ˆô		Añ 	˜E 5§=¡=×#9Ñ#9¸7ÔCð ˜ÑÙ  v§¡¸Õ@ð øð% �I‰I�Kús   Á3C= Ã=Dc                 óB   — t        «       \  }}| j                  ||«       y r   )r   rG   )r7   r   rF   s      r   Útest_profilerzTestProfiler.test_profilerY   s   € Ü+Ó-‰ˆˆQØ×Ñ  SÕ)r   c                 óB   — t        «       \  }}| j                  ||«       y r   )r   rG   )r7   r   r   s      r   Ú"test_profiler_for_raising_functionz/TestProfiler.test_profiler_for_raising_function]   s!   € Ü(AÓ(CÑ%ˆÐ%Ø×ÑÐ 0°+Õ>r   c                 óT   — d}t        j                  t        j                  d|g«       y )NaÊ  if 1:
            import cProfile as profiler

            import numpy as np

            from numba import jit
            from numba.tests.test_profiler import np_dot

            cfunc = jit(nopython=True)(np_dot)

            a = np.arange(16, dtype=np.float32)
            b = np.arange(16, dtype=np.float32)

            p = profiler.Profile()
            p.enable()
            cfunc(a, b)
            cfunc(a, b)
            p.disable()
            ú-c©Ú
subprocessÚ
check_callÚsysÚ
executable©r7   r3   s     r   Útest_profiler_np_dotz!TestProfiler.test_profiler_np_dota   s$   € ðˆô& 	×ÑœsŸ~™~¨t°TÐ:Õ;r   c                 óT   — d}t        j                  t        j                  d|g«       y )Na  if 1:
            import cProfile as profiler
            p = profiler.Profile()
            p.enable()

            from numba.tests.npyufunc.test_dufunc import TestDUFunc
            t = TestDUFunc('test_npm_call')
            t.test_npm_call()

            p.disable()
            rM   rN   rS   s     r   Útest_issue_3229zTestProfiler.test_issue_3229y   s$   € ð
ˆô 	×ÑœsŸ~™~¨t°TÐ:Õ;r   N)	Ú__name__Ú
__module__Ú__qualname__rG   rI   rK   r   rT   rV   © r   r   r#   r#   4   s,   „ ò!AòF*ò?ð ñ<ó ð<ó.<r   r#   Ú__main__)ÚcProfiler:   r*   r>   rO   rQ   Únumpyr    Únumbar   r   Únumba.tests.supportr   Úunittestr   r   r!   ÚTestCaser#   rW   ÚmainrZ   r   r   Ú<module>rc      s^   ðÛ Û 	Û Û Û 
ã ç Ý *Û ò
ò)ò*ôW<�8×$Ñ$ô W<ðr ˆzÒØ€H‡M�M…Oð r   