class_docstr: A ``Thread`` to monitor a specific PID with a certain frequency
  to a file
class_docstr_tok: ["A","``","Thread","``","to","monitor","a","specific","PID","with","a","certain","frequency","to","a","file"]
code: def _sample(self, cpu_interval=None):
      cpu = 0.0
      rss = 0.0
      vms = 0.0
      try:
          with self._process.oneshot():
              cpu += self._process.cpu_percent(interval=cpu_interval)
              mem_info = self._process.memory_info()
              rss += mem_info.rss
              vms += mem_info.vms
      except psutil.NoSuchProcess:
          pass
  
      # Iterate through child processes and get number of their threads
      try:
          children = self._process.children(recursive=True)
      except psutil.NoSuchProcess:
          children = []
  
      for child in children:
          try:
              with child.oneshot():
                  cpu += child.cpu_percent()
                  mem_info = child.memory_info()
                  rss += mem_info.rss
                  vms += mem_info.vms
          except psutil.NoSuchProcess:
              pass
  
      print(
          f"{time():f},{cpu:f},{rss / _MB:f},{vms / _MB:f}",
          file=self._logfile,
      )
      self._logfile.flush()
  
imports: import os
  import numpy
  import threading
  from time import time
  from ..None import config, logging
label_desc: Use image node_id 4 for calling the ResourceMonitor obj's underlying member method code with example usage: obj._sample(cpu_interval) without return types