1) Declare an NSDate and set it to [NSDate date]
2) Run the code you want to test
3) Get an NSInterval from the NSDate by sending the timeIntervalSinceNow message
So for example:
NSDate* date = [NSDate date];
//RUN some expensive code her
NSTimeInterval interval = [date timeIntervalSinceNow];
NSLog(@"Time running expensive code: %f", interval);
No comments:
Post a Comment