Internal frequency measurements can be done at any time, not only in production. A reference clock is needed to do internal measurements. A high or low-frequency clock can be used, or a tick, such as the one-second tick from a GPS module.
Of the two methods, using a high frequency reference will give the best result in the shortest amount of time.