code: def testTimelineCpu(self):
      run_options = config_pb2.RunOptions(
          trace_level=config_pb2.RunOptions.FULL_TRACE
      )
      run_metadata = config_pb2.RunMetadata()
  
      with self.session(use_gpu=False) as sess:
          const1 = constant_op.constant(1.0, name="const1")
          const2 = constant_op.constant(2.0, name="const2")
          result = math_ops.add(const1, const2) + const1 * const2
          sess.run(
              result, options=run_options, run_metadata=run_metadata
          )
      self.assertTrue(run_metadata.HasField("step_stats"))
      step_stats = run_metadata.step_stats
      devices = [d.device for d in step_stats.dev_stats]
      self.assertTrue(
          "/job:localhost/replica:0/task:0/device:CPU:0" in devices
      )
      tl = timeline.Timeline(step_stats)
      ctf = tl.generate_chrome_trace_format()
      self._validateTrace(ctf)
      tl = timeline.Timeline(step_stats)
      ctf = tl.generate_chrome_trace_format(show_dataflow=False)
      self._validateTrace(ctf)
      tl = timeline.Timeline(step_stats)
      ctf = tl.generate_chrome_trace_format(show_memory=False)
      self._validateTrace(ctf)
      tl = timeline.Timeline(step_stats)
      ctf = tl.generate_chrome_trace_format(
          show_memory=False, show_dataflow=False
      )
      self._validateTrace(ctf)
  
file_path: tensorflow-upstream/tensorflow/python/client/timeline_test.py
imports: import json
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.python.client import session
  from tensorflow.python.client import timeline
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import test_util
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
label_desc: Use image node_id 3 for calling the TimelineTest obj's underlying member method code with example usage: obj.testTimelineCpu() without return types