swift-metrics
swift-metrics copied to clipboard
adds support for swift-concurrency Duration and async closures for Timer measurements
extends Timer with support for standard lib Duration type and measurements to relative to Instant on Clocks using Duration
Motivation:
Use of Timer is currently clunky with async code as any durations need to be manually converted to microseconds (et al)
Modifications:
Extends Timer with:
- method to record duration since
Clock.Instanton anyClockusingDuration - methods that use static continuous/suspending clock by default with corresponding instant types
- methods to measure duration of an async closure with provided
Clockor defaultContinuousClock
Result:
Additional Timer methods available for measuring async work
note: need to remove Timer.record(duration: Duration) when https://github.com/apple/swift-metrics/pull/133 lands
@AndriusA Can you update this PR so we can start to review it?