OSSignposts not working after upgrade to Sonoma (14.2.1)

The Points of Interest Instrument is not recording any data when profiling my application on Sonoma. The same code is producing signposts when profiling on a computer running Sonoma. Here's what how the instruments screen looks:

Note that there are no Points of Interest being recorded.

I created a new project for this test and added code to emit signposts whenever the application becomes active or goes into the background. This is the code I'm using for the test (copied from forum post from a year ago).

import os.signpost

@main
class AppDelegate: NSObject, NSApplicationDelegate {

    var window: NSWindow?
    var blackWindow: NSWindow?
    var alertWindow: NSWindow?
    static var originalAppDelegate: AppDelegate!

    var signposter: OSSignposter
    var signpostInterval: OSSignpostIntervalState?

    func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
        return true
    }

    override init() {
        signposter = OSSignposter(subsystem: Bundle.main.bundleIdentifier ?? "unknown", category: .pointsOfInterest)
        super.init()
        assert(signposter.isEnabled)
        signposter.emitEvent(#function)
    }

    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func applicationWillResignActive(_ notifiction: Notification) {
        guard let interval =  signpostInterval else {
            assertionFailure("no interval")
            return
        }
        print("backgrounding, ending active state")
        signposter.endInterval("active", interval)
    }

    func applicationDidBecomeActive(_ notification: Notification) {
        print("begin active state")
        signpostInterval = signposter.beginInterval("active")
    }
}

Is anyone else having this problem? I tested this on my development machine (Retina 5K, 27-inch, 2019) running Sonoma 14.2.1. The problem occurs even with a clean install of Sonoma onto an external boot disk. The same code produces this screenshot when running in Ventura 13.6.1.

Hi camanotech,

thanks a lot for the detailed description and putting in the work to try to isolate the issue with a separate sample code project! Your code looks fine and like it should indeed emit signposts to the Points of Interests category and Instruments should display them.

This looks like a bug. Could you please file a bug report and attach your sample project? If you post the feedback ID here once you filed it, this will make it easier for us to find it and connect it to your question here.

Please mention both the OS version you were running on (like you did above) as well as the Xcode/Instruments version you were using. Also, if you attach both an Instruments document were you successfully recorded data and one where the POIs are missing, that makes it easier for us to determine whether the data is simply not displayed (but recorded) or didn't even get recorded.

All of this would be very useful information.

If you have time to investigate a little more here is one more thing, that you could try: Instead of using the Time Profiler template, use the "Logging" template. The "Logging" template contains the os_signpost instrument. It displays all logged signposts, not just the ones going to the POI category. Try to see whether your signposts show up in that one or whether they are also missing there.

If you do, please let us know what the results are, here or via the Feedback report.

And one more thing: If you feel like the active/inactive state is something you regularly use (not just for demonstrating the issue), feel free to file a separate feedback for that to ask for Instruments supporting that out of the box. The App Lifecycle lane already shows foreground/background and active/inactive could be a natural enhancement.

I posted a feedback bug report (FB13557564). I included the trace for Logging and Time Profile on macOS 14.2.1 and macOS 13.6.1.

Is there any known workaround in place? I'm facing the exact same problem on Sonoma 14.2.1 with Xcode 15.1 (15C65) when attempting to record signposts from C++, which definitely used to work before. I confirm that even os_signpost_enabled returns true when logging under the Logging template, but nothing is actually recorded. Neither events nor intervals.

Hi everyone,

the issue is still under investigation, but we have found a workaround for you in the meantime: You can record in what is often referred to as "Windowed" mode in Instruments, and in this mode, signposts will still be recorded.

To do so

  1. Choose File > Recording Options...
  2. In the modal sheet that appears, look for "Global Options" at the bottom and expand it
  3. Chose "Last [ ] seconds" in the "Recording Mode" section
  4. Enter a duration that is long enough for you to record your data

When recording in "Last x seconds" mode, Instruments will not permanently record any data during the recording, instead it uses a sliding window of the length you specified. When you stop recording, it captures the in-memory data for the last x seconds, processes it and generates the trace document from that data. But anything that happened more than x seconds ago will be lost.

In "Last x seconds" mode, Instruments also does not process the data during recording and can thus not render anything during recording. Processing and rendering only happens once you stop the recording.

Note that the duration specified here is a maximum duration, everything before that threshold will be cut off, but it is no guarantee that all data within this time window will be available. In windowed mode, Instruments runs in a very low overhead mode and relies on system buffers to buffer the data until it requests it at the end of recording. Some of these buffers might have a smaller size than what you requested and overwrite data earlier, such that data that's further in the past might be lost earlier.

It is likely to work for a window of a few minutes, but it is likely that the data is incomplete for a window length of a few hours.

Hello, are there any news when this will be fixed? I tried out the latest Beta 1 of macOS Sonoma 14.5 but it seems that it's still broken...

This workaround ("last x seconds") unblocked me for now from macOS 14.4.1 (23E224) and Instruments 15.3 (15E204a). Are there any other places I can go to follow along for a more robust fix that might land soon? Thanks!

I can contribute the additional information that the workaround (of using windowed time capture) works to obtain signpost ranges even if your code is still based on os_signpost (I was among the early adopters), so this issue has absolutely nothing to do with the deprecation notice shown in the docs for os_signpost.

We expect this issue to be fixed in macOS Sonoma 14.5 and later. If you still experience it, please file another bug report (if you can mention the Feedback ID here, this makes it easier for us to connect the dots).

OSSignposts not working after upgrade to Sonoma (14.2.1)
 
 
Q