Getting a profile of systems without installing Xcode

Hello,

perhaps someone can help me with the following question :-)


I have set some Points Of Interests in the startup phase of our application:


kdebug_signpost_start (0, 0, 0, 0, 0);

// some work is done

kdebug_signpost_end (0, 0, 0, 0, 0);


...


kdebug_signpost_start (1, 0, 0, 0, 0);

// some other work is done

kdebug_signpost_end (1, 0, 0, 0, 0);


...


What I would like to do is run this special build on some systems without having to install Xcode and Instruments, profile the startup time and get the data back.

What would be perfect is if I could import that data into Instruments and analyse it there ;-)


I just need the information for our application process, not the whole system. And the profiling should run at least as long as the startup of the application.


Any ideas?


Thanks!

Accepted Reply

You can try 'ktrace artrace' if you're able to access the terminal on the target Mac. That will take a recording of just about everything. It's heavy handed but it probably will record those signposts too. Just run that as root, then CMD-C it when your app finishes launching, then take the file it produces back to your development machine and open it with Instruments. The recording isn't as full featured as what you get when Instruments is installed, but it might have what you need.


When you open the file, Instruments will ask you to pick a template, and your template choice will more or less dictate what parts of the file you want to model in Instruments. So in your case it could be the System Trace template or a Time Profiler template since they both have a Points of Interest instrument in them.

Replies

You can try 'ktrace artrace' if you're able to access the terminal on the target Mac. That will take a recording of just about everything. It's heavy handed but it probably will record those signposts too. Just run that as root, then CMD-C it when your app finishes launching, then take the file it produces back to your development machine and open it with Instruments. The recording isn't as full featured as what you get when Instruments is installed, but it might have what you need.


When you open the file, Instruments will ask you to pick a template, and your template choice will more or less dictate what parts of the file you want to model in Instruments. So in your case it could be the System Trace template or a Time Profiler template since they both have a Points of Interest instrument in them.

Brilliant! That is what I was looking for! Thank you!

Is this also the recommended way to get a profile that I can import into instruments when I do not need the information for point of interests?

The use case is for example that the user reports sluggishness when he is doing a certain operation in our app. I basically only need the call stack information for our process (Time Profiler).

I just tried:


sudo ktrace artrace --type=profile


And that gave me enough to get a time profile but not much else, so that could be a way for you to limit file size and recording impact.

Great!!! Thank you cwoolf. It works 🙂

Hey cwoolf,

I have one more question 🙂

I tried the procedure with a customer. He did a trace using:

"sudo ktrace artrace -p 3534 --type=profile"

and send it to me. I can load it in Instruments perfectly but the symbols are missing. How do I symbolize the trace correctly? Going to the Symbols... Menu Entry in Instruments shows an empty window. The customer is on OSX 10.14.5 and I'am on 10.14.6. I do not need the symbols of the OSX system but the ones from the application I'am working on.


Best regards,

Erich

That seems related to the "-p" option. The pid is being saved as -1 it seems, which is confusing Instruments. If you profile everything (not use -p) and your customer is okay with that, then it will work. I filed: <rdar://problem/53996132> Can't symbolicate ktrace artrace with a -p <pid> filter

Ahh! Thanks for the help cwoolf. It's okay for the customer to profile without the "-p".

Hey cwoolf,

I got a new profile but I have the same problem. The customer used "sudo ktrace artrace --type=profile". I see all processes in instruments but when opening the Symbols window it is empty. I have no idea what we are doing wrong.


I did a test and profiled an IMac, transfered the ktrace file to my Macbook Pro and it works, I can symbolicate it in instruments. So there must be something different.


Any idea? 🙂


It would be really great to get it working!

I filed a report: FB7003081

It would be really great to have feedback why this ktrace can't be symbolicated. I did a test with another customer and it's the same problem.