public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Bjorge, Erik C" <erik.c.bjorge@intel.com>
To: devel@edk2.groups.io
Cc: Ashley E Desimone <ashley.e.desimone@intel.com>,
	Nate DeSimone <nathaniel.l.desimone@intel.com>,
	Puja Pandya <puja.pandya@intel.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>,
	Prince Agyeman <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH v1] EdkRepo: Add timing for commands
Date: Fri,  2 Oct 2020 11:20:37 -0700	[thread overview]
Message-ID: <8ae2a21328583856d405bc3d9215e3482dad580d.1601662737.git.erik.c.bjorge@intel.com> (raw)

Added command timing in the entry point.

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/edkrepo_entry_point.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/edkrepo/edkrepo_entry_point.py b/edkrepo/edkrepo_entry_point.py
index dd2b36e..e944b7a 100644
--- a/edkrepo/edkrepo_entry_point.py
+++ b/edkrepo/edkrepo_entry_point.py
@@ -82,8 +82,11 @@ if __name__ == "__main__" or run_via_launcher_script:
                     sys.exit(1)
 
 from edkrepo.config.config_factory import GlobalConfig
+import datetime as dt
+
 
 def main():
+    start = dt.datetime.now()
     cfg_file = GlobalConfig()
     pref_entry = (cfg_file.preferred_entry[0]).replace('.py', '')
     pref_entry_func = cfg_file.preferred_entry[1]
@@ -91,12 +94,15 @@ def main():
     try:
         mod = importlib.import_module(pref_entry)
         func = getattr(mod, pref_entry_func)
-        return(func())
-    except Exception as e:
+        ret_code = func()
+    except Exception:
         print('Unable to launch preferred entry point. Launching default entry point edkrepo.edkrepo_cli.py')
         traceback.print_exc()
         import edkrepo.edkrepo_cli
-        return edkrepo.edkrepo_cli.main()
+        ret_code = edkrepo.edkrepo_cli.main()
+    print('\nExecution Time: {}'.format(dt.datetime.now() - start))
+    return ret_code
+
 
 if __name__ == "__main__":
     try:
-- 
2.21.0.windows.1


             reply	other threads:[~2020-10-02 18:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-02 18:20 Bjorge, Erik C [this message]
2020-10-02 19:46 ` [edk2-staging/EdkRepo] [PATCH v1] EdkRepo: Add timing for commands Nate DeSimone
     [not found]   ` <MW3PR11MB455429AF451846632C7218F2AE310@MW3PR11MB4554.namprd11.prod.outlook.com>
2020-10-05 20:22     ` 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=8ae2a21328583856d405bc3d9215e3482dad580d.1601662737.git.erik.c.bjorge@intel.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