From bedec9d5f6259028022cc248c3f0e1028c2bc13f Mon Sep 17 00:00:00 2001 From: iwatake Date: Sat, 1 Jun 2024 17:49:38 +0900 Subject: [PATCH] feat: support reading multi trace data (#175) Signed-off-by: takeshi.iwanari --- report/README.md | 2 ++ report/report_analysis/analyze_all.py | 9 ++++++--- report/report_analysis/make_report.sh | 1 + report/report_validation/make_report.sh | 1 + report/report_validation/validate_all.py | 9 ++++++--- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/report/README.md b/report/README.md index 8f31cf6a..895904f3 100644 --- a/report/README.md +++ b/report/README.md @@ -34,6 +34,7 @@ export is_html_only=false # (optional) Set true if yo export find_valid_duration=false # (optional) Set true so that start_strip is automatically detected export duration=0 # (optional) Set a value (second) for duration to calculate end_strip export trace_data=~/.ros/tracing/session-yyyymmddhhmmss # Path to CARET trace data (CTF file) +export sub_trace_data=~/.ros/tracing/session-yyyymmddhhmmss_sub # (optional) Path to CARET trace data recorded in Sub ECU (CTF file) sh ${script_path}/make_report.sh ``` @@ -72,6 +73,7 @@ export is_html_only=false # (optional) Set true if yo export find_valid_duration=false # (optional) Set true so that start_strip is automatically detected export duration=0 # (optional) Set a value (second) for duration to calculate end_strip export trace_data=~/.ros/tracing/session-yyyymmddhhmmss # Path to CARET trace data (CTF file) +export sub_trace_data=~/.ros/tracing/session-yyyymmddhhmmss_sub # (optional) Path to CARET trace data recorded in Sub ECU (CTF file) sh ${script_path}/make_report.sh ``` diff --git a/report/report_analysis/analyze_all.py b/report/report_analysis/analyze_all.py index f0f0fd31..2ca4d61b 100644 --- a/report/report_analysis/analyze_all.py +++ b/report/report_analysis/analyze_all.py @@ -36,6 +36,7 @@ def parse_arg(): description='Script to make analysis reports') parser.add_argument('trace_data', nargs=1, type=str) parser.add_argument('dest_dir', nargs=1, type=str) + parser.add_argument('--sub_trace_data', type=str, default='') parser.add_argument('--component_list_json', type=str, default='') parser.add_argument('--start_strip', type=float, default=0.0, help='Start strip [sec] to load trace data') @@ -77,6 +78,7 @@ def main(): logger.debug(f'trace_data: {args.trace_data}') args.dest_dir = args.dest_dir[0] logger.debug(f'dest_dir: {args.dest_dir}') + logger.debug(f'sub_trace_data: {args.sub_trace_data}') logger.debug(f'component_list_json: {args.component_list_json}') logger.debug(f'start_strip: {args.start_strip}, end_strip: {args.end_strip}') logger.debug(f'sim_time: {args.sim_time}') @@ -93,8 +95,9 @@ def main(): logger.debug(f'skip_first_num: {args.skip_first_num}') # Read trace data - lttng = read_trace_data(args.trace_data, args.start_strip, args.end_strip, False) - arch = Architecture('lttng', args.trace_data) + trace_data = args.trace_data if args.sub_trace_data == '' else [args.trace_data, args.sub_trace_data] + lttng = read_trace_data(trace_data, args.start_strip, args.end_strip, False) + arch = Architecture('lttng', trace_data) # Create architecture for path analysis arch_path = add_path_to_architecture.add_path_to_architecture(args, arch) @@ -108,7 +111,7 @@ def main(): args.end_strip = end_strip logger.info(f'Find valid duration. start_strip: {args.start_strip}, end_strip: {args.end_strip}') logger.info(f'Reload trace data') - lttng = read_trace_data(args.trace_data, args.start_strip, args.end_strip, False) + lttng = read_trace_data(trace_data, args.start_strip, args.end_strip, False) app = Application(arch_path, lttng) # Analyze diff --git a/report/report_analysis/make_report.sh b/report/report_analysis/make_report.sh index b49e150f..b571cd25 100644 --- a/report/report_analysis/make_report.sh +++ b/report/report_analysis/make_report.sh @@ -28,6 +28,7 @@ if ${use_python}; then if ! ${is_html_only}; then # Analyze python3 "${script_path}"/report_analysis/analyze_all.py "${trace_data}" "${report_dir_name}" \ + --sub_trace_data="${sub_trace_data}" \ --component_list_json="${component_list_json}" \ --start_strip "${start_strip}" \ --end_strip "${end_strip}" \ diff --git a/report/report_validation/make_report.sh b/report/report_validation/make_report.sh index 5e918223..264a7bda 100644 --- a/report/report_validation/make_report.sh +++ b/report/report_validation/make_report.sh @@ -29,6 +29,7 @@ if ${use_python}; then if ! ${is_html_only}; then # Analyze and validate python3 "${script_path}"/report_validation/validate_all.py "${trace_data}" "${report_dir_name}" \ + --sub_trace_data="${sub_trace_data}" \ --component_list_json="${component_list_json}" \ --start_strip "${start_strip}" \ --end_strip "${end_strip}" \ diff --git a/report/report_validation/validate_all.py b/report/report_validation/validate_all.py index 44f4beb3..492700bc 100644 --- a/report/report_validation/validate_all.py +++ b/report/report_validation/validate_all.py @@ -37,6 +37,7 @@ def parse_arg(): description='Script to make validation reports') parser.add_argument('trace_data', nargs=1, type=str) parser.add_argument('dest_dir', nargs=1, type=str) + parser.add_argument('--sub_trace_data', type=str, default='') parser.add_argument('--component_list_json', type=str, default='') parser.add_argument('--start_strip', type=float, default=0.0, help='Start strip [sec] to load trace data') @@ -85,6 +86,7 @@ def main(): logger.debug(f'trace_data: {args.trace_data}') args.dest_dir = args.dest_dir[0] logger.debug(f'dest_dir: {args.dest_dir}') + logger.debug(f'sub_trace_data: {args.sub_trace_data}') logger.debug(f'component_list_json: {args.component_list_json}') logger.debug(f'start_strip: {args.start_strip}, end_strip: {args.end_strip}') logger.debug(f'sim_time: {args.sim_time}') @@ -106,8 +108,9 @@ def main(): logger.debug(f'expectation_callback_csv_filename: {args.expectation_callback_csv_filename}') # Read trace data - lttng = read_trace_data(args.trace_data, args.start_strip, args.end_strip, False) - arch = Architecture('lttng', args.trace_data) + trace_data = args.trace_data if args.sub_trace_data == '' else [args.trace_data, args.sub_trace_data] + lttng = read_trace_data(trace_data, args.start_strip, args.end_strip, False) + arch = Architecture('lttng', trace_data) # Create architecture for path analysis arch_path = add_path_to_architecture.add_path_to_architecture(args, arch) @@ -121,7 +124,7 @@ def main(): args.end_strip = end_strip logger.info(f'Find valid duration. start_strip: {args.start_strip}, end_strip: {args.end_strip}') logger.info(f'Reload trace data') - lttng = read_trace_data(args.trace_data, args.start_strip, args.end_strip, False) + lttng = read_trace_data(trace_data, args.start_strip, args.end_strip, False) app = Application(arch_path, lttng) # Analyze and validate