Change recording mode when using xctrace

Hey,

In the UI of the Instruments app, I can change the recording mode to immediate. Is that possible when using xctrace? It seems to use deferred as a default.

I've tried to create a template, set the recording mode to immediate, and use that template for recording. However, that doesn't seem to work. At least the exported TOC of the .trace will have the following summary:

        <summary>
            <start-date>2025-01-11T13:00:11.365+01:00</start-date>
            <end-date>2025-01-11T13:00:30.525+01:00</end-date>
            <duration>19.160279</duration>
            <end-reason>Target app exited</end-reason>
            <instruments-version>16.0 (16A242d)</instruments-version>
            <template-name>core_animation_fps</template-name>
            <recording-mode>Deferred</recording-mode>
            <time-limit>12 hours</time-limit>
        </summary>

This issue might be related to: https://developer.apple.com/forums/thread/735948

Thanks a lot!

That's correct – immediate mode doesn't have any benefits in a CLI tool because it refers to Instruments.app rendering the data as it retrieves it from the device. Is there any reason why would you want to use immediate mode with xctrace?

That makes sense, thanks.

Is there any reason why would you want to use immediate mode with xctrace?

I'm developing a program which runs multiple XCTests in sequence and records each test separately using xctrace. Since it can take a while before the .trace file is stored, I was wondering if this could be improved with something like an immediate mode.

But I'll probably just implement it in a way where the next test can already start, thus, having potentially multiple xctrace commands running at the same time.

Saving performance is completely independent of the recording mode but dependent on the size of the trace and other properties like number of Instruments, length of the recording, number of symbols captured.

We'd be happy to also take a look at the issue with the saving performance – if you'd be able to capture file a report on this issue, it'd be fantastic (including which template you're recording, on what device, with a sample .trace file).

Change recording mode when using xctrace
 
 
Q