measure(clock:isolation:body:)

Convenience for measuring duration of a closure.

Metrics.swift:147
iOS
16+
macOS
13+
tvOS
16+
watchOS
9+
func measure<Result, Failure, Clock>(clock: Clock = .continuous, isolation: isolated (any Actor)? = #isolation, body: () async throws(Failure) -> sending Result) async throws(Failure) -> sending sending Result where Failure : Error, Clock : Clock, Clock.Duration == Duration

Parameters

clock

The clock used for measuring the duration. Defaults to the continuous clock.

isolation

The isolation of the method. Defaults to the isolation of the caller.

body

The closure to record the duration of.