class_docstr: Allows easy observation of a given PID for resource usage
class_docstr_tok: ["Allows","easy","observation","of","a","given","PID","for","resource","usage"]
code: def __init__(self, pid, bench_record, interval=BENCHMARK_INTERVAL):
      import psutil
  
      ScheduledPeriodicTimer.__init__(self, interval)
      #: PID of observed process
      self.pid = pid
      self.main = psutil.Process(self.pid)
      #: ``BenchmarkRecord`` to write results to
      self.bench_record = bench_record
      #: Cache of processes to keep track of cpu percent
      self.procs = {}
  
imports: import contextlib
  import datetime
  from itertools import chain
  import os
  import time
  import threading
  from snakemake.logging import logger
label_desc: Use image node_id 1 to create a new BenchmarkTimer object from inherited base classes: ScheduledPeriodicTimer with example: obj = BenchmarkTimer(pid, bench_record, interval)