
    FojJ              	           S SK Jr  S SKJr  S SKrSSKJr  SS\\   S\4S jjrSS\\   S\4S	 jjr	SS\\   S
\\   4S jjr
SS\\   S\S
\4S jjr   SS\\   S\S\S
S4S jjrg)    )Optional)protonN   )flagssessionphasec                     U c  g[         R                  (       a  U S:w  a  [        S5      e[        R                  " [
        R                  " X5      5      $ )z
Retrieves profiling data for a given session.

Args:
    session (Optional[int]): The session ID of the profiling session, or None if profiling is inactive.
Returns:
    str: The profiling data in JSON format.
Nr   EOnly one session can be retrieved when running from the command line.)r   command_line
ValueErrorjsonloads	libprotonget_datar   r   s     N/mnt/workspace/venv-train/lib/python3.13/site-packages/triton/profiler/data.pygetr      sA     gl`aa::i((899    c                     U c  g[         R                  (       a  U S:w  a  [        S5      e[        R                  " X5      $ )z
Retrieves profiling data for a given session encoded with MessagePack.

Args:
    session (Optional[int]): The session ID of the profiling session, or None if profiling is inactive.

Returns:
    bytes: The profiling data encoded with MessagePack.
Nr   r
   )r   r   r   r   get_data_msgpackr   s     r   get_msgpackr      s8     gl`aa%%g55r   returnc                     U c  g[         R                  (       a  U S:w  a  [        S5      e[        R                  " U 5      $ )z
Advances the profiling phase for a given session.

Args:
    session (Optional[int]): The session ID of the profiling session, or None if profiling is inactive.

Returns:
    Optional[int]: The next phase number after advancing.
Nr   zFOnly one session can advance phase when running from the command line.)r   r   r   r   advance_data_phase)r   s    r   advance_phaser   (   s8     glabb''00r   c                     U c  g[         R                  (       a  U S:w  a  [        S5      e[        R                  " X5      $ )a  
Checks if the profiling data for a given session and phase is complete.

A "complete" phase is safe to read/clear because all device-side records for
the phase have been flushed to the host and the phase will no longer receive
new records.

Args:
    session (Optional[int]): The session ID of the profiling session, or None if profiling is inactive.
    phase (int): The phase number to check. Defaults to 0.

Returns:
    bool: True if the phase data is complete, False otherwise.
Fr   zVOnly one session can check phase completion status when running from the command line.)r   r   r   r   is_data_phase_completer   s     r   is_phase_completer   9   s8     glqrr++G;;r   clear_up_to_phasec                     U c  g[         R                  (       a  U S:w  a  [        S5      e[        R                  " XU5        g)a+  
Clears profiling data for a given session.

Args:
    session (Optional[int]): The session ID of the profiling session, or None if profiling is inactive.
    phase (int): The phase number to clear. Defaults to 0.
    clear_up_to_phase (bool): If True, clear all phases up to and including `phase`.
Nr   zCOnly one session can be cleared when running from the command line.)r   r   r   r   
clear_data)r   r   r   s      r   clearr"   O   s8     gl^__):;r   )r   r   )r   )r   r   F)typingr   triton._C.libprotonr   r   r   r   intr   r   r   boolr   r"    r   r   <module>r(      s     3  :# :3 : 6# 63 6"18C= 1# 1"<x} < <T <. #<c]<< < 
	<r   