Created
December 9, 2015 01:23
-
-
Save kinwahlai/88e7d6b2c80b563fd6a1 to your computer and use it in GitHub Desktop.
function to measure block code executed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func measure(title: String, block: (finish:()-> Void) -> Void) { | |
let startTime = CFAbsoluteTimeGetCurrent() | |
block { | |
let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime | |
print("\(title):: Time: \(timeElapsed)") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment