Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Identify the Bug or Feature request
implements #4514
Description of the Change
A new per-thread stack of
CodeTimer
is available to allow getting aCodeTimer
from anywhere. The top of the stack is always available by calling theCodeTimer.get()
static method. When a section of code needs to be timed with a report,CodeTimer.using(name, callback)
is used. This method creates a new timer, enables it if necessary, pushes it onto the stack, runs the callback, pops the timer back off the stack, and generates a report. In other words, it runs the callback during which a new timer is available viaCodeTimer.get()
, then reports the results.Additional changes include cleaning up
CodeTimer
by removing unused bits, making thestart()
/stop()
methods leaner in terms of itsHashMap<>
usage, and allowing dynamic IDs to clean up some calling code.I would advise ignoring whitespace in the diff, as the use of
CodeTimer.using()
has modified the indentation of the code.Possible Drawbacks
Should be none.
Documentation Notes
N/A
Release Notes
This change is