ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Суббота
23 ноября
9450 Топик полностью
MemoryTest (14.04.2004 17:59, просмотров: 1) ответил MemoryTest на Присоветуйте какой-нить бенчмарк в исходниках на С, чтобы можно было компильнуть
мож кто покомпиляет на своей ебедед плате и напишет проц, шину и время выполнения теста :)) #define register #define ITERATIONS 1000 #define PNT5MINUS 0.499975 #define PNT5PLUS 0.50025 #define TWO 2.0 #include void mod8(float r1, float r2, float *r3); void mod3 (float a[4]); int main(void) { static int mod1freq, mod2freq, mod3freq, mod4freq, mod6freq; static int mod7freq, mod8freq, mod9freq, mod10freq, mod11freq; static float ary[4]; static float real1, real2, real3, real4; register int cntr; register int int1, int2, int3; /* Establish execution frequencies */ mod1freq = 0 * ITERATIONS; mod2freq = 12 * ITERATIONS; mod3freq = 14 * ITERATIONS; mod4freq = 345 * ITERATIONS; mod6freq = 210 * ITERATIONS; mod7freq = 32 * ITERATIONS; mod8freq = 899 * ITERATIONS; mod9freq = 616 * ITERATIONS; mod10freq = 0 * ITERATIONS; mod11freq = 93 * ITERATIONS; /* MODULE 1: simple identifiers */ real1 = 1.0; real2 = -1.0; real3 = -1.0; real4 = -1.0; for(cntr = 1; cntr <= mod1freq; cntr++) { real1 = ( real1 + real2 + real3 - real4 ) * PNT5MINUS; real2 = ( real1 + real2 - real3 - real4 ) * PNT5MINUS; real3 = ( real1 - real2 + real3 + real4 ) * PNT5MINUS; real4 = ( real2 - real1 + real3 + real4 ) * PNT5MINUS; } /* for */ /* MODULE 2: array elements */ ary[0] = 1.0; ary[1] = -1.0; ary[2] = -1.0; ary[3] = -1.0; for (cntr = 1; cntr <= mod2freq; cntr++) { ary[0] = ( ary[0] + ary[1] + ary[2] - ary[3] ) * PNT5MINUS; ary[1] = ( ary[0] + ary[1] - ary[2] + ary[3] ) * PNT5MINUS; ary[2] = ( ary[0] - ary[1] + ary[2] + ary[3] ) * PNT5MINUS; ary[3] = ( ary[1] - ary[0] + ary[2] + ary[3] ) * PNT5MINUS; } /* for */ /* MODULE 3: array as parameter (see program at end) */ for (cntr = 1; cntr <= mod3freq; cntr++) mod3(ary); /* MODULE 4: conditional jumps */ int1 = 1; for (cntr = 1; cntr <= mod4freq; cntr++) { if (int1 == 1) int1 = 2; else int1 = 3; if (int1 > 2) int1 = 0; else int1 = 1; if (int1 < 1 ) int1 = 1; else int1 = 0; } /* for */ /* MODULE 6: integer arithmetic using arrays*/ int1 = 1; int2 = 2; int3 = 3; for (cntr = 1; cntr <= mod6freq; cntr++) { int1 = int1 * (int2 - int1) * (int3 -int2); int2 = int3 * int2 - (int3 - int1) * int2; int3 = (int3 - int2) * (int2 + int1); ary[int3 - 1] = int1 + int2 + int3; ary[int2 - 1] = int1 * int2 * int3; } /* MODULE 7: trigonometric. functions */ real1 = 0.5; real2 = 0.5; for(cntr = 1; cntr <= mod7freq; cntr +=1) { real1 = atan(TWO * sin(real1) * cos(real1) / (cos(real1 + real2) + cos(real1 - real2) - 1.0)) * PNT5MINUS; real2 = atan(TWO * sin(real2) * cos(real2) / (cos(real1 + real2) + cos(real1 - real2) - 1.0)) * PNT5MINUS; } /* for */ /* MODULE 8: procedure calls */ real1 = real2 = real3 = 1.0; for (cntr = 1; cntr <= mod8freq; cntr +=1) mod8(real1, real2, &real3); /* MODULE9: array references */ int1 = 1; int2 = 2; int3 = 3; ary[1] = 1.0; ary[2] = 2.0; ary[3] = 3.0; for(cntr = 1; cntr <= mod9freq; cntr++) { ary[int1] = ary[int2]; ary[int2] = ary[int3]; ary[int3] = ary[int1]; } /* MODULE10: integer arithmetic */ int1 = 2; int2 = 3; for(cntr = 1; cntr <= mod10freq; cntr +=1) { int1 = int1 + int2; int2 = int1 + int2; int1 = int2 - int1; int2 = int2 - int1 - int1; } /* MODULE11: standard functions */ real1 = 0.75; for(cntr = 1; cntr <= mod11freq; cntr +=1) real1 = sqrt( exp( log(real1) / PNT5PLUS)); /* end of main program */ return 0; } /* Module 3 routine */ void mod3 (float a[4]) { int cntr; for (cntr = 0; cntr <= 6; cntr +=1) { a[0] = (a[0] + a[1] + a[2] - a[3] ) * PNT5MINUS; a[1] = (a[0] + a[1] - a[2] + a[3] ) * PNT5MINUS; a[2] = (a[0] - a[1] + a[2] + a[3] ) * PNT5MINUS; a[3] = (-a[0] + a[1] + a[2] + a[3] ) / TWO; } } /* Module 8 routine */ void mod8(float r1, float r2, float *r3) { float tmp1, tmp2; tmp1 = r1; tmp2 = r2; tmp1 = PNT5MINUS * (tmp1 + tmp2); tmp2 = PNT5MINUS * (tmp1 + tmp2); *r3 = (tmp1 + tmp2) / TWO; }