
    xKg                         d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZm	Z	  G d de      Z
edk(  r ej                          yy)    N)dedent)TemporaryDirectory)TestCaserun_in_subprocessc                       e Zd ZdZd Zy)TestChromeTraceModulez0
    Test chrome tracing generated file(s).
    c           	      $   d}t        |      }t               5 }t        j                  j	                  |d      }t        j
                  j                         }||d<   t        ||       t        |      5 }t        j                  |      }| j                  |t               |D ]C  }| j                  |t               | j                  t        |j!                               h d       E 	 d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)NaY  
            from numba import njit
            import numpy as np

            x = np.arange(100).reshape(10, 10)

            @njit
            def go_fast(a):
                trace = 0.0
                for i in range(a.shape[0]):
                    trace += np.tanh(a[i, i])
                return a + trace

            go_fast(x)
        ztest_trace.jsonNUMBA_CHROME_TRACE)env>   phtscatpidtidargsname)r   r   ospathjoinenvironcopyr   openjsonloadassertIsInstancelistdictassertEqualsetkeys)	selfcodesrctmpdirr   r   fileeventsevs	            a/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numba/tests/test_chrome_trace.pytest_trace_outputz'TestChromeTraceModule.test_trace_output   s      Tl!V77<<(9:D**//#C(,C$%cs+dt4%%fd3 B))"d3$$BGGII !  "!
  "!s%   AD4A4C:)D:D	?DDN)__name__
__module____qualname____doc__r)        r(   r   r   
   s     r/   r   __main__)r   r   unittesttextwrapr   tempfiler   numba.tests.supportr   r   r   r*   mainr.   r/   r(   <module>r6      s>    	    ' ;%H %P zHMMO r/   