Commit Graph

6 Commits

Author SHA1 Message Date
Mike Ash
7f2d4be642 [Runtime] Use CMake variable to control os_trace_lazy_init usage.
SWIFT_BNI_OS_BUILD isn't exactly what we need. Use an option to turn it on/off instead.

rdar://128408295
2024-05-20 17:39:01 -04:00
Mike Ash
dd24d8e71f [Runtime] Don't emit signposts until the system is ready.
Emitting a signpost for the first time can trigger lazy setup of the logging system, and doing this in the wrong context can cause deadlocks. Check to see if the logging system is already set up, and only emit signposts if it has been to avoid triggering this.

As it's hard to determine if the "is it set up?" function is available in the SDK we're building against, only do this in OS builds, as it's not particularly useful in local builds.

rdar://124620772
2024-05-15 11:02:23 -04:00
Mike Ash
3c98c74987 [Runtime] Exclude logd_helper from tracing.
logd_helper is part of the log system and we can't safely log from within it.

rdar://126120335
2024-04-10 09:56:17 -04:00
Allan Shortlidge
3b9c55cb64 Runtime: Fix a -Wlogical-op-parentheses warning.
Introduced by https://github.com/apple/swift/pull/72591.
2024-03-27 14:07:36 -07:00
Tim Kientzle
b8cb005f99 Disable tracing in xpcproxy
Add xpcproxy to the list of processes that handle tracing
requests and therefore cannot themselves use tracing without
deadlocking.

rdar://124996590
2024-03-26 10:41:45 -07:00
Mike Ash
3100be12fa [Runtime] Don't enable tracing in logd, diagnosticd, notifyd.
We can't use os_log functionality in logd, diagnosticd, or notifyd. Check for them and disable tracing in those processes.

Add a new TracingCommon.h for common code shared between swiftCore and swift_Concurrency tracing. Add a single function that checks if tracing should be enabled, which now checks if os_signpost_enabled is available, and if the process is one of these. Modify the tracing code to check this before creating os_log objects.

rdar://124226334
2024-03-11 21:06:15 -04:00