
    i                     f    d dl Z d dlZd dlZd dlmZmZmZ d dlmZm	Z	 dededdfdZ
 ede
       y)	    N)_register_handler_Request	_Response)_ExperimentalConfigprofilereqrespreturnc                    t        d      }t        | j                  d            }t        d|      5 }t	        j
                  |       d d d        t        j                  dd      5 }j                  |j                         |j                  t        j                  |j                        j                         d       |j                  d	       d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)
NT)profile_all_threadsduration)record_shapesexperimental_configtorch_debugz.json)prefixsuffixzapplication/json   )r   float	get_paramr   timesleeptempfileNamedTemporaryFileexport_chrome_tracenameset_contentpathlibPath
read_bytes
set_status)r   r	   r   r   proffs         [/var/www/html/engine/venv/lib/python3.12/site-packages/torch/distributed/debug/_handlers.py_torch_profiler$   	   s    -  S]]:./H	t9L	M QU

8 
	$	$M'	J a  (aff-88:<NO   s   C)A*C(C%(C1torch_profile)r   r   r   torch._C._distributed_c10dr   r   r   torch.profilerr   r   r$        r#   <module>r*      s=       M M 7 	 d  /> 2r)   