Move time-related prints to entrypoint scripts

This commit is contained in:
Christophe Bedard 2019-06-13 16:20:06 +02:00
parent 12c2c7bad5
commit 693d52f0ad
3 changed files with 12 additions and 9 deletions

View file

@ -1,7 +1,5 @@
# CTF to pickle conversion
import time
import babeltrace
# List of ignored CTF fields
@ -29,8 +27,6 @@ def ctf_to_pickle(trace_directory, target):
# count_pid_matched = 0
# traced = set()
start_time = time.time()
# PID_KEYS = ['vpid', 'pid']
for event in tc.events:
count += 1
@ -45,8 +41,7 @@ def ctf_to_pickle(trace_directory, target):
target.dump(pod)
count_written += 1
time_diff = time.time() - start_time
print(f'{count_written} events in {time_diff * 1000:.2f} ms')
return count_written
def _ctf_event_to_pod(ctf_event):

View file

@ -3,6 +3,7 @@
import argparse
from pickle import Pickler
import time
from tracetools_analysis.conversion import ctf
@ -22,6 +23,9 @@ def main():
trace_directory = args.trace_directory
pickle_target_file = args.pickle_file
start_time = time.time()
with open(pickle_target_file, 'wb') as f:
p = Pickler(f, protocol=4)
ctf.ctf_to_pickle(trace_directory, p)
count = ctf.ctf_to_pickle(trace_directory, p)
time_diff = time.time() - start_time
print(f'converted {count} events in {time_diff * 1000:.2f} ms')

View file

@ -3,6 +3,7 @@
import argparse
import pickle
import time
from tracetools_analysis.analysis import processor, to_pandas
from tracetools_analysis.analysis import data_model
@ -18,10 +19,13 @@ def main():
args = parse_args()
pickle_filename = args.pickle_file
start_time = time.time()
with open(pickle_filename, 'rb') as f:
events = _get_events_from_pickled_file(f)
print(f'imported {len(events)} events')
p = processor.ros_process(events)
time_diff = time.time() - start_time
print(f'processed {len(events)} events in {time_diff * 1000:.2f} ms')
p.get_data_model().print()