public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ashley E Desimone" <ashley.e.desimone@intel.com>
To: "Bjorge, Erik C" <erik.c.bjorge@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Desimone, Nathaniel L" <nathaniel.l.desimone@intel.com>,
	"Pandya, Puja" <puja.pandya@intel.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>,
	"Agyeman, Prince" <prince.agyeman@intel.com>
Subject: Re: [edk2-staging/EdkRepo] [PATCH v1] EdkRepo: Adding performance option
Date: Thu, 8 Oct 2020 23:15:54 +0000	[thread overview]
Message-ID: <BY5PR11MB3973CEE56665387BA26425B5B20B0@BY5PR11MB3973.namprd11.prod.outlook.com> (raw)
In-Reply-To: <b6177112a96fc4acab7f95e87121ace49ea696e4.1601934787.git.erik.c.bjorge@intel.com>

Reviewed-by: Ashley DeSimone <ashley.e.desimone@intel.com>

-----Original Message-----
From: Erik Bjorge <erik.c.bjorge@intel.com> 
Sent: Monday, October 5, 2020 4:05 PM
To: devel@edk2.groups.io
Cc: Desimone, Ashley E <ashley.e.desimone@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH v1] EdkRepo: Adding performance option

This new option will display the execution time of a successful command.

Cc: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Signed-off-by: Erik Bjorge <erik.c.bjorge@intel.com>
---
 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.<BR>
+# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.<BR>
 # 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.<BR>
+# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.<BR>
 # 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


  reply	other threads:[~2020-10-08 23:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 21:54 [edk2-staging/EdkRepo] [PATCH v2] EdkRepo: Adding performance option Bjorge, Erik C
2020-10-08 23:15 ` Ashley E Desimone [this message]
2020-10-09 20:39 ` Nate DeSimone
2020-10-09 20:48 ` Nate DeSimone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BY5PR11MB3973CEE56665387BA26425B5B20B0@BY5PR11MB3973.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox