【发布时间】:2011-04-02 04:46:41
【问题描述】:
我正在寻找 iPhone 的高分辨率计时代码,以便进行一些性能计时。我想写这样的代码:
HighResolutionTimer* myTimer = [[HighResolutionTimer alloc]init];
[myTimer start];
[self doSomeLengthyOperation];
NSLog( @"doSomeLengthyOperation took %f seconds", [myTimer elapsedTime] );
【问题讨论】:
-
为什么不直接使用
getrusage()?在 C 中工作的任何东西都将在 Objective-C 中工作。 -
因为有一个非常好的 Cocoa 方法可以做同样的事情。
标签: iphone objective-c timer high-resolution