def generate_process_statistics(collectl_playback_cli, pid, statistics=DEFAULT_STATISTICS):
 with tempfile.NamedTemporaryFile() as tmp_tsv:
  collectl_playback_cli.run(stdout=tmp_tsv)
  with open(tmp_tsv.name, 'r') as tsv_file:
   return _read_process_statistics(tsv_file, pid, statistics)

def generate_process_statistics ( collectl_playback_cli , pid , statistics = DEFAULT_STATISTICS ) : with tempfile . NamedTemporaryFile ( ) as tmp_tsv : collectl_playback_cli . run ( stdout = tmp_tsv ) with open ( tmp_tsv . name , 'r' ) as tsv_file : return _read_process_statistics ( tsv_file , pid , statistics )
playback collectl file and generate summary statistics .