o
    Û·i£  ã                   @   s8   d dl mZmZ d dlmZ eeƒZG dd„ deƒZdS )é    )ÚABCÚabstractmethod)Úinit_loggerc                   @   sl   e Zd ZdZededefdd„ƒZededB fdd„ƒZed	d
„ ƒZede	fdd„ƒZ
edefdd„ƒZdS )ÚProfilerBasez‚
    Abstract base class for all diffusion profilers.
    Defines the common interface used by GPUWorker and DiffusionEngine.
    Útrace_path_templateÚreturnc                 C   ó   dS )a  
        Start profiling.

        Args:
            trace_path_template: Base path (without rank or extension).
                                 e.g. "/tmp/profiles/sdxl_run"

        Returns:
            Full path of the trace file this rank will write.
        N© )Úselfr   r	   r	   úW/home/ubuntu/vllm_env/lib/python3.10/site-packages/vllm_omni/diffusion/profiler/base.pyÚstart   s   zProfilerBase.startNc                 C   r   )z’
        Stop profiling and finalize/output the trace.

        Returns:
            Path to the saved trace file, or None if not active.
        Nr	   ©r
   r	   r	   r   Ústop   s   zProfilerBase.stopc                 C   r   )z’
        Returns a context manager that advances one profiling step.
        Should be a no-op (nullcontext) when profiler is not active.
        Nr	   r   r	   r	   r   Úget_step_context)   s   zProfilerBase.get_step_contextc                 C   r   )z.Return True if profiling is currently running.Nr	   r   r	   r	   r   Ú	is_active1   s   zProfilerBase.is_activec                 C   s   dd l }t| dd¡ƒS )Nr   ÚRANKÚ0)ÚosÚintÚgetenv)Úclsr   r	   r	   r   Ú	_get_rank6   s   zProfilerBase._get_rank)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ústrr   r   r   Úboolr   Úclassmethodr   r   r	   r	   r	   r   r      s    	
r   N)Úabcr   r   Úvllm.loggerr   r   Úloggerr   r	   r	   r	   r   Ú<module>   s   