code: def benchmark(func):
      """
      Returns a callable/closure that wraps func with code to time the func call
      and return a BenchmarkedResult. The resulting callable takes the same
      args/kwargs as func.
  
      The BenchmarkedResult will have its params value assigned from the kwargs
      dictionary, but the func positional args are not captured. If a user needs
      the params captured for reporting purposes, they must use kwargs.  This is
      useful since positional args can be used for args that would not be
      meaningful in a benchmark result as a param to the benchmark.
  
      This can be used as a function decorator or a standalone function to wrap
      functions to benchmark.
      """
      benchmark_name = getattr(func, "benchmark_name", func.__name__)
  
      @wraps(func)
      def benchmark_wrapper(*func_args, **func_kwargs):
          t1 = time.perf_counter()
          retval = func(*func_args, **func_kwargs)
          t2 = time.perf_counter()
          return BenchmarkedResult(
              name=benchmark_name,
              retval=retval,
              runtime=(t2 - t1),
              params=func_kwargs,
          )
  
      # Assign the name to the returned callable as well for use in debug prints,
      # etc.
      benchmark_wrapper.name = benchmark_name
      return benchmark_wrapper
  
file_path: cugraph/benchmarks/cugraph/standalone/benchmark.py
imports: import sys
  import time
  from functools import wraps
label_desc: Use image node_id 1 for calling a global function with example usage: benchmark(func) and returns: benchmark_wrapper, BenchmarkedResult