class_docstr: A Memory statistic collector.
  It works in two phases.
  Phase 1. Collection Phase: collect memory usage statistics of CPU and GPU.
  The first iteration of DNN training.
  Phase 2. Runtime Phase: use the read-only collected stats
  The rest iterations of DNN training.
  
  It has a Sampling counter which is reset after DNN training iteration.
class_docstr_tok: ["A","Memory","statistic","collector",".","It","works","in","two","phases",".","Phase","1",".","Collection","Phase",":","collect","memory","usage","statistics","of","CPU","and","GPU",".","The","first","iteration","of","DNN","training",".","Phase","2",".","Runtime","Phase",":","use","the","read-only","collected","stats","The","rest","iterations","of","DNN","training",".","It","has","a","Sampling","counter","which","is","reset","after","DNN","training","iteration","."]
docstr: Sampling overall and non model data cuda memory statistics.
docstr_tok: ["Sampling","overall","and","non","model","data","cuda","memory","statistics","."]
code: def sample_overall_data(self) -> None:
      """
      Sampling overall and non model data cuda memory statistics.
      """
      if self._start_flag and not self.use_outside_memstats:
          cuda_overall = self._mem_monitor.finish()
          self._memstats.record_max_cuda_overall_data(cuda_overall)
          self._memstats.calc_max_cuda_non_model_data()
  
          self._mem_monitor.start()
  
      if self._start_flag:
          self._sampling_time.append(time.time())
  
file_path: ColossalAI/colossalai/zero/gemini/memory_tracer/memstats_collector.py
imports: import time
  from typing import Optional
  from .memory_monitor import SyncCudaMemoryMonitor
  from .memory_stats import MemStats
label_desc: Use image node_id 7 for calling the MemStatsCollector obj's underlying member method code with example usage: obj.sample_overall_data() without return types