ios - How to log a method's execution time exactly in milliseconds? -
There is no way to determine how often the method should be executed (in milliseconds)?
NSDate * methodStart = [NSDate date]; / * ... Whatever you need to do ... * / NSDate * methodFinish = [NSDate date]; NSTime Interval Execution Time = [methodFinish timeIntervalSinceDate: Method Start]; NSLog (@ "execution time =% F", execution time);
Swift:
Start method = NSDate () / * ... whatever you need to do. Swift 3:
/ P> Pre> start the method = date () / * ... whatever you need to do ... * / methodfinish = date () execute execution time = methodfinish. TimeInternationalSign (method start) Print ("Execution time: \ (execution time)")
Easy to use and the sub-millisecond accuracy.
Comments
Post a Comment