class_docstr: Context-manager eager profiler api.
  
  Example usage:
  ```python
  with Profiler("/path/to/logdir"):
    # do some work
  ```
code: def __init__(self, logdir):
      self._logdir = logdir
  
imports: import datetime
  import os
  import threading
  from tensorflow.python.client import _pywrap_events_writer
  from tensorflow.python.eager import context
  from tensorflow.python.framework import errors
  from tensorflow.python.platform import gfile
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.profiler.internal import _pywrap_profiler
  from tensorflow.python.util import compat
  from tensorflow.python.util.deprecation import deprecated
label_desc: Use image node_id 1 to create a new Profiler object from inherited base classes: object with example: obj = Profiler(logdir)