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
|
# CTF to pickle conversion
|
||||||
|
|
||||||
import time
|
|
||||||
|
|
||||||
import babeltrace
|
import babeltrace
|
||||||
|
|
||||||
# List of ignored CTF fields
|
# List of ignored CTF fields
|
||||||
|
@ -29,8 +27,6 @@ def ctf_to_pickle(trace_directory, target):
|
||||||
# count_pid_matched = 0
|
# count_pid_matched = 0
|
||||||
# traced = set()
|
# traced = set()
|
||||||
|
|
||||||
start_time = time.time()
|
|
||||||
|
|
||||||
# PID_KEYS = ['vpid', 'pid']
|
# PID_KEYS = ['vpid', 'pid']
|
||||||
for event in tc.events:
|
for event in tc.events:
|
||||||
count += 1
|
count += 1
|
||||||
|
@ -44,9 +40,8 @@ def ctf_to_pickle(trace_directory, target):
|
||||||
pod = _ctf_event_to_pod(event)
|
pod = _ctf_event_to_pod(event)
|
||||||
target.dump(pod)
|
target.dump(pod)
|
||||||
count_written += 1
|
count_written += 1
|
||||||
|
|
||||||
time_diff = time.time() - start_time
|
return count_written
|
||||||
print(f'{count_written} events in {time_diff * 1000:.2f} ms')
|
|
||||||
|
|
||||||
|
|
||||||
def _ctf_event_to_pod(ctf_event):
|
def _ctf_event_to_pod(ctf_event):
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
from pickle import Pickler
|
from pickle import Pickler
|
||||||
|
import time
|
||||||
|
|
||||||
from tracetools_analysis.conversion import ctf
|
from tracetools_analysis.conversion import ctf
|
||||||
|
|
||||||
|
@ -22,6 +23,9 @@ def main():
|
||||||
trace_directory = args.trace_directory
|
trace_directory = args.trace_directory
|
||||||
pickle_target_file = args.pickle_file
|
pickle_target_file = args.pickle_file
|
||||||
|
|
||||||
|
start_time = time.time()
|
||||||
with open(pickle_target_file, 'wb') as f:
|
with open(pickle_target_file, 'wb') as f:
|
||||||
p = Pickler(f, protocol=4)
|
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 argparse
|
||||||
import pickle
|
import pickle
|
||||||
|
import time
|
||||||
|
|
||||||
from tracetools_analysis.analysis import processor, to_pandas
|
from tracetools_analysis.analysis import processor, to_pandas
|
||||||
from tracetools_analysis.analysis import data_model
|
from tracetools_analysis.analysis import data_model
|
||||||
|
@ -18,10 +19,13 @@ def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
|
|
||||||
pickle_filename = args.pickle_file
|
pickle_filename = args.pickle_file
|
||||||
|
|
||||||
|
start_time = time.time()
|
||||||
with open(pickle_filename, 'rb') as f:
|
with open(pickle_filename, 'rb') as f:
|
||||||
events = _get_events_from_pickled_file(f)
|
events = _get_events_from_pickled_file(f)
|
||||||
print(f'imported {len(events)} events')
|
|
||||||
p = processor.ros_process(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()
|
p.get_data_model().print()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue