Mercurial > mplayer.hg
annotate TOOLS/fastmemcpybench.c @ 36920:40ad45360c8a
Replace old item 'potmeter' by new item 'pimage'.
Recent versions of the X11/GTK GUI didn't allow to control a potmeter,
because that didn't seem to make any sense.
In order to get rid of the confusing potmeter that doesn't distinguish
from a hpotmeter and in order to allow the more useful behaviour recent
versions of the X11/GTK GUI have been utilized (and because we're still
supporting item 'potmeter' for reasons of compatibility with old skins),
introduce new item 'pimage' that reuses most of the current potmeter
code.
Additionally, remove remaining code and documentation of 'potmeter'.
author | ib |
---|---|
date | Mon, 17 Mar 2014 12:29:46 +0000 |
parents | fc2fd624ecc0 |
children |
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. | |
30416
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
28903
diff
changeset
|
8 * |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
28903
diff
changeset
|
9 * This program is free software; you can redistribute it and/or modify |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
28903
diff
changeset
|
10 * it under the terms of the GNU General Public License as published by |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
28903
diff
changeset
|
11 * the Free Software Foundation; either version 2 of the License, or |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
28903
diff
changeset
|
12 * (at your option) any later version. |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
28903
diff
changeset
|
13 * |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
28903
diff
changeset
|
14 * This program is distributed in the hope that it will be useful, |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
28903
diff
changeset
|
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
28903
diff
changeset
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
28903
diff
changeset
|
17 * GNU General Public License for more details. |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
28903
diff
changeset
|
18 * |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
28903
diff
changeset
|
19 * You should have received a copy of the GNU General Public License along |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
28903
diff
changeset
|
20 * with this program; if not, write to the Free Software Foundation, Inc., |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
28903
diff
changeset
|
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
b573c7c7173b
Add standard license header to C tools missing them.
diego
parents:
28903
diff
changeset
|
22 */ |
562
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
23 |
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
24 #include <stdio.h> |
572 | 25 #include <stdlib.h> |
26 #include <string.h> | |
27 #include <unistd.h> | |
28 #include <fcntl.h> | |
29 #include <sys/time.h> | |
13839 | 30 #include <inttypes.h> |
28894
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
31 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
32 #include "config.h" |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
33 #include "cpudetect.h" |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
34 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
35 #define BLOCK_SIZE 4096 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
36 #define CONFUSION_FACTOR 0 |
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_MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
39 #define COMPILE_MMX |
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 #if HAVE_MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
43 #define COMPILE_MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
44 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
45 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
46 #if HAVE_AMD3DNOW |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
47 #define COMPILE_AMD3DNOW |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
48 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
49 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
50 #if HAVE_SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
51 #define COMPILE_SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
52 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
53 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
54 #ifdef COMPILE_MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
55 #undef RENAME |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
56 #undef HAVE_MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
57 #undef HAVE_MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
58 #undef HAVE_AMD3DNOW |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
59 #undef HAVE_SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
60 #undef HAVE_SSE2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
61 #define HAVE_MMX 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
62 #define HAVE_MMX2 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
63 #define HAVE_AMD3DNOW 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
64 #define HAVE_SSE 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
65 #define HAVE_SSE2 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
66 #define RENAME(a) a ## _MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
67 #include "libvo/aclib_template.c" |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
68 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
69 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
70 #ifdef COMPILE_MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
71 #undef RENAME |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
72 #undef HAVE_MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
73 #undef HAVE_MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
74 #undef HAVE_AMD3DNOW |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
75 #undef HAVE_SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
76 #undef HAVE_SSE2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
77 #define HAVE_MMX 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
78 #define HAVE_MMX2 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
79 #define HAVE_AMD3DNOW 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
80 #define HAVE_SSE 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
81 #define HAVE_SSE2 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
82 #define RENAME(a) a ## _MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
83 #include "libvo/aclib_template.c" |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
84 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
85 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
86 #ifdef COMPILE_AMD3DNOW |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
87 #undef RENAME |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
88 #undef HAVE_MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
89 #undef HAVE_MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
90 #undef HAVE_AMD3DNOW |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
91 #undef HAVE_SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
92 #undef HAVE_SSE2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
93 #define HAVE_MMX 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
94 #define HAVE_MMX2 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
95 #define HAVE_AMD3DNOW 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
96 #define HAVE_SSE 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
97 #define HAVE_SSE2 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
98 #define RENAME(a) a ## _3DNow |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
99 #include "libvo/aclib_template.c" |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
100 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
101 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
102 #ifdef COMPILE_SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
103 #undef RENAME |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
104 #undef HAVE_MMX |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
105 #undef HAVE_MMX2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
106 #undef HAVE_AMD3DNOW |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
107 #undef HAVE_SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
108 #undef HAVE_SSE2 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
109 #define HAVE_MMX 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
110 #define HAVE_MMX2 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
111 #define HAVE_AMD3DNOW 0 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
112 #define HAVE_SSE 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
113 #define HAVE_SSE2 1 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
114 #define RENAME(a) a ## _SSE |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
115 #include "libvo/aclib_template.c" |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
116 #endif |
562
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
117 |
572 | 118 //#define ARR_SIZE 100000 |
119 #define ARR_SIZE (1024*768*2) | |
120 | |
27365
13c920fdf7f5
Change a bunch of video-output-specific preprocessor directives from a HAVE_
diego
parents:
26759
diff
changeset
|
121 #ifdef CONFIG_MGA |
572 | 122 |
35923
fc2fd624ecc0
Move headers only required for the MGA code below MGA ifdef.
diego
parents:
35904
diff
changeset
|
123 #include <sys/ioctl.h> |
fc2fd624ecc0
Move headers only required for the MGA code below MGA ifdef.
diego
parents:
35904
diff
changeset
|
124 #include <sys/mman.h> |
fc2fd624ecc0
Move headers only required for the MGA code below MGA ifdef.
diego
parents:
35904
diff
changeset
|
125 |
17017 | 126 #include "drivers/mga_vid.h" |
572 | 127 |
128 static mga_vid_config_t mga_vid_config; | |
28868 | 129 static unsigned char* frame = NULL; |
572 | 130 static int f; |
131 | |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
27757
diff
changeset
|
132 static int mga_init(void) |
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
27757
diff
changeset
|
133 { |
28868 | 134 f = open("/dev/mga_vid", O_RDWR); |
135 if (f == -1) { | |
28869 | 136 fprintf(stderr, "Couldn't open /dev/mga_vid.\n"); |
28868 | 137 return -1; |
138 } | |
572 | 139 |
28868 | 140 mga_vid_config.num_frames = 1; |
141 mga_vid_config.frame_size = ARR_SIZE; | |
142 mga_vid_config.format = MGA_VID_FORMAT_YUY2; | |
143 | |
144 mga_vid_config.colkey_on = 0; | |
145 mga_vid_config.src_width = 640; | |
146 mga_vid_config.src_height = 480; | |
147 mga_vid_config.dest_width = 320; | |
148 mga_vid_config.dest_height = 200; | |
149 mga_vid_config.x_org = 0; | |
150 mga_vid_config.y_org = 0; | |
572 | 151 |
28868 | 152 mga_vid_config.version = MGA_VID_VERSION; |
153 if (ioctl(f, MGA_VID_CONFIG, &mga_vid_config)) { | |
154 perror("Error in mga_vid_config ioctl()"); | |
155 printf("Your mga_vid driver version is incompatible with this MPlayer version!\n"); | |
156 exit(1); | |
157 } | |
158 ioctl(f, MGA_VID_ON, 0); | |
572 | 159 |
28868 | 160 frame = (char*)mmap(0, mga_vid_config.frame_size*mga_vid_config.num_frames, |
161 PROT_WRITE,MAP_SHARED, f, 0); | |
162 if (!frame) { | |
28869 | 163 printf("Can't mmap MGA frame.\n"); |
28868 | 164 exit(1); |
165 } | |
572 | 166 |
28868 | 167 //clear the buffer |
168 //memset(frames[0], 0x80, mga_vid_config.frame_size*mga_vid_config.num_frames); | |
572 | 169 |
28868 | 170 return 0; |
572 | 171 } |
172 | |
173 #endif | |
174 | |
175 // Returns current time in microseconds | |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
27757
diff
changeset
|
176 static unsigned int GetTimer(void) |
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
27757
diff
changeset
|
177 { |
28868 | 178 struct timeval tv; |
179 //float s; | |
35904
cef5275fc11f
Avoid usage of obsolete and BSD-specific "struct timezone".
diego
parents:
30416
diff
changeset
|
180 gettimeofday(&tv, NULL); |
28868 | 181 //s = tv.tv_usec; s *= 0.000001; s += tv.tv_sec; |
182 return tv.tv_sec * 1000000 + tv.tv_usec; | |
183 } | |
562
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
184 |
28868 | 185 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
|
186 { |
28868 | 187 unsigned long long int retval; |
188 __asm__ volatile ("rdtsc":"=A" (retval)::"memory"); | |
189 return retval; | |
562
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
190 } |
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
191 |
28868 | 192 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
|
193 |
28868 | 194 int main(void) |
562
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
195 { |
28868 | 196 unsigned long long int v1, v2; |
197 unsigned char *marr1, *marr2; | |
198 int i; | |
199 unsigned int t; | |
27365
13c920fdf7f5
Change a bunch of video-output-specific preprocessor directives from a HAVE_
diego
parents:
26759
diff
changeset
|
200 #ifdef CONFIG_MGA |
28868 | 201 mga_init(); |
202 marr1 = &frame[3]; | |
572 | 203 #else |
28868 | 204 marr1 = &arr1[0]; |
572 | 205 #endif |
28868 | 206 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
|
207 |
28868 | 208 for (i = 0; i < ARR_SIZE - 16; i++) |
209 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
|
210 |
28903 | 211 #define testblock(func, name) \ |
212 t = GetTimer(); \ | |
213 v1 = read_tsc(); \ | |
214 for (i = 0; i < 100; i++) \ | |
215 func(marr1, marr2, ARR_SIZE - 16); \ | |
216 v2 = read_tsc(); \ | |
217 t = GetTimer() - t; \ | |
218 /* ARR_SIZE*100 / (1024*1024) / (t/1000000) = ARR_SIZE*95.36743 / t */ \ | |
219 printf(name "CPU clocks=%llu = %dus (%5.3ffps) %5.1fMB/s\n", v2-v1, t, \ | |
220 100000000.0f / (float)t, (float)ARR_SIZE*95.36743f / (float)t); | |
221 | |
222 testblock(memcpy, "libc: "); | |
28894
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
223 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
224 #if HAVE_MMX |
28903 | 225 testblock(fast_memcpy_MMX, "MMX: "); |
28894
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
226 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
227 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
228 #if HAVE_AMD3DNOW |
28903 | 229 testblock(fast_memcpy_3DNow, "3DNow!: "); |
28894
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
230 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
231 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
232 #if HAVE_MMX2 |
28903 | 233 testblock(fast_memcpy_MMX2, "MMX2: "); |
28894
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
234 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
235 |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
236 #if HAVE_SSE |
28903 | 237 testblock(fast_memcpy_SSE, "SSE: "); |
28894
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
238 #endif |
b29169fccda9
Fix and restructure fastmemcpybench. It is now one binary that runs all
diego
parents:
28871
diff
changeset
|
239 |
28868 | 240 return 0; |
562
312fee2a6816
Initial release, used to benchmark fastmemcpy.h code from libvo.
atmosfear
parents:
diff
changeset
|
241 } |