Created
July 8, 2024 13:58
-
-
Save achernoprudov/8c1b3bbe58825e730c500bad850afc27 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os.log | |
// Example adds logging for specific opertaion which can be traced and analyzed | |
// later by Xcode Profile Instruments | |
let log = OSLog(subsystem: "com.yourapp.subsystem", category: "performance") | |
let signpostID = OSSignpostID(log: log) | |
func performOperation() { | |
os_signpost(.begin, log: log, name: "Perform Operation", signpostID: signpostID) | |
// Simulated operation | |
for _ in 0..<1000000 { | |
_ = 1 + 1 | |
} | |
os_signpost(.end, log: log, name: "Perform Operation", signpostID: signpostID) | |
} | |
// Example usage | |
performOperation() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment