📄 main.c
字号:
else printf("N/A\n");
gotoxy(69,11);
if(vmem_stosd > 0) printf("%4.1f\n", vmem_stosd/1024.0);
else printf("N/A\n");
// (lmem_movsw/1024.0),(lmem_movsd/1024.0), (lmem_stosw/1024.0),(lmem_stosd/1024.0));
// (hmem_movsw/1024.0),(hmem_movsd/1024.0), (hmem_stosw/1024.0),(hmem_stosd/1024.0));
// (vmem_movsw/1024.0),(vmem_movsd/1024.0), (vmem_stosw/1024.0),(vmem_stosd/1024.0));
gotoxy(0,12);
printf("\n");
printf("%s/%s/%s mode switch rate by INT: ", modetype[2], modetype[_modetype], modetype[2]);
printf("%4.1f switches/second\n",(1/ (intPR_speed+intRP_speed)+0.05) );
printf("(%2.2f 鎠ec/switch: %1.1f 鎠ec up + %1.1f 鎠ec down)", (intRP_speed+intPR_speed)*1000000+0.005, (intRP_speed*1000000)+0.05, (intPR_speed*1000000)+0.05);
printf(" IRQ up switch: %1.1f 鎠ec\n",(irqRP_speed*1000000)+0.05);
// printf("IRQ down switch: %1.1f 鎠ec\n",(irqPR_speed*1000000)+0.05);
printf("Protected mode code is running at CPL=%d",_codecpl);
if(_codecpl==0)
printf(" (lowest),");
if(_codecpl==3)
printf(" (highest),");
printf(" IOPL=%d",_codeiopl);
if(_codeiopl==0)
printf(" (lowest)");
if(_codeiopl==3)
printf(" (highest)");
printf("\n");
printf("\n");
printf("CPU performance: %1.1f MIPS ",risc_speed/1000000);
printf("(%1.1f mil. privileged instr/sec)\n",priv_speed/1000000);
printf("Floating-point performance: %1.1f MIPS (FADD instruction)\n",fpu_speed/1000000);
/*
f1= (long)(1)+(long)(risc_speed/10000);
f2= (long)(1)+(long)(fpu_speed/1000);
f3= (long)(1)+(long)((1/(intPR_speed+intRP_speed))/10);
f4= (long)(1)+(long)((lmem_movsd+lmem_stosd)/10);
f5= (long)(1)+(long)((hmem_movsd+hmem_stosd)/10);
f=(f1 + f2 + f3 + f4 + f5) /50;
//printf("\n 1) %f\n 2) %f\n 3) %f\n 4) %f\n 5) %f\n",f1,f2,f3,f4,f5);
printf("Overall system performance running ");
if(_extendertype==0xFF)
printf("Unknown");
else
printf("%s",dosextender[_extendertype]);
if(_extendertype==2)
printf("%01d.%02d", (get_pmodew_ver()&0x0FF00)>>8,get_pmodew_ver()&0xFF);
printf(" DOS Extender\n");
printf("is measured to: %1.1f NRPP (non-relative performance points)",f);
*/
printf("\n");
}
/****************************************************************************/
void measure_cpu_speed(void)
{
int n;
float f;
float cpu_time;
float cpu_test[5];
float timer_time=1193181; // timer freq in Hz
if(_cputype==3) cpu_time=41000; // div ebx on 386 = 41 clocks
if(_cputype==4) cpu_time=40000; // div ebx on 486 = 40 clocks
test_cpu(); // preload cache
if(_cputype<5)
{
for(n=0; n<5; n++) cpu_test[n]=test_cpu();
f=(cpu_test[0]+cpu_test[1]+cpu_test[2]+cpu_test[3]+cpu_test[4])/5.0;
cpu_speed=((timer_time*cpu_time)/(f*1000000))*2.0+0.05;_rawcpuspeed=f;
}
else
{
cpu_speed=(test_cpu()/1000000.0);
}
}
void measure_fpu_speed(void)
{
int n;
float f;
float test_time[5];
float instructions=1000;
float timer_time=1193181; // timer freq in Hz
test_fpu(); // preload cache
for(n=0; n<5; n++) test_time[n]=test_fpu();
f=(test_time[0]+test_time[1]+test_time[2])/3.0;
fpu_speed=1.0/( ((f/2.0)/timer_time) /instructions);
}
void measure_risc_speed(void)
{
int n;
float test_time[16];
float f=0;
float instructions=1000;
float timer_time=1193181; // timer freq in Hz
test_risc(); // preload cache
for(n=0; n<16; n++) test_time[n]=test_risc();
for(n=0; n<16; n++) f=f+test_time[n];
f=f/16.0;
risc_speed=1.0/( ((f/2.0)/timer_time) /instructions);
}
void measure_priv_speed(void)
{
int n;
float f;
float test_time[5];
float instructions=1000;
float timer_time=1193181; // timer freq in Hz
test_priv(); // preload cache
for(n=0; n<5; n++) test_time[n]=test_priv();
f=(test_time[0]+test_time[1]+test_time[2])/3.0;
priv_speed=1.0/( ((f/2.0)/timer_time) /instructions);
}
void measure_int_speed(void)
{
#undef TESTS
#define TESTS 1024
int n;
dword t;
float f;
float test_timePR[TESTS];
float test_timeRP[TESTS];
float timer_time=1193181; // timer freq in Hz
test_int();
for(n=0; n<TESTS; n++)
{
t=test_int();
test_timePR[n]=(t&0x0000FFFF);
test_timeRP[n]=(t&0xFFFF0000)>>16;
}
f=0;
for(n=0; n<TESTS; n++) f=f+test_timePR[n];
f=f/TESTS;
intPR_speed=(f/2)/timer_time;
f=0;
for(n=0; n<TESTS; n++) f=f+test_timeRP[n];
f=f/TESTS;
intRP_speed=(f/2)/timer_time;
}
void measure_irq_speed(void)
{
#undef TESTS
#define TESTS 64
int n;
dword t;
float f;
float test_timePR[TESTS];
float test_timeRP[TESTS];
float timer_time=1193181; // timer freq in Hz
test_irq();
for(n=0; n<TESTS; n++)
{
t=test_irq();
test_timePR[n]=(t&0x0000FFFF);
test_timeRP[n]=(t&0xFFFF0000)>>16;
}
f=0;
for(n=0; n<TESTS; n++) f=f+test_timePR[n];
f=f/TESTS;
irqPR_speed=(f/2)/timer_time;
f=0;
for(n=0; n<TESTS; n++) f=f+test_timeRP[n];
f=f/TESTS;
irqRP_speed=(f/2)/timer_time;
}
void measure_lmem_speed(void)
{
int n;
float f;
float mem_test[5];
float mem_size=150*1024;
float timer_time=1193181; // timer freq in Hz
if(test_low_movsw()==0xFFFFFFFF) lmem_movsw=-1;
else {
for(n=0; n<5; n++) mem_test[n]=test_low_movsw();
f=(mem_test[0]+mem_test[1]+mem_test[2]+mem_test[3]+mem_test[4])/5.0;
lmem_movsw=((mem_size/(f/timer_time))/1024)*2;
}
if(test_low_movsd()==0xFFFFFFFF) lmem_movsd=-1;
else {
for(n=0; n<5; n++) mem_test[n]=test_low_movsd();
f=(mem_test[0]+mem_test[1]+mem_test[2]+mem_test[3]+mem_test[4])/5.0;
lmem_movsd=((mem_size/(f/timer_time))/1024)*2;
}
if(test_low_stosw()==0xFFFFFFFF) lmem_stosw=-1;
else {
for(n=0; n<5; n++) mem_test[n]=test_low_stosw();
f=(mem_test[0]+mem_test[1]+mem_test[2]+mem_test[3]+mem_test[4])/5.0;
lmem_stosw=((mem_size*2/(f/timer_time))/1024)*2;
}
if(test_low_stosd()==0xFFFFFFFF) lmem_stosd=-1;
else {
for(n=0; n<5; n++) mem_test[n]=test_low_stosd();
f=(mem_test[0]+mem_test[1]+mem_test[2]+mem_test[3]+mem_test[4])/5.0;
lmem_stosd=((mem_size*2/(f/timer_time))/1024)*2;
}
}
void measure_hmem_speed(void)
{
int n;
float f;
float mem_test[5];
float mem_size=150*1024;
float timer_time=1193181; // timer freq in Hz
if(test_high_movsw()==0xFFFFFFFF) hmem_movsw=-1;
else {
for(n=0; n<5; n++) mem_test[n]=test_high_movsw();
f=(mem_test[0]+mem_test[1]+mem_test[2]+mem_test[3]+mem_test[4])/5.0;
hmem_movsw=((mem_size/(f/timer_time))/1024)*2;
}
if(test_high_movsd()==0xFFFFFFFF) hmem_movsd=-1;
else {
for(n=0; n<5; n++) mem_test[n]=test_high_movsd();
f=(mem_test[0]+mem_test[1]+mem_test[2]+mem_test[3]+mem_test[4])/5.0;
hmem_movsd=((mem_size/(f/timer_time))/1024)*2;
}
if(test_high_stosw()==0xFFFFFFFF) hmem_stosw=-1;
else {
for(n=0; n<5; n++) mem_test[n]=test_high_stosw();
f=(mem_test[0]+mem_test[1]+mem_test[2]+mem_test[3]+mem_test[4])/5.0;
hmem_stosw=((mem_size*2/(f/timer_time))/1024)*2;
}
if(test_high_stosd()==0xFFFFFFFF) hmem_stosd=-1;
else {
for(n=0; n<5; n++) mem_test[n]=test_high_stosd();
f=(mem_test[0]+mem_test[1]+mem_test[2]+mem_test[3]+mem_test[4])/5.0;
hmem_stosd=((mem_size*2/(f/timer_time))/1024)*2;
}
}
void measure_vmem_speed(void)
{
int n;
float f;
float mem_test[5];
float mem_size=64*1024;
float timer_time=1193181; // timer freq in Hz
setvideomode(0x13);
if(test_vid_movsw()==0xFFFFFFFF) vmem_movsw=-1;
else {
for(n=0; n<5; n++) mem_test[n]=test_vid_movsw();
f=(mem_test[0]+mem_test[1]+mem_test[2]+mem_test[3]+mem_test[4])/5.0;
vmem_movsw=((mem_size/(f/timer_time))/1024)*2;
}
if(test_vid_movsd()==0xFFFFFFFF) vmem_movsd=-1;
else {
for(n=0; n<5; n++) mem_test[n]=test_vid_movsd();
f=(mem_test[0]+mem_test[1]+mem_test[2]+mem_test[3]+mem_test[4])/5.0;
vmem_movsd=((mem_size/(f/timer_time))/1024)*2;
}
if(test_vid_stosw()==0xFFFFFFFF) vmem_stosw=-1;
else {
for(n=0; n<5; n++) mem_test[n]=test_vid_stosw();
f=(mem_test[0]+mem_test[1]+mem_test[2]+mem_test[3]+mem_test[4])/5.0;
vmem_stosw=((mem_size/(f/timer_time))/1024)*2;
}
if(test_vid_stosd()==0xFFFFFFFF) vmem_stosd=-1;
else {
for(n=0; n<5; n++) mem_test[n]=test_vid_stosd();
f=(mem_test[0]+mem_test[1]+mem_test[2]+mem_test[3]+mem_test[4])/5.0;
vmem_stosd=((mem_size/(f/timer_time))/1024)*2;
}
setvideomode(3);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -