20 #include <ndb_global.h>
36 Uint32 t0 = o.data[0];
37 Uint32 t1 = o.data[1];
38 Uint32 t2 = o.data[2];
39 Uint32 t3 = o.data[3];
40 Uint32 t4 = o.data[4];
41 Uint32 t5 = o.data[5];
42 Uint32 t6 = o.data[6];
66 Uint32 g_count = 8*2048;
74 MEMCOPY(Uint32 *
to,
const Uint32 * from){
118 MEMCOPY_NO_WORDS(Uint32 * to,
const Uint32 * from, Uint32 len){
163 Uint32 t0 = ts.head.data[0];
164 Uint32 t1 = ts.head.data[1];
165 Uint32 t2 = ts.head.data[2];
166 Uint32 t3 = ts.head.data[3];
167 Uint32 t4 = ts.head.data[4];
168 Uint32 t5 = ts.head.data[5];
169 Uint32 t6 = ts.head.data[6];
171 dst.head.data[0] = t0;
172 dst.head.data[1] = t1;
173 dst.head.data[2] = t2;
174 dst.head.data[3] = t3;
175 dst.head.data[4] = t4;
176 dst.head.data[5] = t5;
177 dst.head.data[6] = t6;
187 Uint32 t0 = ts.head.data[0];
188 Uint32 t1 = ts.head.data[1];
189 Uint32 t2 = ts.head.data[2];
190 Uint32 t3 = ts.head.data[3];
192 dst.head.data[0] = t0;
193 dst.head.data[1] = t1;
194 dst.head.data[2] = t2;
195 dst.head.data[3] = t3;
197 Uint32 t4 = ts.head.data[4];
198 Uint32 t5 = ts.head.data[5];
199 Uint32 t6 = ts.head.data[6];
201 dst.head.data[4] = t4;
202 dst.head.data[5] = t5;
203 dst.head.data[6] = t6;
219 memcpy(&dst.head.data[0], &ts.head.data[0],
sizeof(
Data7));
227 MEMCOPY_NO_WORDS(&dst.head.data[0], &ts.head.data[0], 7);
235 MEMCOPY<7>(&dst.head.data[0], &ts.head.data[0]);
243 #if (__GNUC__ >= 3 ) || (__GNUC__ == 2 && __GNUC_MINOR >= 95)
244 __builtin_memcpy(&dst.head.data[0], &ts.head.data[0],
sizeof(
Data7));
250 template<
void (* C)(U
int32 i, TestSignal & ts)>
255 const Uint32 count = g_count;
256 for(Uint32
i = 0;
i<count;
i++)
258 for(Uint32
i = 0;
i<count;
i++)
263 ms1 = NdbTick_CurrentMillisecond();
265 for(
int j = 100; j>= 0; j--)
266 for(Uint32
i = 0;
i<count;
i++){
269 ms2 = NdbTick_CurrentMillisecond();
271 }
while((ms2 - ms1) < ms);
277 template<
void (* C)(U
int32 i, TestSignal & ts)>
278 void doCopyLap(Uint32 laps,
const char * title){
281 const Uint32 count = g_count;
282 for(Uint32
i = 0;
i<count;
i++)
285 for(Uint32
i = 0;
i<count;
i++)
291 ms1 = NdbTick_CurrentMillisecond();
293 for(Uint32
i = 0;
i<count;
i++){
294 #if (__GNUC__ == 3 && __GNUC_MINOR >= 1)
295 _builtin_prefetch(&g_jobBuffer[
i], 1, 0);
301 ms2 = NdbTick_CurrentMillisecond();
305 ndbout_c(
"%s : %d laps in %d millis => %d copies/sec",
306 title, div, diff, (1000*div*g_count+(diff/2))/diff);
310 main(
int argc,
const char ** argv){
313 g_count = atoi(argv[1]);
316 g_time = atoi(argv[2]);
318 ndbout_c(
"Using %d entries => %d kB ",
321 ndbout_c(
"Testing for %d ms", g_time);
323 ndbout_c(
"Using %s copy-constructor",
324 (hand ?
"hand written" :
"compiler generated"));
327 for(
int i = 0;
i<10;
i++)
328 memset(g_jobBuffer, 0, g_count *
sizeof(
TestSignal));
330 int laps = doTime<copy2>(g_time);
331 ndbout_c(
"Laps = %d", laps);
333 doCopyLap<copy2>(laps,
"4 t-variables");
334 doCopyLap<copy3>(laps,
"copy constr. ");
335 doCopyLap<copy1>(laps,
"7 t-variables");
336 doCopyLap<copy4>(laps,
"mem copy ");
337 doCopyLap<copy5>(laps,
"mem copy hand");
338 doCopyLap<copy6>(laps,
"mem copy temp");
339 doCopyLap<copy7>(laps,
"mem copy gcc ");
341 delete[] g_jobBuffer;