How to calculate the time taken to load a view/window? This can be done by this:
NSDate *startTime=[NSDate date];
//some code to load another window from winController
NSDate *endTime=[NSDate date];
NSTimeInterval diff = [endTime timeIntervalSinceDate:startTime];
NSLog(@"Time to load is %f seconds.\n\n\n",diff);
But it will not calculate the total and exact time taken. To load a window, and then in init and awakeFromNib it asynchronously calls services, loads custom views, populates tableviews etc, and which is spread on dozens of classes/controllers and scores of methods.
If I use the above(program shown), the endTime
is reached while spinner continues to spin and service calls are in progress.
I can check by watching Clock that it takes more than a minute to load the window, and to ready to perform any action on it, but diff
is calculates to 0.5 seconds something.
Now the problem is that I can not change the whole code of project, however I can insert few things in between.
How to do this, suggestions will be appreciated.