How can I find out which of my methods take the most time to execute in my iPad application?
Asked
Active
Viewed 169 times
0
-
Ask a different question: How can I tell how to speed up my code? Then answer it [*this way*](http://stackoverflow.com/a/1779343/23771). – Mike Dunlavey Oct 10 '12 at 17:24
2 Answers
1
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

Mutawe
- 6,464
- 3
- 47
- 90