Skip to content

Commit

Permalink
Allocate strings for hdf5 dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
berkayurun authored and lukasauer committed Oct 10, 2023
1 parent c573df1 commit 3d381eb
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions hdf5logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,6 @@


# Tables for storing the elements from queue
class translation_block_table(tables.IsDescription):
identity = tables.UInt64Col()
size = tables.UInt64Col()
ins_count = tables.UInt64Col()
num_exec = tables.UInt64Col()
assembler = tables.StringCol(1000)


class translation_block_faulted_table(tables.IsDescription):
faultaddress = tables.UInt64Col()
assembler = tables.StringCol(1000)


class translation_block_exec_table(tables.IsDescription):
tb = tables.UInt64Col()
pos = tables.UInt64Col()
Expand Down Expand Up @@ -135,6 +122,14 @@ class riscv_registers_table(tables.IsDescription):


def process_tb_faulted(f, group, tbfaulted_list, myfilter):
assembler_size = max(
(len(tbfaulted["assembly"]) for tbfaulted in tbfaulted_list), default=1
)

class translation_block_faulted_table(tables.IsDescription):
faultaddress = tables.UInt64Col()
assembler = tables.StringCol(assembler_size)

tbfaultedtable = f.create_table(
group,
"tbfaulted",
Expand Down Expand Up @@ -252,6 +247,15 @@ def process_faults(f, group, faultlist, endpoint, end_reason, myfilter):


def process_tbinfo(f, group, tbinfolist, myfilter):
assembler_size = max((len(tbinfo["assembler"]) for tbinfo in tbinfolist), default=1)

class translation_block_table(tables.IsDescription):
identity = tables.UInt64Col()
size = tables.UInt64Col()
ins_count = tables.UInt64Col()
num_exec = tables.UInt64Col()
assembler = tables.StringCol(assembler_size)

tbinfotable = f.create_table(
group,
"tbinfo",
Expand Down

0 comments on commit 3d381eb

Please sign in to comment.