摘要
对于精度要求为亚毫秒级的延时及其测量,需用CPU的时钟周期数除以CPU主频得到.时钟周期数可以用简单的汇编语言获得,因此,如何测准CPU的主频成为关键问题.本文利用TickCount变化的瞬间作为起始和结束时间,并且通过判断时钟周期数之差的大小,系统地消除由于进程切换所引起的周期数的波动,其精度优于10μs.实验结果证明,本方法可以高精度地测量CPU的主频进而精确测量延时.
Time delay whose accuracy is in terms of millisecond and its measurement can be obtained by dividing the number of CPU circles by CPU frequency. The CPU circles can be obtained with easy assembly language, thus the accurate measurement of the CPU frequency is the key. This study uses the TickCount to record the start time and end time, and eliminates systematically the fluctuation caused by process switching through the judgment of the differences between the numbers of clock cycles. The accuracy is within 10μs. The experimental result shows that this method can accurately measure CPU frequency and time relay.
出处
《五邑大学学报(自然科学版)》
CAS
2012年第3期62-66,共5页
Journal of Wuyi University(Natural Science Edition)
基金
安徽高校省级自然科学研究项目资助(KJ2011Z346
KJ2011Z357)