code: def test_use_process_stats():
      from mars import resource
  
      cpu_total = resource.cpu_count()
      mem_total = resource.virtual_memory().total
      try:
          os.environ["MARS_USE_PROCESS_STAT"] = "1"
          os.environ["MARS_CPU_TOTAL"] = str(cpu_total)
          os.environ["MARS_MEMORY_TOTAL"] = str(mem_total)
  
          resource = importlib.reload(resource)
          resource.cpu_percent()
          time.sleep(0.5)
  
          mem_stats = resource.virtual_memory()
          assert mem_stats.available >= 0
          assert mem_stats.total >= 0
          assert mem_stats.percent >= 0
          assert mem_stats.used >= 0
          assert mem_stats.free >= 0
  
          cpu_usage = resource.cpu_percent()
          assert cpu_usage >= 0
          cpu_usage = resource.cpu_percent()
          assert cpu_usage >= 0
      finally:
          del os.environ["MARS_USE_PROCESS_STAT"]
          del os.environ["MARS_CPU_TOTAL"]
          del os.environ["MARS_MEMORY_TOTAL"]
          importlib.reload(resource)
  
file_path: mars/mars/tests/test_resource.py
imports: import importlib
  import os
  import tempfile
  import time
  import pytest
  from ..resource import Resource, ZeroResource
label_desc: Use image node_id 2 for calling a global function with example usage: test_use_process_stats() without return types