mirror of
https://github.com/mpv-player/mpv
synced 2024-08-24 07:21:49 +02:00
Replace duplicated code by a macro.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28938 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
4143892c3b
commit
e530d4b467
@ -194,62 +194,33 @@ int main(void)
|
|||||||
for (i = 0; i < ARR_SIZE - 16; i++)
|
for (i = 0; i < ARR_SIZE - 16; i++)
|
||||||
marr1[i] = marr2[i] = i;
|
marr1[i] = marr2[i] = i;
|
||||||
|
|
||||||
t = GetTimer();
|
#define testblock(func, name) \
|
||||||
v1 = read_tsc();
|
t = GetTimer(); \
|
||||||
for (i = 0; i < 100; i++)
|
v1 = read_tsc(); \
|
||||||
memcpy(marr1, marr2, ARR_SIZE - 16);
|
for (i = 0; i < 100; i++) \
|
||||||
v2 = read_tsc();
|
func(marr1, marr2, ARR_SIZE - 16); \
|
||||||
t = GetTimer() - t;
|
v2 = read_tsc(); \
|
||||||
// ARR_SIZE*100 / (1024*1024) / (t/1000000) = ARR_SIZE*95.36743 / t
|
t = GetTimer() - t; \
|
||||||
printf("libc: CPU clocks=%llu = %dus (%5.3ffps) %5.1fMB/s\n", v2-v1, t,
|
/* ARR_SIZE*100 / (1024*1024) / (t/1000000) = ARR_SIZE*95.36743 / t */ \
|
||||||
100000000.0f/(float)t, (float)ARR_SIZE*95.36743f/(float)t);
|
printf(name "CPU clocks=%llu = %dus (%5.3ffps) %5.1fMB/s\n", v2-v1, t, \
|
||||||
|
100000000.0f / (float)t, (float)ARR_SIZE*95.36743f / (float)t);
|
||||||
|
|
||||||
|
testblock(memcpy, "libc: ");
|
||||||
|
|
||||||
#if HAVE_MMX
|
#if HAVE_MMX
|
||||||
t = GetTimer();
|
testblock(fast_memcpy_MMX, "MMX: ");
|
||||||
v1 = read_tsc();
|
|
||||||
for (i = 0; i < 100; i++)
|
|
||||||
fast_memcpy_MMX(marr1, marr2, ARR_SIZE - 16);
|
|
||||||
v2 = read_tsc();
|
|
||||||
t = GetTimer() - t;
|
|
||||||
// ARR_SIZE*100 / (1024*1024) / (t/1000000) = ARR_SIZE*95.36743 / t
|
|
||||||
printf("MMX: CPU clocks=%llu = %dus (%5.3ffps) %5.1fMB/s\n", v2-v1, t,
|
|
||||||
100000000.0f/(float)t, (float)ARR_SIZE*95.36743f/(float)t);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_AMD3DNOW
|
#if HAVE_AMD3DNOW
|
||||||
t = GetTimer();
|
testblock(fast_memcpy_3DNow, "3DNow!: ");
|
||||||
v1 = read_tsc();
|
|
||||||
for (i = 0; i < 100; i++)
|
|
||||||
fast_memcpy_3DNow(marr1, marr2, ARR_SIZE - 16);
|
|
||||||
v2 = read_tsc();
|
|
||||||
t = GetTimer() - t;
|
|
||||||
// ARR_SIZE*100 / (1024*1024) / (t/1000000) = ARR_SIZE*95.36743 / t
|
|
||||||
printf("3DNow!: CPU clocks=%llu = %dus (%5.3ffps) %5.1fMB/s\n", v2-v1, t,
|
|
||||||
100000000.0f/(float)t, (float)ARR_SIZE*95.36743f/(float)t);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_MMX2
|
#if HAVE_MMX2
|
||||||
t = GetTimer();
|
testblock(fast_memcpy_MMX2, "MMX2: ");
|
||||||
v1 = read_tsc();
|
|
||||||
for (i = 0; i < 100; i++)
|
|
||||||
fast_memcpy_MMX2(marr1, marr2, ARR_SIZE - 16);
|
|
||||||
v2 = read_tsc();
|
|
||||||
t = GetTimer() - t;
|
|
||||||
// ARR_SIZE*100 / (1024*1024) / (t/1000000) = ARR_SIZE*95.36743 / t
|
|
||||||
printf("MMX2: CPU clocks=%llu = %dus (%5.3ffps) %5.1fMB/s\n", v2-v1, t,
|
|
||||||
100000000.0f/(float)t, (float)ARR_SIZE*95.36743f/(float)t);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_SSE
|
#if HAVE_SSE
|
||||||
t = GetTimer();
|
testblock(fast_memcpy_SSE, "SSE: ");
|
||||||
v1 = read_tsc();
|
|
||||||
for (i = 0; i < 100; i++)
|
|
||||||
fast_memcpy_SSE(marr1, marr2, ARR_SIZE - 16);
|
|
||||||
v2 = read_tsc();
|
|
||||||
t = GetTimer() - t;
|
|
||||||
// ARR_SIZE*100 / (1024*1024) / (t/1000000) = ARR_SIZE*95.36743 / t
|
|
||||||
printf("SSE: CPU clocks=%llu = %dus (%5.3ffps) %5.1fMB/s\n", v2-v1, t,
|
|
||||||
100000000.0f/(float)t, (float)ARR_SIZE*95.36743f/(float)t);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user