Specifying recording options in xctrace CLI

Hello,

I'm curious to learn if there's a way to specify recording parameters programmatically to xctrace. The docs, (in particular, create-parameter) imply that there's a mechanism for defining parameters and then specifying their values on the command line.

From https://help.apple.com/instruments/developer/mac/current/#/dev494862765 :

<create-parameter> Element

Creates a parameter specific to this instrument. **Parameters show up in the UI and command line as recording options.**

However, I only ever see these recording options in the UI. Latest Xcode15 beta 6 xctrace doesn't seem to mention anything else about recording parameters, from what I was able to tell.

This is true for both custom instruments (where I defined create-parameter myself), and for 1st-party instruments such as Time Profiler (e.g. high-frequency-sampling).

As a workaround I've been able to make custom instruments that import the relevant schemas and mark them as dependencies/required-inputs (then I can set the individual options). Is this the expected workflow for recording options? Am I misreading the docs?

Just to clarify -- these parameters DO in fact appear from the UI, but are absent from xctrace .

Thank you!

Replies

Hey alucena, nice to read you :-)

There is currently no way to set recording options directly from xctrace. However, you can open Instruments, configure a document with the instruments and recording options you like, and then save this document as a template. Then specify your new custom template to be used in xctrace. The recording settings you chose will be saved in the template and used in xctrace and this should work for both custom and built-in instruments.

This is hopefully more convenient than making a separate custom instrument. :-)

If you often have the need for specifying different recording settings from xctrace such that making a custom template each time would be inconvenient, please file a feedback with this enhancement suggestion.