In recent years, the use of a spin quantum interfere-ometer with a diamond Nitrogen-vacancy (NV) center for alternating magnetic field measurement has become a hot topic for magnetic field measurement. This technology can be widely used in various magnetic field measurements. However, due to the limitation of pulse manipulation speed, this method may fail when the frequency of the alternating magnetic field is too high. This is because the microwave pulse speed needs to match the frequency of the alternating magnetic field, and it cannot be measured if the pulse speed is lower than the frequency of the alternating magnetic field. This paper discusses the problem of limited pulse speed, and proposes a solution, called the integer constraint based searching magnetic measurement method (ICSM). Specifically, the hardware requirement is converted into a software solution to realize it. That is, by using the principle that the moment when the phase accumulation is zero is an integer multiple of the period of the alternating magnetic field, the problem is transformed into an optimization model with integer constraints. Then use a search algorithm to find the solutions, getting the frequency of the alternating magnetic field, which is to be measured through the minimum positive period of the magnetic field. Finally, a Monte Carlo simulation experiment is carried out, which can obtain a high accuracy rate at a limited computational cost.