如何使用NSTimer来检查函数的性能?
如何使用NSTimer来检查函数的性能? 实际上,我正在制作一个dylib,即Cydia Software。 我找到了很多资源,但我仍然不知道我的函数的哪一部分使整个速度变慢 程序。我需要有人的帮助......
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 functions slow down whole
program. I need someone's help....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不尝试将 Instruments 与时间分析器一起使用?这将为您提供大量信息,而无需提出基于计时器的手工分析器的麻烦。
看看这篇文章了解更多详情。
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.
时钟函数返回由 CLOCKS_PER_SEC 常量定义的 Clock_t 类型的时钟。 Posix 要求该值为每秒 1000000 个刻度(微秒),但 ANSI-C 不保证这一点。因此,您应该检查 CLOCKS_PER_SEC 以查看您平台上的实际分辨率。
重复的问题:如何使用 ANSI C 测量以毫秒为单位的时间?< /a>
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?