Skip to content

Commit

Permalink
Restructure if/continues in loops
Browse files Browse the repository at this point in the history
  • Loading branch information
berkayurun authored and lukasauer committed May 2, 2023
1 parent 6836d63 commit 6c27535
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions calculate_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,28 +138,31 @@ def search_for_fault_location(
else:
tb_id = goldenrun_tb_info.at[idtbinfo, "id"]
for filt in filter_lists:
if filt[0] == tb_id:
ins = filt[len(filt) - trigger_position]
trigger_position = 0
break
if filt[0] != tb_id:
continue
ins = filt[len(filt) - trigger_position]
trigger_position = 0
break
else:
tb_id = goldenrun_tb_exec.at[idx, "tb"]
for filt in filter_lists:
"""found matching filter"""
if filt[0] == tb_id:
for i in range(0, len(filt), 1):
if filt[i] == ins:
"""Case ins is in the current tb"""
if i >= trigger_position:
i -= trigger_position
ins = filt[i]
trigger_position = 0
else:
"""Case ins is not in the current tb"""
trigger_not_in_same_tb = 1
trigger_position -= i
idx -= 1
break
if filt[0] != tb_id:
continue
for i in range(0, len(filt), 1):
if filt[i] != ins:
continue
"""Case ins is in the current tb"""
if i >= trigger_position:
i -= trigger_position
ins = filt[i]
trigger_position = 0
else:
"""Case ins is not in the current tb"""
trigger_not_in_same_tb = 1
trigger_position -= i
idx -= 1
break
# Got trigger address, now calculate the trigger hitcounter
trigger_tb = goldenrun_tb_exec.at[idx, "tb"]
tb_hitcounters = goldenrun_tb_exec.iloc[0 : idx + 1].tb.value_counts()
Expand Down

0 comments on commit 6c27535

Please sign in to comment.