If I have the following method is there a way to use Instruments 4.0 to tell me that it took one second?
- (IBAction)sleepOneSecond:(id)sender
{
sleep(1);
}
Right now I am using this to get the desired effect:
- (IBAction)waitOneSecond:(id)sender
{
NSDate * startDate = [NSDate date];
sleep(1);
NSLog(@"%s took %lf seconds", __FUNCTION__,
[[NSDate date] timeIntervalSinceDate:startDate]);
}
Time Profiler and Sampler just give time on the CPU which does not help in this case.
With the Time Profiler Instrument, make sure it's set to "All Sample Counts" rather than "Running Sample Times" under "Sample Perspective".