* [edk2-staging/EdkRepo] [PATCH v1] EdkRepo: Add timing for commands @ 2020-10-02 18:20 Bjorge, Erik C 2020-10-02 19:46 ` Nate DeSimone 0 siblings, 1 reply; 3+ messages in thread From: Bjorge, Erik C @ 2020-10-02 18:20 UTC (permalink / raw) To: devel Cc: Ashley E Desimone, Nate DeSimone, Puja Pandya, Bret Barkelew, Prince Agyeman 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 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [edk2-staging/EdkRepo] [PATCH v1] EdkRepo: Add timing for commands 2020-10-02 18:20 [edk2-staging/EdkRepo] [PATCH v1] EdkRepo: Add timing for commands Bjorge, Erik C @ 2020-10-02 19:46 ` Nate DeSimone [not found] ` <MW3PR11MB455429AF451846632C7218F2AE310@MW3PR11MB4554.namprd11.prod.outlook.com> 0 siblings, 1 reply; 3+ messages in thread From: Nate DeSimone @ 2020-10-02 19:46 UTC (permalink / raw) To: Bjorge, Erik C, devel@edk2.groups.io Cc: Desimone, Ashley E, Pandya, Puja, Bret Barkelew, Agyeman, Prince I don't think we should print execution time every time. Maybe a --performance flag or something to that effect? > -----Original Message----- > From: Erik Bjorge <erik.c.bjorge@intel.com> > Sent: Friday, October 2, 2020 11:21 AM > 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: Add timing for > commands > > 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <MW3PR11MB455429AF451846632C7218F2AE310@MW3PR11MB4554.namprd11.prod.outlook.com>]
* Re: [edk2-staging/EdkRepo] [PATCH v1] EdkRepo: Add timing for commands [not found] ` <MW3PR11MB455429AF451846632C7218F2AE310@MW3PR11MB4554.namprd11.prod.outlook.com> @ 2020-10-05 20:22 ` Nate DeSimone 0 siblings, 0 replies; 3+ messages in thread From: Nate DeSimone @ 2020-10-05 20:22 UTC (permalink / raw) To: Bjorge, Erik C, devel@edk2.groups.io Cc: Desimone, Ashley E, Pandya, Puja, Bret Barkelew, Agyeman, Prince Its not a bad idea to move it a little deeper anyway since we have multiple entry points that make EdkRepo work regardless of whether you are using virtualenv, or -m, or Python launcher for Windows, etc... > -----Original Message----- > From: Bjorge, Erik C <erik.c.bjorge@intel.com> > Sent: Friday, October 2, 2020 1:34 PM > To: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; > devel@edk2.groups.io > Cc: Desimone, Ashley E <ashley.e.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: Add timing for > commands > > Sure, I can do that but then I would also want to move the timing deeper into > the code to leverage the existing command line parsing support. It will not > be quite as accurate but should be fine in general. > > I will make the change and submit V2. > > Thanks, > -Erik > > -----Original Message----- > From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com> > Sent: Friday, October 2, 2020 12:47 PM > To: Bjorge, Erik C <erik.c.bjorge@intel.com>; devel@edk2.groups.io > Cc: Desimone, Ashley E <ashley.e.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: Add timing for > commands > > I don't think we should print execution time every time. Maybe a -- > performance flag or something to that effect? > > > -----Original Message----- > > From: Erik Bjorge <erik.c.bjorge@intel.com> > > Sent: Friday, October 2, 2020 11:21 AM > > 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: Add timing for > > commands > > > > 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-05 20:50 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-10-02 18:20 [edk2-staging/EdkRepo] [PATCH v1] EdkRepo: Add timing for commands Bjorge, Erik C 2020-10-02 19:46 ` Nate DeSimone [not found] ` <MW3PR11MB455429AF451846632C7218F2AE310@MW3PR11MB4554.namprd11.prod.outlook.com> 2020-10-05 20:22 ` Nate DeSimone
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox