Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed p1_print index disabling, and updated summary table. #261

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 8 additions & 33 deletions python/bin/p1_print
Original file line number Diff line number Diff line change
Expand Up @@ -160,34 +160,9 @@ other types of data.
_logger.error(str(e))
sys.exit(1)

# Check if any of the requested message types do _not_ have P1 time (e.g., profiling messages). The index file
# does not currently contain non-P1 time messages, so if we use it to search for messages we will end up
# skipping all of these ones. Instead, we disable the index and revert to full file search.
if read_index:
if len(message_types) == 0:
need_system_time = True
else:
need_system_time = False
for message_type in message_types:
cls = message_type_to_class[message_type]
message = cls()
if hasattr(message, 'p1_time'):
continue
else:
timestamps = getattr(message, 'timestamps', None)
if isinstance(timestamps, MeasurementDetails):
continue
else:
need_system_time = True
break

if need_system_time and options.time is not None:
_logger.info('Non-P1 time messages requested and time range specified. Disabling index file.')
read_index = False

# Process all data in the file.
reader = MixedLogReader(input_path, return_bytes=True, return_offset=True, show_progress=options.progress,
ignore_index=not read_index, generate_index=generate_index,
ignore_index=not read_index, generate_index=generate_index and read_index,
message_types=message_types, time_range=time_range)

if reader.generating_index() and (len(message_types) > 0 or options.time is not None):
Expand Down Expand Up @@ -280,12 +255,12 @@ other types of data.
_logger.info('Selected data size: %d B' % bytes_decoded)
_logger.info('')

format_string = '| {:<50} | {:>8} |'
_logger.info(format_string.format('Message Type', 'Count'))
_logger.info(format_string.format('-' * 50, '-' * 8))
for type, info in message_stats.items():
_logger.info(format_string.format(message_type_to_class[type].__name__, info['count']))
_logger.info(format_string.format('-' * 50, '-' * 8))
_logger.info(format_string.format('Total', total_messages))
format_string = '| {:<50} | {:>5} | {:>8} |'
_logger.info(format_string.format('Message Name', 'Type', 'Count'))
_logger.info(format_string.format('-' * 50, '-' * 5, '-' * 8))
for type, info in sorted(message_stats.items(), key=lambda x: int(x[0])):
_logger.info(format_string.format(message_type_to_class[type].__name__, int(type), info['count']))
_logger.info(format_string.format('-' * 50, '-' * 5, '-' * 8))
_logger.info(format_string.format('Total', '', total_messages))
elif total_messages == 0:
_logger.warning('No valid FusionEngine messages found.')
Loading