From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.2540.1601941146536205067 for ; Mon, 05 Oct 2020 16:39:06 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: erik.c.bjorge@intel.com) IronPort-SDR: VJ2hOXKMzgFusJDQxqxRptVNPoxnnQyZddx0Gq+brbzaOpf88ebJzvJkVguV+OZzBUujsFuAR8 yfNKTKox6Ehg== X-IronPort-AV: E=McAfee;i="6000,8403,9765"; a="181714234" X-IronPort-AV: E=Sophos;i="5.77,341,1596524400"; d="scan'208";a="181714234" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2020 16:34:34 -0700 IronPort-SDR: Adcgk8d3zDhsOmurdrIcdXIxztB24QrG/gdxhwiqUeHjya4WB/CSHaAGQomYZ//itkAPgqMe3C KToZ6ykEXlUQ== X-IronPort-AV: E=Sophos;i="5.77,341,1596524400"; d="scan'208";a="353766258" Received: from ecbjorge-mobl1.amr.corp.intel.com ([10.212.227.145]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2020 14:55:23 -0700 From: "Bjorge, Erik C" To: devel@edk2.groups.io Cc: Ashley E Desimone , Nate DeSimone , Puja Pandya , Bret Barkelew , Prince Agyeman Subject: [edk2-staging/EdkRepo] [PATCH v2] EdkRepo: Adding performance option Date: Mon, 5 Oct 2020 14:54:47 -0700 Message-Id: X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This new option will display the execution time of a successful command. Cc: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Bret Barkelew Cc: Prince Agyeman Cc: Erik Bjorge Signed-off-by: Erik Bjorge --- edkrepo/commands/arguments/edkrepo_cmd_args.py | 3 ++- edkrepo/commands/composite_command.py | 4 +++- edkrepo/commands/edkrepo_command.py | 7 ++++++- edkrepo/edkrepo_cli.py | 4 ++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/edkrepo/commands/arguments/edkrepo_cmd_args.py b/edkrepo/commands/arguments/edkrepo_cmd_args.py index e8a6138..2fab8c1 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 @@ OVERRIDE_HELP = 'Ignore warnings' 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 ff53d3b..72cb029 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 @@ class CompositeCommand(object): 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 edd29a9..320dd9c 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 @@ SourceManifestRepoArgument = {'name' : 'source-manifest-repo', '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 03061c9..4e7ff16 100644 --- a/edkrepo/edkrepo_cli.py +++ b/edkrepo/edkrepo_cli.py @@ -20,6 +20,7 @@ import site 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__": -- 2.21.0.windows.1