class_docstr: Creates profiles in pprof format.
docstr: Generates pprof profiles.
  
  Returns:
    Dictionary mapping from device name to proto in `profile_pb2.Profile`
    format.
docstr_tok: ["Generates","pprof","profiles",".","Returns",":","Dictionary","mapping","from","device","name","to","proto","in","`","profile_pb2.Profile","`","format","."]
code: def profile(self):
      """Generates pprof profiles.
  
      Returns:
        Dictionary mapping from device name to proto in `profile_pb2.Profile`
        format.
      """
      profiles = {}
      data_generator_func = self._get_profile_data_generator()
      for device_index, device_stats in enumerate(
          self._run_metadata.step_stats.dev_stats
      ):
          # Create profile
          pprof_proto = self._get_pprof_proto(
              data_generator_func(device_stats)
          )
          if not pprof_proto.sample:
              print(
                  "Not enough data to create profile for device %s. Did you pass "
                  "RunMetadata to session.run call?"
                  % device_stats.device
              )
              continue
          # Add device name comment
          device_count = len(self._run_metadata.step_stats.dev_stats)
          device_description = "Device %d of %d: %s" % (
              device_index + 1,
              device_count,
              device_stats.device,
          )
          device_description_str_index = self._string_table.next_index()
          pprof_proto.string_table.append(device_description)
          pprof_proto.comment.append(device_description_str_index)
          profiles[device_stats.device] = pprof_proto
      return profiles
  
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 PprofProfiler obj's underlying member method code with example usage: obj.profile() and returns: profiles