code: def test_benchmark_max_duration(self):
      with mock.patch(
          "time.perf_counter",
          mock.Mock(side_effect=[1.0, 2.0, 2.0] * 6),
      ):
          with mock.patch(
              "cupy.cuda.get_elapsed_time", mock.Mock(return_value=2500)
          ):
              mock_func = mock.Mock()
              mock_func.__name__ = "test_name_xxx"
              x = cupy.testing.shaped_random((2, 3), cupy, "int32")
              y = cupy.testing.shaped_random((2, 3), cupy, "int32")
              assert mock_func.call_count == 0
  
              perf = profiler.benchmark(
                  mock_func, (x, y), n_warmup=3, max_duration=2.5
              )
  
              assert perf.name == "test_name_xxx"
              assert mock_func.call_count == 6
              assert perf.cpu_times.shape == (3,)
              assert perf.gpu_times.shape == (1, 3)
              assert (perf.cpu_times == 1.0).all()
              assert (perf.gpu_times == 2.5).all()
  
file_path: cupy/tests/cupyx_tests/profiler_tests/test_benchmark.py
imports: import unittest
  from unittest import mock
  import numpy
  import cupy
  from cupy import testing
  from cupyx import profiler
  from cupyx.profiler import _time
label_desc: Use image node_id 3 for calling the TestBenchmark obj's underlying member method code with example usage: obj.test_benchmark_max_duration() without return types