code: def benchmark(exec_func=None, *, plot=True, auto=False):
      """Decorator for benchmark function.
  
      Args:
          exec_func (func): The experiment function.
          plot (bool): Whether the result of this run needs to be plotted.
              PNG files will be generated in sub folder /plot.
          auto (auto): Whether this is automatic benchmarking. JSON files
              will be generated in sub folder /auto.
  
      Returns:
          func: The wrapper function.
  
      """
      if exec_func is None:
          return functools.partial(benchmark, plot=plot, auto=auto)
  
      @functools.wraps(exec_func)
      def wrapper_func():
          """The wrapper function."""
          # pylint: disable=global-statement
          global _plot, _log_dir, _auto
          _plot = {} if plot else None
          plt.close("all")
  
          _log_dir = _get_log_dir(exec_func.__name__)
  
          if os.path.exists(_log_dir):
              count = 1
              while os.path.exists(_log_dir + "_" + str(count)):
                  count += 1
              _log_dir = _log_dir + "_" + str(count)
  
          if auto:
              _auto = auto
              auto_dir = os.path.join(_log_dir, "auto")
              os.makedirs(auto_dir)
  
          exec_func()
  
          if plot:
              plot_dir = os.path.join(_log_dir, "plot")
              os.makedirs(plot_dir)
              for env_id in _plot:
                  plt.figure(env_id)
                  plt.legend()
                  plt.xlabel(_plot[env_id]["xlabel"])
                  plt.ylabel(_plot[env_id]["ylabel"])
                  plt.title(env_id)
                  plt.savefig(plot_dir + "/" + env_id)
  
          if auto:
              _upload_to_gcp_storage(_log_dir)
  
      return wrapper_func
  
file_path: garage/benchmarks/src/garage_benchmarks/helper.py
imports: import csv
  import functools
  import json
  import os
  import pathlib
  import random
  import subprocess
  from google.cloud import storage
  import matplotlib.pyplot
  import numpy
  import tensorflow
label_desc: Use image node_id 1 for calling a global function with example usage: benchmark(exec_func) and returns: wrapper_func, functools