Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)
like image 613
zumzum Avatar asked Dec 05 '18 21:12

zumzum


2 Answers

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 =)

like image 179
Tim Avatar answered Nov 15 '22 16:11

Tim


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

like image 31
zumzum Avatar answered Nov 15 '22 14:11

zumzum