code: def test_function_profiling(
      tmpdir, mem_gb, n_procs, use_resource_monitor
  ):
      """
      Test runtime profiler correctly records workflow RAM/CPUs consumption
      of a Function interface
      """
      from nipype import config
  
      config.set(
          "monitoring", "sample_frequency", "0.2"
      )  # Force sampling fast
  
      tmpdir.chdir()
      iface = niu.Function(function=_use_resources)
      iface.inputs.mem_gb = mem_gb
      iface.inputs.n_procs = n_procs
      result = iface.run()
  
      assert (
          abs(mem_gb - result.runtime.mem_peak_gb) < 0.3
      ), "estimated memory error above .3GB"
      assert int(result.runtime.cpu_percent / 100 + 0.2) >= n_procs
  
file_path: nipype/nipype/interfaces/base/tests/test_resource_monitor.py
imports: import os
  import pytest
  from ....None import config
  from ....utils.profiler import _use_resources
  from ...base import traits, CommandLine, CommandLineInputSpec
  from ...None import utility
label_desc: Use image node_id 3 for calling a global function with example usage: test_function_profiling(tmpdir, mem_gb, n_procs, use_resource_monitor) without return types