On-device hang detection with threshold lower than 250 ms

There is a WWDC session about this cool instrument to detect hangs on-device: https://developer.apple.com/videos/play/wwdc2022/10082/

I very like this tool; it's handy and gives useful stack traces, but the threshold of 250 ms is practically too high to use in a testing environment. It would be better if there was an option like 100 ms or something like that.

I think most of the people can see the scrolling hang with a duration of 100-250 ms, and it would be cool to detect such hangs with this instrument.

Is there a way to set a lower threshold, or can Apple consider adding such a threshold?

Thank you!

Answered by Developer Tools Engineer in 804954022

Currently there is no way to set a lower threshold for the on-device hang detection. However, if this would be useful to you, please consider filing an enhancement request.

If the scenario you want to test can be reproduced while your test device is connected to your Mac, you can use Instruments to look for Hangs as well. Instruments allows you to set the threshold to 100ms or even 33ms.

Note that 33ms is very aggressive and you might find several case that are not an issue and you can't do much about. If your are looking for issues during scrolling it might be helpful, but for discrete interactions like tapping a button a 100ms threshold is completely fine.

For more guidance regarding different thresholds see Differentiate hangs and hitches.

Accepted Answer

Currently there is no way to set a lower threshold for the on-device hang detection. However, if this would be useful to you, please consider filing an enhancement request.

If the scenario you want to test can be reproduced while your test device is connected to your Mac, you can use Instruments to look for Hangs as well. Instruments allows you to set the threshold to 100ms or even 33ms.

Note that 33ms is very aggressive and you might find several case that are not an issue and you can't do much about. If your are looking for issues during scrolling it might be helpful, but for discrete interactions like tapping a button a 100ms threshold is completely fine.

For more guidance regarding different thresholds see Differentiate hangs and hitches.

On-device hang detection with threshold lower than 250 ms
 
 
Q