public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-staging/EdkRepo] [PATCH v2] EdkRepo: Adding performance option
@ 2020-10-05 21:54 Bjorge, Erik C
  2020-10-08 23:15 ` [edk2-staging/EdkRepo] [PATCH v1] " Ashley E Desimone
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bjorge, Erik C @ 2020-10-05 21:54 UTC (permalink / raw)
  To: devel
  Cc: Ashley E Desimone, Nate DeSimone, Puja Pandya, Bret Barkelew,
	Prince Agyeman

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-09 20:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-05 21:54 [edk2-staging/EdkRepo] [PATCH v2] EdkRepo: Adding performance option Bjorge, Erik C
2020-10-08 23:15 ` [edk2-staging/EdkRepo] [PATCH v1] " Ashley E Desimone
2020-10-09 20:39 ` [edk2-staging/EdkRepo] [PATCH v2] " Nate DeSimone
2020-10-09 20:48 ` Nate DeSimone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox