Skip to content

⏲ A tiny package to measure code execution time. Only 20 lines of code.

License

Notifications You must be signed in to change notification settings

mezhevikin/Measure

Repository files navigation

Measure

⏱️ A tiny package to measure code execution time.

let measure = Measure(key: "create-user")
let user = User()
measure.finish()

Console

// ⏱️ Measure [create-user]: 0.00521 sec.

Measure async request

let measure = Measure(key: "request")
let url = URL(string: "https://httpbin.org/get")!
URLSession.shared.dataTask(with: url) { _, _, _ in
    let time = measure.finish()
    Analytics.send(event: "request", ["time" => time])
}.resume()

Swift Package Manager

https://github.com/mezhevikin/Measure.git