From 300b4d1434ff9fb7274b65abe91d4a31e3c24bca Mon Sep 17 00:00:00 2001 From: ChadliaJerad Date: Thu, 14 Sep 2023 15:42:24 -0700 Subject: [PATCH 1/2] Fix the wrong assumption about the last event in a federate processed trace --- util/tracing/visualization/fedsd.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/util/tracing/visualization/fedsd.py b/util/tracing/visualization/fedsd.py index 9d482ab82..241e30930 100644 --- a/util/tracing/visualization/fedsd.py +++ b/util/tracing/visualization/fedsd.py @@ -334,9 +334,14 @@ def load_and_process_csv_file(csv_file) : # which boils up to having 'RTI' in the 'event' column df = df[df['event'].str.contains('Sending|Receiving|Scheduler advancing time ends') == True] + id = -1 # Fix the parameters of the event 'Scheduler advancing time ends' - # We rely on the fact that the first row of the csv file cannot be the end of advancing time - id = df.iloc[-1]['self_id'] + # where 'self_id' should not be -1, but rather the value from a sending or + # receiving event + for index, row in df.iterrows(): + if ('Sending' in row['event'] or 'Receiving' in row['event']) : + id = row['self_id'] + break df['self_id'] = id df = df.astype({'self_id': 'int', 'partner_id': 'int'}) From 87e0dd65f32099746dafd10cacedbfd1324c6758 Mon Sep 17 00:00:00 2001 From: ChadliaJerad Date: Fri, 15 Sep 2023 14:00:41 -0700 Subject: [PATCH 2/2] Tweak comments based on code review --- util/tracing/visualization/fedsd.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/util/tracing/visualization/fedsd.py b/util/tracing/visualization/fedsd.py index 241e30930..8739e83a7 100644 --- a/util/tracing/visualization/fedsd.py +++ b/util/tracing/visualization/fedsd.py @@ -334,10 +334,8 @@ def load_and_process_csv_file(csv_file) : # which boils up to having 'RTI' in the 'event' column df = df[df['event'].str.contains('Sending|Receiving|Scheduler advancing time ends') == True] + # Determine the "self id" in the trace file based on the first 'Receiving' or 'Sending' message (or use -1, the id of the RTI, if there is none). id = -1 - # Fix the parameters of the event 'Scheduler advancing time ends' - # where 'self_id' should not be -1, but rather the value from a sending or - # receiving event for index, row in df.iterrows(): if ('Sending' in row['event'] or 'Receiving' in row['event']) : id = row['self_id']