Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcisme/a706aa095f798c8831e7cb5c8f485fde to your computer and use it in GitHub Desktop.
Save marcisme/a706aa095f798c8831e7cb5c8f485fde to your computer and use it in GitHub Desktop.
signpost_bits
Hi! Thanks for looking
TL;DR - trying to do anything with os_signpost, but nothing is appearing in instruments.
UPDATE: on devices it's working. Is it supposed to work in the simulator? Points of Interest are on built-in templates, I figured it should work on the device...
The app is all objc, using the C API. See at the end for a swift attempt
More details:
Creating the log like this:
+ (os_log_t) pointsOfInterestLog {
static dispatch_once_t predicate;
static os_log_t log;
dispatch_once(&predicate, ^{
log = os_log_create("com.bundle.id.signpoints",
OS_LOG_CATEGORY_POINTS_OF_INTEREST);
});
if (!os_log_info_enabled(log)) {
exit(55);
}
return log;
} // pointsOfInterestLog
calling like
os_signpost_event_emit(MJSignpost.pointsOfInterestLog, OS_SIGNPOST_ID_EXCLUSIVE, "Layout2");
(also tried it with a generated os_signpost_id_generate)
Tried calling it between a
os_signpost_interval_begin(MJSignpost.log, OS_SIGNPOST_ID_EXCLUSIVE, "Layout");
os_signpost_interval_end(MJSignpost.log, OS_SIGNPOST_ID_EXCLUSIVE, "Layout");
pairing, using a log created with os_log_create("com.bundle.id.signpoints", "App Name");
(those don't appear in instruments either when using the os_signpost instruments added to the time profiler template)
Looked at the preprocessed output, and the `(_os_signpost_emit_with_name_impl)` call is being reached,
so any prior gates aren't being triggered.
When I record in instruments (default time profiler template) and cause this thing to be hit fairly often (say several times a
second during user interaction), I get "no data, call os_signpost on a logging handle with the
PointsOfInterest category"
No additional command-line arguments or environment variables.
-------
private let refreshLog = OSLog(subsystem: "com.bundle.id.signpots",
category: .pointsOfInterest)
(declared outside of any class - up in file scope)
os_signpost(.event, log: refreshLog, name: "Fetch-pre")
os_signpost(.begin, log: refreshLog, name: "Fetch")
os_signpost(.event, log: refreshLog, name: "Fetch-inside")
os_signpost(.end, log: refreshLog, name: "Fetch")
Nothing showing up in points of interest. And when using a non-pointsOfInterest category.
-----
Here's is a complete implementation that tries to make a point of interest on each button tap:
import UIKit
import os.signpost
private let refreshLog = OSLog(subsystem: "com.blorgle.signpots",
category: .pointsOfInterest)
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func blah() {
os_signpost(.event, log: refreshLog, name: "Fetchpre")
}
}
and no joy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment