Graphics Programs Reference
In-Depth Information
Time Profiler Instrument
The
Time Profiler
instrument finds wasted CPU cycles in an application. To see how this
works, add the following CPU cycle-wasting code to the end of your
drawRect:
meth-
od:
float f = 0.0;
for (int i = 0; i < 1000; i++) {
f = f + sin(sin(time(NULL) + i));
}
NSLog(@"f = %f", f);
Build and profile the application. When
Instruments
asks which instrument to use, choose
Time Profiler
(
Figure 21.16
). When
Instruments
launches the application and its window
appears, make sure that all three areas are visible by clicking the buttons in the
View
con-
trol to blue.
Figure 21.16 Time Profiler instrument