ios - os_signpost 在模拟器上工作,但在设备上运行时不工作

标签 ios swift xcode instruments

在我想跟踪时间的功能之一中,我有以下代码行,使用仪器。当我通过仪器在模拟器上运行该应用程序时,os_signpost 的测量时间会显示出来,我可以准确地测量我需要的时间。

然后我切换到设备,相同的代码。但是,由于它在设备仪器上运行,因此不会显示测量时间。它只显示这个: enter image description here

os_signpost 时间根本不显示。

所以,在模拟器上一切都很好,但当我切换到我的 iPhone 设备时就不行了。

有什么想法吗?

let spid = OSSignpostID(log: SignpostLog.myLog, object: myObj as AnyObject)

defer { os_signpost(.end, log: SignpostLog.myLog, name: "operation1", signpostID: spid) }

os_signpost(.begin, log: SignpostLog.myLog, name: "operation1", signpostID: spid)

最佳答案

确保您没有通过环境变量禁用 OS_ACTIVITY_MODE(请参见下面的屏幕截图)

Do not do this, or signposts will not work

我删除了它,一切正常 =)

关于ios - os_signpost 在模拟器上工作,但在设备上运行时不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53641394/

相关文章:

swift 3 : sorting arrays with sort function: seeing error of Ambiguous use of 'sort(comparator:)'

ios - Xcode 验证与提交到 App Store

iphone - iad的banner不需要设置吗?

ios - iPhone 4s 在后台收不到 iBeacon 通知

ios - 本地化为法语时,静态 UIView 更改宽度

ios - Twilio iOS 客户端 unlisten 或 capability token 过期导致崩溃

ios - 通过 objective-c 中的 NFC 标签响应读取和重定向网页

ios - 触摸同级时关闭键盘

ios - 如何去除图像的噪点?

iphone - 在 Poptorootviewcontroller 上强制 Viewdidload