Skip to content

Commit

Permalink
Improvements for event table printout. (#277)
Browse files Browse the repository at this point in the history
# Changes
- Include name in reset event mask printout if a recognized mask (e.g. cold start)

# Fixes
- Fixed missing column header in event table if there are no software reset events present
  • Loading branch information
adamshapiro0 authored Oct 13, 2023
2 parents 01e6a7b + 6b0503e commit 3a1ad56
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
7 changes: 2 additions & 5 deletions python/fusion_engine_client/analysis/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2082,11 +2082,8 @@ def plot_events(self):
return

times_before_resets = self.extract_times_before_reset()
if (len(times_before_resets) > 0):
table_columns = ['Relative Time (s)', 'System Time (s)', 'Previous P1 Time (s)', 'Event', 'Flags',
'Description']
else:
table_columns = ['Relative Time (s)', 'System Time (s)', 'Event', 'Flags', 'Description']
table_columns = ['Relative Time (s)', 'System Time (s)', 'Previous P1 Time (s)', 'Event', 'Flags',
'Description']

rows = []
system_t0_ns = self.reader.get_system_t0_ns()
Expand Down
29 changes: 27 additions & 2 deletions python/fusion_engine_client/messages/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,36 @@ def calcsize(cls) -> int:

def __repr__(self):
result = super().__repr__()[:-1]
result += f', mask=0x{self.reset_mask:08X}]'
mask_text = f'0x{self.reset_mask:08X}'
name = self._get_known_mask_name(self.reset_mask)
if name is not None:
mask_text += f' ({name})'
result += f', mask={mask_text}]'
return result

def __str__(self):
return 'Reset Request [mask=0x%08x]' % self.reset_mask
mask_text = f'0x{self.reset_mask:08X}'
name = self._get_known_mask_name(self.reset_mask)
if name is not None:
mask_text += f' ({name})'
return f'Reset Request [mask={mask_text}]'

@classmethod
def _get_known_mask_name(cls, mask) -> str:
if mask == cls.HOT_START:
return 'HOT_START'
elif mask == cls.WARM_START:
return 'WARM_START'
elif mask == cls.PVT_RESET:
return 'PVT_RESET'
elif mask == cls.COLD_START:
return 'COLD_START'
elif mask == cls.FACTORY_RESET:
return 'FACTORY_RESET'
elif mask & cls.DIAGNOSTIC_LOG_RESET:
return 'DIAGNOSTIC_LOG_RESET'
else:
return None


class VersionInfoMessage(MessagePayload):
Expand Down
3 changes: 2 additions & 1 deletion python/fusion_engine_client/parsers/mixed_log_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ def __init__(self, input_file, warn_on_gaps: bool = False, show_progress: bool =
self.max_bytes = max_bytes

# Open the companion index file if one exists, otherwise index the file.
self._original_index = fast_indexer.fast_generate_index(input_path, force_reindex=ignore_index, save_index=save_index, max_bytes=max_bytes)
self._original_index = fast_indexer.fast_generate_index(input_path, force_reindex=ignore_index,
save_index=save_index, max_bytes=max_bytes)
self.next_index_elem = 0
self.index = self._original_index[self.message_types][self.time_range]
self.filtered_message_types = len(np.unique(self._original_index.type)) != \
Expand Down

0 comments on commit 3a1ad56

Please sign in to comment.