PyUtilib / pyutilib

A collection of general Python utilities, including logging and file IO, subprocess management, plugin systems, and workflow management.
BSD 3-Clause "New" or "Revised" License
34 stars 20 forks source link

Add a Hierarchical timer class #96

Closed michaelbynum closed 4 years ago

michaelbynum commented 4 years ago

Summary/Motivation:

This Pr adds a class for hierarchical timing.

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.
coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.8%) to 61.847% when pulling 2feaa83b4afb80586d5e94b4e0deb4a7388a76d6 on michaelbynum:hierarchical_timer into ad6043c52aff125d135413f36e0db39dcd54bf83 on PyUtilib:master.

codecov-io commented 4 years ago

Codecov Report

Merging #96 into master will increase coverage by 0.79%. The diff coverage is 93.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #96      +/-   ##
==========================================
+ Coverage   63.13%   63.93%   +0.79%     
==========================================
  Files          87       87              
  Lines        8788     8916     +128     
==========================================
+ Hits         5548     5700     +152     
+ Misses       3240     3216      -24     
Impacted Files Coverage Δ
pyutilib/misc/timing.py 76.76% <93.75%> (+76.76%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ad6043c...913df89. Read the comment docs.

michaelbynum commented 4 years ago

@jsiirola Great suggestions. I never realized the TicTocTimer tracked cumulative time and number of calls. I also did not know about time.perf_counter or time.clock, so thanks. Let me know what you think of the new changes.

michaelbynum commented 4 years ago

@jsiirola I think this is ready now. Thanks for all the great suggestions. I am very happy with this timer now.

jsiirola commented 4 years ago

@michaelbynum: some questions/comments as I go through this:

I have some ideas around addressing the above. Would you like me to draft something as a PR to your branch?

michaelbynum commented 4 years ago

@jsiirola

michaelbynum commented 4 years ago

@jsiirola Looks good. Thanks for these changes.

carldlaird commented 4 years ago

I agree. Thank you both for this - this looks great - and will definitely get used in a few of our projects.