MRTimer 是一个简单的 iOS 工具,用来计算方法的执行时间。
示例代码:
- (void)viewDidLoad { [super viewDidLoad]; [MRTimer observeSelector:@selector(doSomething) timeIntervalBlock:^(NSTimeInterval interval) { NSLog(@"Time interval for selector: (%@, %f), NSStringFromSelector(doSomething), interval); }]; } - (void)doSomething { [MRTimer observeBegin:MR_SELECTOR]; ... [MRTimer observeEnd:MR_SELECTOR]; }