zumzum
zumzum

Reputation: 20238

os_signpost works on simulator but not when running on device

I have the following lines of code in one of the functions I want to track time for, using instruments. When I run the app on simulator from instruments, the measured times with os_signpost do show up and I can accurately measure what I need.

Then I switch to device, same code. However, as it runs on device instruments does not show the measured times. It only show this: enter image description here

the os_signpost times do not show up at all.

So, all works great on simulator, but not when I switch to my iPhone device.

Any idea?

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)

Upvotes: 9

Views: 2544

Answers (2)

Tim
Tim

Reputation: 1894

Make sure you did not disable OS_ACTIVITY_MODE via an environment variable (see screenshot below)

Do not do this, or signposts will not work

I removed it and everything worked =)

Upvotes: 11

zumzum
zumzum

Reputation: 20238

Turns out os_signpost would not show up because the recording was set to immediate. Setting it to Deferred made it so I could run the app, then stop recording and then instruments shows the custom os_signpost I had in code.

enter image description here

Upvotes: 2

Related Questions