Skip to content

Commit

Permalink
Use array.frombytes() instead array.fromfile()
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscozdo committed Feb 2, 2024
1 parent 738b1b6 commit ba2b20c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kftlib/kftlib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def inspect_kft_file(path: Path,

# File should contain kft entries which have 8B size
assert size % 8 == 0
n_entries = int(size / 8)
entries = int(size / 8)
mb_size = size / 1024 / 1024
logging.info(f'Reading file of size {mb_size}MB' f'({n_entries} entries)')
logging.info(f'Reading file of size {mb_size}MB' f'({entries} entries)')

events: Dict[int, List[KFTEvent]] = defaultdict(list)
td_time = [0] * (td_max + 1) # elapsed time
Expand All @@ -45,7 +45,7 @@ def inspect_kft_file(path: Path,

entries = array('Q')
with open(path, 'rb') as f:
entries.fromfile(f, n_entries)
entries.frombytes(f.read())

for i, v in enumerate(entries):
thread, event = KFTEvent.decode(v, elf.kernel_start)
Expand Down

0 comments on commit ba2b20c

Please sign in to comment.