Skip to content

Commit

Permalink
Move tb_start_end creation to out of the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
berkayurun authored and lukasauer committed May 2, 2023
1 parent 197932d commit a27bd1e
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions calculate_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def search_for_fault_location(
fault_lifespan,
goldenrun_tb_exec,
goldenrun_tb_info,
tb_start_end,
):
logger.debug(f"Search trigger to fault INSN at 0x{fault_address:08x}")
[idx, ins] = find_fault(
Expand Down Expand Up @@ -164,19 +165,6 @@ def search_for_fault_location(
tb_hitcounters = goldenrun_tb_exec.iloc[0 : idx + 1].tb.value_counts()
trigger_hitcounter = tb_hitcounters[trigger_tb]

tb_start = goldenrun_tb_info["id"].copy()
tb_start.index = goldenrun_tb_info["id"]

tb_end = goldenrun_tb_info["id"] + goldenrun_tb_info["size"] - 1
tb_end.index = goldenrun_tb_info["id"]

tb_start_end = pandas.DataFrame(
{
"tb_start": tb_start,
"tb_end": tb_end,
}
)

# Is the trigger TB a sub-TB?
sub_tbs = tb_start_end[
(trigger_tb > tb_start_end["tb_start"]) & (trigger_tb <= tb_start_end["tb_end"])
Expand Down Expand Up @@ -218,6 +206,20 @@ def calculate_trigger_addresses(fault_list, goldenrun_tb_exec, goldenrun_tb_info
""""""
logger.info("Calculating trigger addresses")

# Create a dataframe with the start and end addresses of the tb's
tb_start = goldenrun_tb_info["id"].copy()
tb_start.index = goldenrun_tb_info["id"]

tb_end = goldenrun_tb_info["id"] + goldenrun_tb_info["size"] - 1
tb_end.index = goldenrun_tb_info["id"]

tb_start_end = pandas.DataFrame(
{
"tb_start": tb_start,
"tb_end": tb_end,
}
)

"check every fault list"
cachelist = []
lists = build_filters(goldenrun_tb_info)
Expand Down Expand Up @@ -260,6 +262,7 @@ def calculate_trigger_addresses(fault_list, goldenrun_tb_exec, goldenrun_tb_info
fault.lifespan,
goldenrun_tb_exec,
goldenrun_tb_info,
tb_start_end,
)
d = dict()
d["faultaddress"] = fault.address
Expand Down

0 comments on commit a27bd1e

Please sign in to comment.