Move time-related prints to entrypoint scripts
This commit is contained in:
parent
12c2c7bad5
commit
693d52f0ad
3 changed files with 12 additions and 9 deletions
|
@ -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
|
||||
|
@ -44,9 +40,8 @@ def ctf_to_pickle(trace_directory, target):
|
|||
pod = _ctf_event_to_pod(event)
|
||||
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):
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue