From df4154d3ed4d7ad3c06200a95b872c9acc39b6e2 Mon Sep 17 00:00:00 2001 From: bohendo Date: Fri, 16 Feb 2024 17:41:16 -0500 Subject: [PATCH] log total elapsed time --- slither/tools/mutator/__main__.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/slither/tools/mutator/__main__.py b/slither/tools/mutator/__main__.py index f02b84f53..67602f99a 100644 --- a/slither/tools/mutator/__main__.py +++ b/slither/tools/mutator/__main__.py @@ -370,7 +370,18 @@ def main() -> (None): # pylint: disable=too-many-statements,too-many-branches,t uncaught_mutant_counts[1] = 0 uncaught_mutant_counts[2] = 0 - logger.info(blue(f"Finished Mutation Campaign in '{args.codebase}' \n")) + # Print the total time elapsed in a human-readable time format + elapsed_time = round(time.time() - start_time) + hours, remainder = divmod(elapsed_time, 3600) + minutes, seconds = divmod(remainder, 60) + if hours > 0: + elapsed_string = f"{hours} {'hour' if hours == 1 else 'hours'}" + elif minutes > 0: + elapsed_string = f"{minutes} {'minute' if minutes == 1 else 'minutes'}" + else: + elapsed_string = f"{seconds} {'second' if seconds == 1 else 'seconds'}" + + logger.info(blue(f"Finished mutation testing assessment of '{args.codebase}' in {elapsed_string}\n")) # endregion