Swift - 功能明智的时间消耗跟踪

Swift - function wise time consumption tracking

我想使用 SpriteKit 对在 swift 中编码的应用程序的代码进行性能测试。是否有 swift 功能可用于跟踪我的代码执行并获取以下详细信息。

  1. 我的代码执行的函数列表。
  2. 每个函数执行的次数?
  3. 每个函数在该特定函数的所有调用中消耗的总时间。
  4. 每个函数在特定调用该函数期间消耗的最长时间。

谢谢

这些功能在 Xcode 中作为一个名为 "Instruments" 的单独应用程序提供:

https://developer.apple.com/library/ios/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/

Instruments is a powerful and flexible performance-analysis and testing tool that’s part of the Xcode tool set. It’s designed to help you profile your OS X and iOS apps, processes, and devices in order to better understand and optimize their behavior and performance.