NSDate *startTime = [NSDate date];
{ ... } // the operation that I'm timing
NSTimeInterval elapsedTime = -[startTime timeIntervalSinceNow];
NSLog(@"That took %f seconds", elapsedTime);
This code grabs the current time using NSDate, does something, calculates the time spent doing the operation, and then logs the result.
No comments:
Post a Comment