// Start timer
NSTimeInterval startTime = [NSDate timeIntervalSinceReferenceDate];
// Do something
for(double i=0; i < 1000000; i++ );
// Stop timer
NSTimeInterval endTime = [NSDate timeIntervalSinceReferenceDate];
// Get the elapsed time in milliseconds
NSTimeInterval elapsedTime = (endTime - startTime) * 1000;
// Send it to the Console
NSLog(@"Elapsed time in ms: %f", elapsedTime);
NSTimeInterval startTime = [NSDate timeIntervalSinceReferenceDate];
// Do something
for(double i=0; i < 1000000; i++ );
// Stop timer
NSTimeInterval endTime = [NSDate timeIntervalSinceReferenceDate];
// Get the elapsed time in milliseconds
NSTimeInterval elapsedTime = (endTime - startTime) * 1000;
// Send it to the Console
NSLog(@"Elapsed time in ms: %f", elapsedTime);
No comments:
Post a Comment