This script will check non-BUF latch information. It waits for a minute and collects the historical latches and instantaneous latches on the instance. If you suspect there is latch contention, you can run this script and troubleshoot based on the results.
You can use this script for troubleshooting when you want to check latch contention in SQL Server.
You can find more All-In-One Script Framework script samples at https://aka.ms/onescriptingallery