Reputation: 21
How can I find out which of my methods take the most time to execute in my iPad application?
Upvotes: 0
Views: 172
Reputation: 656
For better CPU analysis, you should use Time profiler in XCode Instruments.
Upvotes: 1
Reputation: 6524
Put an NSLog
at the beginning of the method and one at the end
the console shows the exact time for the NSLog
so thats how you can determine which takes log time
Example:
-(void)buttonsTag{
NSLog(@"Beginning of buttonsTag Method");
btn1.tag =1;
btn2.tag =2;
btn3.tag =3;
btn4.tag =4;
btn5.tag =5;
btn6.tag =6;
btn7.tag =7;
btn8.tag =8;
btn9.tag =9;
btn10.tag =10;
NSLog(@"End of buttonsTag Method");
}
//The console output:
//2012-10-10 14:22:29.308 APP[3691:c07] Beginning of buttonsTag Method
//2012-10-10 14:22:29.309 APP[3691:c07] End of buttonsTag Method
//The deference is 14:22:29.309 - 14:22:29.308 = 00:00:00.001
Upvotes: 1