TSNPerf 是一个高分辨率性能测量实用程序类。
简单地将 TSNPerf 添加到您的 Podfile 中。
pod 'TSNPerf'
并使用以下命令进行安装
pod install
捕捉单个操作的性能
// Allocate and initialize TSNPerf.
TSNPerf * perf = [[TSNPerf alloc] init];
// Start performance measurement.
[perf start];
// Perform operation(s) to be measured.
// Capture performance measurement.
[perf capture];
// Display performance.
NSLog(@"The operation took %@", [perf stringWithElapsedTime]);
捕捉多个操作的性能
// Allocate and initialize TSNPerf.
TSNPerf * perf = [[TSNPerf alloc] init];
// Start performance measurement of operation A.
[perf start];
// Perform operation A to be measured.
// Capture performance measurement of operaiton A.
[perf capture];
// Display performance of operation A.
NSLog(@"Operation A took %@", [perf stringWithElapsedTime]);
// Start performance measurement of operation B.
[perf start];
// Perform operation B to be measured.
// Capture performance measurement of operation B.
[perf capture];
// Display performance of operation B.
NSLog(@"Operation B took %@", [perf stringWithElapsedTime]);
TSNPerf 根据 MIT 许可协议发布,这意味着您可以自由地在封闭和开源项目中使用它。然而,即使在封闭源项目中,也请包括一个公开可访问的 TSNPerf 版权声明副本,该副本可在 LICENSE 文件中找到。
如果您对 TSNPerf 有任何问题、建议或贡献,请 联系我。