From ebb7f04196db42f5aa4b95c271ce550121d6c992 Mon Sep 17 00:00:00 2001 From: Jonathan Diamond Date: Fri, 22 Sep 2023 19:55:52 -0700 Subject: [PATCH] Output info for using `diagnostics.p1log` as profiling fallback. --- python/fusion_engine_client/analysis/analyzer.py | 14 ++++++++++++++ python/fusion_engine_client/utils/log.py | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/python/fusion_engine_client/analysis/analyzer.py b/python/fusion_engine_client/analysis/analyzer.py index e1119cd6..369e9422 100755 --- a/python/fusion_engine_client/analysis/analyzer.py +++ b/python/fusion_engine_client/analysis/analyzer.py @@ -166,6 +166,7 @@ def __init__(self, self.plots = {} self.summary = '' + self.profiling_present = False self._mapbox_token_missing = False @@ -2070,6 +2071,7 @@ def plot_legacy_atlas_system_status_profiling(self): if len(data.system_time) == 0: self.logger.info('No system profiling data available. Skipping plot.') return + self.profiling_present = True time = data.system_time - self.system_t0 @@ -2124,6 +2126,7 @@ def plot_execution_stats_profiling(self): if len(data.system_time_sec) == 0: self.logger.info('No execution profiling stats data available. Skipping plot.') return + self.profiling_present = True # Read the last task name message to map IDs to names. params = copy.deepcopy(self.params) @@ -2412,6 +2415,7 @@ def plot_counter_profiling(self, device_uart): if len(data.system_time_sec) == 0: self.logger.info('No counter profiling stats data available. Skipping execution stats plot.') return + self.profiling_present = True # Read the last task name message to map IDs to names. params = copy.deepcopy(self.params) @@ -2506,6 +2510,7 @@ def plot_free_rtos_system_status_profiling(self): if len(data.system_time_sec) == 0: self.logger.info('No FreeRTOS system profiling data available. Skipping plot.') return + self.profiling_present = True # Read the last task name message to map IDs to names. params = copy.deepcopy(self.params) @@ -2573,6 +2578,7 @@ def plot_measurement_pipeline_profiling(self): if len(data.system_time) == 0: self.logger.info('No measurement profiling data available. Skipping plot.') return + self.profiling_present = True # Read the last pipeline definition message to map IDs to names. params = copy.deepcopy(self.params) @@ -2614,6 +2620,7 @@ def plot_execution_profiling(self): if len(data.points) == 0: self.logger.info('No execution profiling data available. Skipping code execution plot.') return + self.profiling_present = True # Read the last pipeline definition message to map IDs to names. params = copy.deepcopy(self.params) @@ -3309,6 +3316,13 @@ def main(): analyzer.plot_execution_profiling() analyzer.plot_execution_stats_profiling() analyzer.plot_counter_profiling(options.device_uart) + if not analyzer.profiling_present and options.original: + diag_path = os.path.join(os.path.dirname(input_path), 'diagnostics.p1log') + if os.path.exists(diag_path): + _logger.info('*' * 80 + '\n\n' + + f'No profiling available in {input_path}.\n' + f'use {diag_path} to generate plots with profiling.' + + '\n\n' + '*' * 80) else: if len(options.plot) == 0: _logger.error('No plot names specified.') diff --git a/python/fusion_engine_client/utils/log.py b/python/fusion_engine_client/utils/log.py index f3b0393e..2635790c 100644 --- a/python/fusion_engine_client/utils/log.py +++ b/python/fusion_engine_client/utils/log.py @@ -19,8 +19,9 @@ # by extract_fusion_engine_log(). 'input.p1log', 'fusion_engine.p1log', - # diagnostic log is giving priority for internal tools. - 'output/diagnostics.p1log', + # Current Atlas produces `output/diagnostics.p1log` with profiling data as backup in case + # `output/fusion_engine.p1log` has profiling turned off. Specify it explicitly as the log argument to use it. + # 'output/diagnostics.p1log', 'output/fusion_engine.p1log', # v- Mixed FE and other data files. # Note that we prioritize the input.66.bin file over the others. For logs containing a single mixed serial