How to use NSTimer to check the performance of function?
How to use NSTimer to check the performance of function? Actually, I am making a dylib which is Cydia Software. I have found many resources, but I still don't know which part of my function开发者_如何学JAVAs slow down whole program. I need someone's help....
Why don't you try and use Instruments with time profiler? This will give you plenty of information without the hassle of having to come up with a timer based handcrafted profiler.
Have a look at this article for more details.
The clock function returns a tick of type clock_t that is defined by a CLOCKS_PER_SEC constants. Posix requires this value to be 1000000 ticks per second (microsecond), but that is not guaranteed by ANSI-C. So, you should check CLOCKS_PER_SEC to see the actually resolution on your platform.
duplicated question: How to measure time in milliseconds using ANSI C?
精彩评论