-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Timer.measure
methods
#140
base: main
Are you sure you want to change the base?
Conversation
# Motivation This PR supersedes #135. The goal is to make it easier to measure asynchronous code when using `Metrics`. # Modification This PR does: - Deprecate the current static method for measuring synchronous code - Add a new instance method to measure synchronous code - Add a new instance method to measure asynchronous code # Result It is now easier to measure asynchronous code.
@swift-server-bot test this please |
@swift-server-bot add to allowlist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a nit about docs.
return try body() | ||
} | ||
|
||
/// Convenience for measuring duration of a closure with a provided clock. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: the doc for this method and the non-async version don't match. Maybe remove the last bit to match that one, since we're defaulting the clock
param anyways?
/// Convenience for measuring duration of a closure with a provided clock. | |
/// Convenience for measuring duration of a closure. |
@swift-server-bot test this please |
Motivation
This PR supersedes #135. The goal is to make it easier to measure asynchronous code when using
Metrics
.Modification
This PR does: