📄 speedtst.cpp
字号:
#include <dos.h>
#include <time.h>
#include <stdio.h>
void main(void)
{
static unsigned long first, second;
printf("\nThe program calculates time interval to perform 10 million of writes to 0x378\nTakes about 20 seconds. Please wait...\n");
first = *(long*)MK_FP(0x40, 0x6c); /* Gets system
time */
for(unsigned long i=0;i<10000000L;i++)
outportb(0x378, i&0xff);
second = *(long*)MK_FP(0x40, 0x6c); /* Gets system time
again */
static int in = second-first;
static float f = (second-first)/18.2;
printf("10 million of writes to 0x378 took %d timer ticks (%5.3f seconds)\n",in, f);
printf("About %5.3f us per write\n", f/10.);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -