TimerDeltaSigma
public struct TimerDeltaSigma
Usage examples:
Sample usage:
func demo_TimerDeltaSigma() {
var tds = TimerDeltaSigma()
for _ in 0 ..< 10 {
tds.printElapsedTimes()
}
print()
for _ in 0 ..< 5 {
tds.printElapsedTimes(.ms)
}
print()
for _ in 0 ..< 5 {
tds.printElapsedTimes(.s)
}
print()
}
```
Sample output:
```
Δ 0.000000, Σ 0.000000 s
Δ 0.000082, Σ 0.000082 s
...
Δ 0.000022, Σ 0.000260 s
Δ 0.000021, Σ 0.000281 s
Δ 0.000, Σ 0.000 s
...
Δ 0.000, Σ 0.000 s
Δ 0, Σ 0 s
...
Δ 0, Σ 0 s
```
-
Declaration
Swift
public enum Format : String
-
Declaration
Swift
typealias Elapsed = (delta: TimeInterval, sigma: TimeInterval)
-
Create an instance and start time measurement
Declaration
Swift
public init()
-
Print the times: Δ since the last print, Σ since the instance creation
Declaration
Swift
public mutating func printElapsedTimes(_ fmt: Format = .μs)
Parameters
fmt
resolution .s, .ms, .μs