
    Bh                     <    d Z ddlZ G d de      Z G d de      Zy)z9Data structures and algorithms for profiling information.    Nc                   &    e Zd ZdZd Zed        Zy)ProfileDatumzProfile data point.c                    || _         || _        || _        || _        || _        | j                  rIdt
        j                  j                  | j                        | j                  | j                  fz  | _        nd| _        || _	        | j                  j                  | _        | j                  j                  | j                  j                  z
  | _        y)ap  Constructor.

    Args:
      device_name: (string) name of the device.
      node_exec_stats: `NodeExecStats` proto.
      file_path: path to the source file involved in creating the op.
      line_number: line number in the file involved in creating the op.
      func_name: name of the function that the line belongs to.
      op_type: (string) Operation type.
    z	%s:%d(%s) N)device_namenode_exec_stats	file_pathline_number	func_nameospathbasenamefile_line_funcop_typeall_start_micros
start_timeop_end_rel_microsop_start_rel_microsop_time)selfr   r   r	   r
   r   r   s          _/var/www/html/engine/venv/lib/python3.12/site-packages/tensorflow/python/debug/lib/profiling.py__init__zProfileDatum.__init__   s    " #D*DDN"DDN~~'
''

4>>
*D,<,<dnn+N Nd dDL**;;DO((::((<<=DL    c                 .    | j                   j                  S )z0Op execution time plus pre- and post-processing.)r   all_end_rel_microsr   s    r   	exec_timezProfileDatum.exec_time7   s     222r   N)__name__
__module____qualname____doc__r   propertyr    r   r   r   r      s    >@ 3 3r   r   c                   <    e Zd ZdZd Zd Zed        Zed        Zy)AggregateProfilez>Profile summary data for aggregating a number of ProfileDatum.c                     |j                   | _        |j                  | _        |j                  d|j
                  j                  }|di| _        y)zConstructor.

    Args:
      profile_datum: (`ProfileDatum`) an instance of `ProfileDatum` to
        initialize this object with.
    :   N)r   total_op_timer   total_exec_timer   r   	node_name_node_to_exec_countr   profile_datumdevice_and_nodes      r   r   zAggregateProfile.__init__@   sM     '..D(22D!.!:!:!.!>!>!H!HJO /3Dr   c                 ~   | xj                   |j                  z  c_         | xj                  |j                  z  c_        |j                  d|j
                  j                  }|j                  d|j
                  j                  }|| j                  v r| j                  |xx   dz  cc<   yd| j                  |<   y)zAccumulate a new instance of ProfileDatum.

    Args:
      profile_datum: (`ProfileDatum`) an instance of `ProfileDatum` to
        accumulate to this object.
    r'   r(   N)r)   r   r*   r   r   r   r+   r,   r-   s      r   addzAggregateProfile.addN   s     	-///M333!.!:!:!.!>!>!H!HJO "/!:!:!.!>!>!H!HJO$222
/14/23d/r   c                 ,    t        | j                        S N)lenr,   r   s    r   
node_countzAggregateProfile.node_countb   s    t''((r   c                 H    t        | j                  j                               S r3   )sumr,   valuesr   s    r   node_exec_countz AggregateProfile.node_exec_countf   s    t''..011r   N)	r   r   r    r!   r   r1   r"   r5   r9   r#   r   r   r%   r%   =   s7    F44( ) ) 2 2r   r%   )r!   r   objectr   r%   r#   r   r   <module>r;      s'    @ 	&36 &3R+2v +2r   