code: def test_stats():
      from mars import resource
  
      resource = importlib.reload(resource)
      resource.cpu_percent()
  
      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()
      time.sleep(0.1)
      assert cpu_usage >= 0
  
      resource.disk_io_usage()
      time.sleep(0.1)
      recv_speed, send_speed = resource.disk_io_usage()
      assert recv_speed >= 0
      assert send_speed >= 0
  
      curdir = os.path.dirname(os.path.abspath(__file__))
      resource.disk_io_usage(curdir)
      time.sleep(0.1)
      usage = resource.disk_io_usage(curdir)
      if usage is not None:
          assert usage.reads >= 0
          assert usage.writes >= 0
  
      resource.net_io_usage()
      time.sleep(0.1)
      recv_speed, send_speed = resource.net_io_usage()
      assert recv_speed >= 0
      assert send_speed >= 0
  
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 1 for calling a global function with example usage: test_stats() without return types