From 750c23a3c75a0da814a6459d5e5fbfbaab25aa63 Mon Sep 17 00:00:00 2001 From: Christophe Bedard Date: Sun, 17 Nov 2019 14:38:20 -0800 Subject: [PATCH] Add flag for hiding processing results with the process verb --- .../ros2trace_analysis/verb/process.py | 1 + .../tracetools_analysis/process.py | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ros2trace_analysis/ros2trace_analysis/verb/process.py b/ros2trace_analysis/ros2trace_analysis/verb/process.py index 9d650e8..89f0f1c 100644 --- a/ros2trace_analysis/ros2trace_analysis/verb/process.py +++ b/ros2trace_analysis/ros2trace_analysis/verb/process.py @@ -27,4 +27,5 @@ class ProcessVerb(VerbExtension): return process( args.input_path, args.force_conversion, + args.hide_results, ) diff --git a/tracetools_analysis/tracetools_analysis/process.py b/tracetools_analysis/tracetools_analysis/process.py index ce985ad..0082b9a 100644 --- a/tracetools_analysis/tracetools_analysis/process.py +++ b/tracetools_analysis/tracetools_analysis/process.py @@ -41,6 +41,10 @@ def add_args(parser: argparse.ArgumentParser) -> None: '-f', '--force-conversion', dest='force_conversion', action='store_true', default=False, help='re-convert trace directory even if converted file is found') + parser.add_argument( + '-s', '--hide-results', dest='hide_results', + action='store_true', default=False, + help='hide/suppress results from being printed') def parse_args(): @@ -114,12 +118,14 @@ def inspect_input_path( def process( input_path: str, force_conversion: bool = False, + hide_results: bool = False, ) -> Optional[int]: """ Process converted trace file. :param input_path: the path to a converted file or trace directory :param force_conversion: whether to re-creating converted file even if it is found + :param hide_results: whether to hide results and not print them """ converted_file_path, create_converted_file = inspect_input_path(input_path, force_conversion) @@ -139,13 +145,16 @@ def process( processor.process(events) time_diff = time.time() - start_time - processor.print_data() + if not hide_results: + processor.print_data() print(f'processed {len(events)} events in {time_diff_to_str(time_diff)}') def main(): args = parse_args() - input_path = args.input_path - force_conversion = args.force_conversion - process(input_path, force_conversion) + process( + args.input_path, + args.force_conversion, + args.hide_results, + )