
    Wj                     n    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
           dS )	    N)_register_handler_Request	_Response)_ExperimentalConfigprofilereqrespreturnc                    t          d          }t          |                     d                    }t          d|          5 }t	          j        |           d d d            n# 1 swxY w Y   t          j        dd          5 }|                    |j	                   |
                    t          j        |j	                                                  d           |                    d	           d d d            d S # 1 swxY w Y   d S )
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         f/home/longshao/multi-rider-rag/.venv/lib/python3.11/site-packages/torch/distributed/debug/_handlers.py_torch_profiler$   	   s|   -    S]]:..//H	t9L	M	M	M QU
8               
	$M'	J	J	J a  (((af--88::<NOOO                 s%   A%%A),A)A/DD	Dtorch_profile)r   r   r   torch._C._distributed_c10dr   r   r   torch.profilerr   r   r$        r#   <module>r*      s       M M M M M M M M M M 7 7 7 7 7 7 7 7 	 d      /> 2 2 2 2 2r)   