Mercurial > mplayer.hg
annotate TOOLS/fastmemcpybench.c @ 28899:58ed7753cee9
Make MMX registers parametrized in the YSCALEYUV2PACKEDX_YA macro
author | sdrik |
---|---|
date | Wed, 11 Mar 2009 14:44:22 +0000 |
parents | b29169fccda9 |
children | 1d34931ae1e6 |
rev | line source |
---|---|
562
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
1 /* |
28869 | 2 * benchmark tool for fast_memcpy code from libvo |
3 * | |
4 * NOTE: This code can not be used on Pentium MMX / II because they contain | |
5 * a bug in rdtsc. For Intel processors since P6(PII) rdpmc should be used | |
6 * instead. For PIII it's disputable and it seems the bug was fixed but this | |
7 * was not confirmed through testing. | |
562
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
8 */ |
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
9 |
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
10 #include <stdio.h> |
572 | 11 #include <stdlib.h> |
12 #include <string.h> | |
13 #include <sys/ioctl.h> | |
14 #include <unistd.h> | |
15 #include <fcntl.h> | |
16 #include <sys/mman.h> | |
17 #include <sys/time.h> | |
13839 | 18 #include <inttypes.h> |
28894
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
19 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
20 #include "config.h" |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
21 #include "cpudetect.h" |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
22 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
23 #define BLOCK_SIZE 4096 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
24 #define CONFUSION_FACTOR 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
25 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
26 #if HAVE_MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
27 #define COMPILE_MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
28 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
29 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
30 #if HAVE_MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
31 #define COMPILE_MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
32 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
33 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
34 #if HAVE_AMD3DNOW |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
35 #define COMPILE_AMD3DNOW |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
36 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
37 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
38 #if HAVE_SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
39 #define COMPILE_SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
40 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
41 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
42 #ifdef COMPILE_MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
43 #undef RENAME |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
44 #undef HAVE_MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
45 #undef HAVE_MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
46 #undef HAVE_AMD3DNOW |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
47 #undef HAVE_SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
48 #undef HAVE_SSE2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
49 #define HAVE_MMX 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
50 #define HAVE_MMX2 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
51 #define HAVE_AMD3DNOW 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
52 #define HAVE_SSE 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
53 #define HAVE_SSE2 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
54 #define RENAME(a) a ## _MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
55 #include "libvo/aclib_template.c" |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
56 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
57 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
58 #ifdef COMPILE_MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
59 #undef RENAME |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
60 #undef HAVE_MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
61 #undef HAVE_MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
62 #undef HAVE_AMD3DNOW |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
63 #undef HAVE_SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
64 #undef HAVE_SSE2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
65 #define HAVE_MMX 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
66 #define HAVE_MMX2 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
67 #define HAVE_AMD3DNOW 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
68 #define HAVE_SSE 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
69 #define HAVE_SSE2 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
70 #define RENAME(a) a ## _MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
71 #include "libvo/aclib_template.c" |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
72 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
73 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
74 #ifdef COMPILE_AMD3DNOW |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
75 #undef RENAME |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
76 #undef HAVE_MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
77 #undef HAVE_MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
78 #undef HAVE_AMD3DNOW |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
79 #undef HAVE_SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
80 #undef HAVE_SSE2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
81 #define HAVE_MMX 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
82 #define HAVE_MMX2 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
83 #define HAVE_AMD3DNOW 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
84 #define HAVE_SSE 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
85 #define HAVE_SSE2 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
86 #define RENAME(a) a ## _3DNow |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
87 #include "libvo/aclib_template.c" |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
88 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
89 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
90 #ifdef COMPILE_SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
91 #undef RENAME |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
92 #undef HAVE_MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
93 #undef HAVE_MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
94 #undef HAVE_AMD3DNOW |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
95 #undef HAVE_SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
96 #undef HAVE_SSE2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
97 #define HAVE_MMX 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
98 #define HAVE_MMX2 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
99 #define HAVE_AMD3DNOW 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
100 #define HAVE_SSE 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
101 #define HAVE_SSE2 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
102 #define RENAME(a) a ## _SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
103 #include "libvo/aclib_template.c" |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
104 #endif |
562
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
105 |
572 | 106 //#define ARR_SIZE 100000 |
107 #define ARR_SIZE (1024*768*2) | |
108 | |
27365
13c920fdf7f5
Change a bunch of video-output-specific preprocessor directives from a HAVE_
diego
parents:
26759
diff
changeset
|
109 #ifdef CONFIG_MGA |
572 | 110 |
17017 | 111 #include "drivers/mga_vid.h" |
572 | 112 |
113 static mga_vid_config_t mga_vid_config; | |
28868 | 114 static unsigned char* frame = NULL; |
572 | 115 static int f; |
116 | |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
27757
diff
changeset
|
117 static int mga_init(void) |
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
27757
diff
changeset
|
118 { |
28868 | 119 f = open("/dev/mga_vid", O_RDWR); |
120 if (f == -1) { | |
28869 | 121 fprintf(stderr, "Couldn't open /dev/mga_vid.\n"); |
28868 | 122 return -1; |
123 } | |
572 | 124 |
28868 | 125 mga_vid_config.num_frames = 1; |
126 mga_vid_config.frame_size = ARR_SIZE; | |
127 mga_vid_config.format = MGA_VID_FORMAT_YUY2; | |
128 | |
129 mga_vid_config.colkey_on = 0; | |
130 mga_vid_config.src_width = 640; | |
131 mga_vid_config.src_height = 480; | |
132 mga_vid_config.dest_width = 320; | |
133 mga_vid_config.dest_height = 200; | |
134 mga_vid_config.x_org = 0; | |
135 mga_vid_config.y_org = 0; | |
572 | 136 |
28868 | 137 mga_vid_config.version = MGA_VID_VERSION; |
138 if (ioctl(f, MGA_VID_CONFIG, &mga_vid_config)) { | |
139 perror("Error in mga_vid_config ioctl()"); | |
140 printf("Your mga_vid driver version is incompatible with this MPlayer version!\n"); | |
141 exit(1); | |
142 } | |
143 ioctl(f, MGA_VID_ON, 0); | |
572 | 144 |
28868 | 145 frame = (char*)mmap(0, mga_vid_config.frame_size*mga_vid_config.num_frames, |
146 PROT_WRITE,MAP_SHARED, f, 0); | |
147 if (!frame) { | |
28869 | 148 printf("Can't mmap MGA frame.\n"); |
28868 | 149 exit(1); |
150 } | |
572 | 151 |
28868 | 152 //clear the buffer |
153 //memset(frames[0], 0x80, mga_vid_config.frame_size*mga_vid_config.num_frames); | |
572 | 154 |
28868 | 155 return 0; |
572 | 156 } |
157 | |
158 #endif | |
159 | |
160 // Returns current time in microseconds | |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
27757
diff
changeset
|
161 static unsigned int GetTimer(void) |
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
27757
diff
changeset
|
162 { |
28868 | 163 struct timeval tv; |
164 struct timezone tz; | |
165 //float s; | |
166 gettimeofday(&tv, &tz); | |
167 //s = tv.tv_usec; s *= 0.000001; s += tv.tv_sec; | |
168 return tv.tv_sec * 1000000 + tv.tv_usec; | |
169 } | |
562
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
170 |
28868 | 171 static inline unsigned long long int read_tsc(void) |
562
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
172 { |
28868 | 173 unsigned long long int retval; |
174 __asm__ volatile ("rdtsc":"=A" (retval)::"memory"); | |
175 return retval; | |
562
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
176 } |
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
177 |
28868 | 178 unsigned char __attribute__((aligned(4096)))arr1[ARR_SIZE], arr2[ARR_SIZE]; |
562
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
179 |
28868 | 180 int main(void) |
562
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
181 { |
28868 | 182 unsigned long long int v1, v2; |
183 unsigned char *marr1, *marr2; | |
184 int i; | |
185 unsigned int t; | |
27365
13c920fdf7f5
Change a bunch of video-output-specific preprocessor directives from a HAVE_
diego
parents:
26759
diff
changeset
|
186 #ifdef CONFIG_MGA |
28868 | 187 mga_init(); |
188 marr1 = &frame[3]; | |
572 | 189 #else |
28868 | 190 marr1 = &arr1[0]; |
572 | 191 #endif |
28868 | 192 marr2 = &arr2[0]; |
3076
bfc881c0e591
newly allocated memory seems to point to only 1 zero filled 4k page or something so there is a near 100% cache hit rate ... not very realistic, writeing something in the source array fixes that so the benchmark scores are meaningfull now
michael
parents:
687
diff
changeset
|
193 |
28868 | 194 for (i = 0; i < ARR_SIZE - 16; i++) |
195 marr1[i] = marr2[i] = i; | |
3076
bfc881c0e591
newly allocated memory seems to point to only 1 zero filled 4k page or something so there is a near 100% cache hit rate ... not very realistic, writeing something in the source array fixes that so the benchmark scores are meaningfull now
michael
parents:
687
diff
changeset
|
196 |
28868 | 197 t = GetTimer(); |
198 v1 = read_tsc(); | |
199 for (i = 0; i < 100; i++) | |
28894
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
200 memcpy(marr1, marr2, ARR_SIZE - 16); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
201 v2 = read_tsc(); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
202 t = GetTimer() - t; |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
203 // ARR_SIZE*100 / (1024*1024) / (t/1000000) = ARR_SIZE*95.36743 / t |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
204 printf("libc: CPU clocks=%llu = %dus (%5.3ffps) %5.1fMB/s\n", v2-v1, t, |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
205 100000000.0f/(float)t, (float)ARR_SIZE*95.36743f/(float)t); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
206 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
207 #if HAVE_MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
208 t = GetTimer(); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
209 v1 = read_tsc(); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
210 for (i = 0; i < 100; i++) |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
211 fast_memcpy_MMX(marr1, marr2, ARR_SIZE - 16); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
212 v2 = read_tsc(); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
213 t = GetTimer() - t; |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
214 // ARR_SIZE*100 / (1024*1024) / (t/1000000) = ARR_SIZE*95.36743 / t |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
215 printf("MMX: CPU clocks=%llu = %dus (%5.3ffps) %5.1fMB/s\n", v2-v1, t, |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
216 100000000.0f/(float)t, (float)ARR_SIZE*95.36743f/(float)t); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
217 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
218 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
219 #if HAVE_AMD3DNOW |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
220 t = GetTimer(); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
221 v1 = read_tsc(); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
222 for (i = 0; i < 100; i++) |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
223 fast_memcpy_3DNow(marr1, marr2, ARR_SIZE - 16); |
28868 | 224 v2 = read_tsc(); |
225 t = GetTimer() - t; | |
226 // ARR_SIZE*100 / (1024*1024) / (t/1000000) = ARR_SIZE*95.36743 / t | |
28894
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
227 printf("3DNow!: CPU clocks=%llu = %dus (%5.3ffps) %5.1fMB/s\n", v2-v1, t, |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
228 100000000.0f/(float)t, (float)ARR_SIZE*95.36743f/(float)t); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
229 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
230 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
231 #if HAVE_MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
232 t = GetTimer(); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
233 v1 = read_tsc(); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
234 for (i = 0; i < 100; i++) |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
235 fast_memcpy_MMX2(marr1, marr2, ARR_SIZE - 16); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
236 v2 = read_tsc(); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
237 t = GetTimer() - t; |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
238 // ARR_SIZE*100 / (1024*1024) / (t/1000000) = ARR_SIZE*95.36743 / t |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
239 printf("MMX2: CPU clocks=%llu = %dus (%5.3ffps) %5.1fMB/s\n", v2-v1, t, |
28868 | 240 100000000.0f/(float)t, (float)ARR_SIZE*95.36743f/(float)t); |
28894
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
241 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
242 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
243 #if HAVE_SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
244 t = GetTimer(); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
245 v1 = read_tsc(); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
246 for (i = 0; i < 100; i++) |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
247 fast_memcpy_SSE(marr1, marr2, ARR_SIZE - 16); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
248 v2 = read_tsc(); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
249 t = GetTimer() - t; |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
250 // ARR_SIZE*100 / (1024*1024) / (t/1000000) = ARR_SIZE*95.36743 / t |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
251 printf("SSE: CPU clocks=%llu = %dus (%5.3ffps) %5.1fMB/s\n", v2-v1, t, |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
252 100000000.0f/(float)t, (float)ARR_SIZE*95.36743f/(float)t); |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
253 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
254 |
28868 | 255 return 0; |
562
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
256 } |