class_docstr: Keeps track of `Sample` protos for pprof profile.
  
  Samples store the following statistics in order:
  count, all_time, op_time
docstr: Adds a sample data point.
  
  Args:
    datum: `ProfileDatum` to add a sample for.
    location_ids: List of numberic location ids for this
      sample.
docstr_tok: ["Adds","a","sample","data","point",".","Args",":","datum",":","`","ProfileDatum","`","to","add","a","sample","for",".","location_ids",":","List","of","numberic","location","ids","for","this","sample","."]
code: def add(self, datum, location_ids):
      """Adds a sample data point.
  
      Args:
        datum: `ProfileDatum` to add a sample for.
        location_ids: List of numberic location ids for this
          sample.
      """
      node_name = datum.node_exec_stats.node_name
      if node_name in self._node_name_to_sample:
          sample = self._node_name_to_sample[node_name]
          sample.location_id.extend(location_ids)
      else:
          sample = profile_pb2.Sample()
          # Sample stores 3 values: count, all_time, op_time
          sample.value.extend([0, 0, 0])
  
          label = sample.label.add()
          label.key = self._string_table.index_of("node_name")
          label.str = self._string_table.index_of(node_name)
          label = sample.label.add()
          label.key = self._string_table.index_of("op_type")
          label.str = self._string_table.index_of(datum.op_type)
          self._node_name_to_sample[node_name] = sample
      sample.value[0] += 1
      sample.value[1] += datum.node_exec_stats.all_end_rel_micros
      sample.value[2] += (
          datum.node_exec_stats.op_end_rel_micros
          - datum.node_exec_stats.op_start_rel_micros
      )
  
imports: from collections import defaultdict
  from collections import namedtuple
  import gzip
  import os
  import string
  import sys
  import time
  from proto import profile_pb2
label_desc: Use image node_id 2 for calling the Samples obj's underlying member method code with example usage: obj.add(datum, location_ids) without return types