a
    
d                     @   sd   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 deZ
edkr`e  dS )    N)dedent)TemporaryDirectory)TestCaserun_in_subprocessc                   @   s   e Zd ZdZdd ZdS )TestChromeTraceModulez0
    Test chrome tracing generated file(s).
    c           	   	   C   s   d}t |}t }tj|d}tj }||d< t||d t|T}t	
|}| |t |D ](}| |t | t| h d qdW d    n1 s0    Y  W d    n1 s0    Y  d S )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.jsonZNUMBA_CHROME_TRACE)env>   tspidargstidcatphname)r   r   ospathjoinenvironcopyr   openjsonloadZassertIsInstancelistdictassertEqualsetkeys)	selfcodesrctmpdirr   r   fileeventsZev r"   f/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/numba/tests/test_chrome_trace.pytest_trace_output   s     



z'TestChromeTraceModule.test_trace_outputN)__name__
__module____qualname____doc__r$   r"   r"   r"   r#   r   
   s   r   __main__)r   r   Zunittesttextwrapr   tempfiler   Znumba.tests.supportr   r   r   r%   mainr"   r"   r"   r#   <module>   s   (