ZOSOpenTools / utils

Deprecated - Moved to https://github.com/ZOSOpenTools/meta
https://github.com/ZOSOpenTools/meta
Apache License 2.0
3 stars 2 forks source link

feat: add elapsed time for builds #130

Closed dougburns closed 1 year ago

dougburns commented 1 year ago

I wrote a function for elapsed time when testing the performance of the file tagging changes. It seemed useful enough to add in to the build properly.

dougburns commented 1 year ago

@MikeFultonDev I didn't know about $SECONDS until yesterday, either. I had written a whole function to parse the output from the date command, but this is much simpler.

All the elapsed times are the difference between the $SECONDS value at two points in the script, so setting it to zero at the start wouldn't make any difference to the result. The aim is to show the elapsed time between two points in the code.

There shouldn't be any need for people to do calculations with the output. It is structured so that you can have multiple timers active concurrently, so we can print whatever intervals people are interested in. For now, I've put in an info message showing the total time for the whole build script, and verbose messages for each of the main functions.

VERBOSE: 'bootstap completed in 0 seconds.'
VERBOSE: 'configure completed in 474 seconds.'
VERBOSE: 'build completed in 193 seconds.'
VERBOSE: 'check completed in 38 seconds.'
VERBOSE: 'install completed in 4 seconds.'
zopen-build completed in 756 seconds.

If there are other subfunctions or sections that would be useful to time, those can easily be added with a couple of extra lines. I can see that it might be useful to print source download times, for example.