diff --git a/edkrepo/commands/arguments/edkrepo_cmd_args.py b/edkrepo/commands/arguments/edkrepo_cmd_args.py index e8a6138404b..2fab8c17fd6 100644 --- a/edkrepo/commands/arguments/edkrepo_cmd_args.py +++ b/edkrepo/commands/arguments/edkrepo_cmd_args.py @@ -3,7 +3,7 @@ ## @file # argument_strings.py # -# Copyright (c) 2017- 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -17,3 +17,4 @@ SUBMODULE_SKIP_HELP = 'Skip the pull or sync of any submodules.' COLOR_HELP = 'Force color output (useful with \'less -r\')' SOURCE_MANIFEST_REPO_HELP = "The name of the workspace's source global manifest repository" +PERFORMANCE_HELP = 'Displays performance timing data for successful commands' diff --git a/edkrepo/commands/composite_command.py b/edkrepo/commands/composite_command.py index ff53d3b8107..72cb02930d9 100644 --- a/edkrepo/commands/composite_command.py +++ b/edkrepo/commands/composite_command.py @@ -7,7 +7,8 @@ # SPDX-License-Identifier: BSD-2-Clause-Patent # -from edkrepo.commands.edkrepo_command import VerboseArgument +from edkrepo.commands.edkrepo_command import VerboseArgument, PerformanceArgument + class CompositeCommand(object): def __init__(self): @@ -21,6 +22,7 @@ def get_metadata(self, command_name): if command.get_metadata()['name'] == command_name: metadata = command.get_metadata() args = metadata['arguments'] + args.append(PerformanceArgument) args.append(VerboseArgument) metadata['arguments'] = args return metadata diff --git a/edkrepo/commands/edkrepo_command.py b/edkrepo/commands/edkrepo_command.py index edd29a9ab68..320dd9c674c 100644 --- a/edkrepo/commands/edkrepo_command.py +++ b/edkrepo/commands/edkrepo_command.py @@ -3,7 +3,7 @@ ## @file # edkrepo_command.py # -# Copyright (c) 2017- 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -54,3 +54,8 @@ def run_command(self, args, config): 'required' : False, 'action' : 'store', 'help-text' : arguments.SOURCE_MANIFEST_REPO_HELP} + +PerformanceArgument = {'name': 'performance', + 'positional': False, + 'required': False, + 'help-text': arguments.PERFORMANCE_HELP} diff --git a/edkrepo/edkrepo_cli.py b/edkrepo/edkrepo_cli.py index 03061c962ba..4e7ff16d6ab 100644 --- a/edkrepo/edkrepo_cli.py +++ b/edkrepo/edkrepo_cli.py @@ -20,6 +20,7 @@ import inspect import imp import importlib.util +import datetime as dt from git.exc import GitCommandError @@ -157,6 +158,7 @@ def generate_command_completion_script(script_filename, parser): f.write(' complete -F _edkrepo_completions edkrepo\nfi\n') def main(): + start_time = dt.datetime.now() command = command_factory.create_composite_command() config = {} try: @@ -207,6 +209,8 @@ def main(): traceback.print_exc() print("Error: {}".format(str(e))) return 1 + if parsed_args.performance: + print('\nExecution Time: {}'.format(dt.datetime.now() - start_time)) return 0 if __name__ == "__main__":