Building an in-app hang monitor
You want to add a feature to your in-house APM that captures a stack whenever the main thread stalls past a threshold. How would you detect jank from inside the app?
You want to add a feature to your in-house APM that captures a stack whenever the main thread stalls past a threshold. How would you detect jank from inside the app?
Attach a CFRunLoopObserver to the main RunLoop and have a watcher thread use a semaphore timeout to check whether the gap from BeforeSources to AfterWaiting exceeds a threshold (say 250ms), or have a watchdog thread ping the main thread periodically and time the response. In production, lean on MetricKit's MXHangDiagnostic first.
Performance and debuggingShort answerAdvanced
Users report that a certain screen occasionally freezes for about a second, but you can't…
#hang #main-thread
Performance and debuggingMultiple choiceAdvanced
After a certain action the app freezes completely (no input response). Which of these are…
#hang #main-thread
Performance and debuggingShort answerBasics
Reviews of your shipped iOS app say it occasionally stops responding to touch for a few…
#hang #main-thread
ConcurrencyShort answerIntro
In a UIKit screen you set label.text = result inside a network response callback, and…
#runloop #main-thread