Line data Source code
1 : /*
2 : * Copyright (C) 2011 Andrea Mazzoleni
3 : *
4 : * This program is free software: you can redistribute it and/or modify
5 : * it under the terms of the GNU General Public License as published by
6 : * the Free Software Foundation, either version 3 of the License, or
7 : * (at your option) any later version.
8 : *
9 : * This program is distributed in the hope that it will be useful,
10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 : * GNU General Public License for more details.
13 : *
14 : * You should have received a copy of the GNU General Public License
15 : * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 : */
17 :
18 : #include "portable.h"
19 :
20 : #include "snapraid.h"
21 : #include "util.h"
22 : #include "raid/raid.h"
23 : #include "raid/cpu.h"
24 : #include "raid/internal.h"
25 : #include "raid/memory.h"
26 : #include "state.h"
27 :
28 : /*
29 : * Size of the blocks to test.
30 : */
31 : #define TEST_SIZE (256 * KIBI)
32 :
33 : /*
34 : * Number of data blocks to test.
35 : */
36 : #define TEST_COUNT (8)
37 :
38 : /**
39 : * Differential us of two timeval.
40 : */
41 1741 : static int64_t diffgettimeofday(struct timeval *start, struct timeval *stop)
42 : {
43 : int64_t d;
44 :
45 1741 : d = 1000000LL * (stop->tv_sec - start->tv_sec);
46 1741 : d += stop->tv_usec - start->tv_usec;
47 :
48 1741 : return d;
49 : }
50 :
51 : /**
52 : * Start time measurement.
53 : */
54 : #define SPEED_START \
55 : count = 0; \
56 : gettimeofday(&start, 0); \
57 : do { \
58 : for (i = 0; i < delta; ++i)
59 :
60 : /**
61 : * Stop time measurement.
62 : */
63 : #define SPEED_STOP \
64 : count += delta; \
65 : gettimeofday(&stop, 0); \
66 : } while (diffgettimeofday(&start, &stop) < period * 1000LL) ; \
67 : ds = size * (int64_t)count * nd; \
68 : dt = diffgettimeofday(&start, &stop);
69 :
70 : /**
71 : * Global variable used to propagate side effects.
72 : *
73 : * This is required to avoid optimizing compilers
74 : * to remove code without side effects.
75 : */
76 : static unsigned side_effect;
77 :
78 4 : void speed(int period)
79 : {
80 : struct timeval start;
81 : struct timeval stop;
82 : int64_t ds;
83 : int64_t dt;
84 : int i, j;
85 : unsigned char digest[HASH_MAX];
86 : unsigned char seed[HASH_MAX];
87 : int id[RAID_PARITY_MAX];
88 : int ip[RAID_PARITY_MAX];
89 : int count;
90 4 : int delta = period >= 1000 ? 10 : 1;
91 4 : int size = TEST_SIZE;
92 4 : int nd = TEST_COUNT;
93 : int nv;
94 : void *v_alloc;
95 : void **v;
96 :
97 4 : nv = nd + RAID_PARITY_MAX + 1;
98 :
99 4 : v = malloc_nofail_vector_align(nd, nv, size, &v_alloc);
100 :
101 : /* initialize disks with fixed data */
102 36 : for (i = 0; i < nd; ++i)
103 32 : memset(v[i], i, size);
104 :
105 : /* zero buffer */
106 4 : memset(v[nd + RAID_PARITY_MAX], 0, size);
107 4 : raid_zero(v[nd + RAID_PARITY_MAX]);
108 :
109 : /* hash seed */
110 68 : for (i = 0; i < HASH_MAX; ++i)
111 64 : seed[i] = i;
112 :
113 : /* basic disks and parity mapping */
114 28 : for (i = 0; i < RAID_PARITY_MAX; ++i) {
115 24 : id[i] = i;
116 24 : ip[i] = i;
117 : }
118 :
119 4 : printf(PACKAGE " v" VERSION " by Andrea Mazzoleni, " PACKAGE_URL "\n");
120 :
121 : #ifdef __GNUC__
122 4 : printf("Compiler gcc " __VERSION__ "\n");
123 : #endif
124 :
125 : #ifdef CONFIG_X86
126 : {
127 : char vendor[CPU_VENDOR_MAX];
128 : unsigned family;
129 : unsigned model;
130 :
131 4 : raid_cpu_info(vendor, &family, &model);
132 :
133 24 : printf("CPU %s, family %u, model %u, flags%s%s%s%s%s%s\n", vendor, family, model,
134 4 : raid_cpu_has_sse2() ? " sse2" : "",
135 4 : raid_cpu_has_ssse3() ? " ssse3" : "",
136 4 : raid_cpu_has_crc32() ? " crc32" : "",
137 4 : raid_cpu_has_avx2() ? " avx2" : "",
138 4 : raid_cpu_has_slowmult() ? " slowmult" : "",
139 4 : raid_cpu_has_slowextendedreg() ? " slowext" : ""
140 : );
141 : }
142 : #else
143 : printf("CPU is not a x86/x64\n");
144 : #endif
145 : #if WORDS_BIGENDIAN
146 : printf("Memory is big-endian %d-bit\n", (int)sizeof(void *) * 8);
147 : #else
148 4 : printf("Memory is little-endian %d-bit\n", (int)sizeof(void *) * 8);
149 : #endif
150 :
151 : #if HAVE_FUTIMENS
152 4 : printf("Support nanosecond timestamps with futimens()\n");
153 : #elif HAVE_FUTIMES
154 : printf("Support nanosecond timestamps with futimes()\n");
155 : #elif HAVE_FUTIMESAT
156 : printf("Support nanosecond timestamps with futimesat()\n");
157 : #else
158 : printf("Does not support nanosecond timestamps\n");
159 : #endif
160 :
161 4 : printf("\n");
162 :
163 4 : printf("Speed test using %u data buffers of %u bytes, for a total of %u KiB.\n", nd, size, nd * size / KIBI);
164 4 : printf("Memory blocks have a displacement of %u bytes to improve cache performance.\n", RAID_MALLOC_DISPLACEMENT);
165 4 : printf("The reported values are the aggregate bandwidth of all data blocks in MB/s,\n");
166 4 : printf("not counting parity blocks.\n");
167 4 : printf("\n");
168 :
169 4 : printf("Memory write speed using the C memset() function:\n");
170 4 : printf("%8s", "memset");
171 4 : fflush(stdout);
172 :
173 1372 : SPEED_START {
174 6174 : for (j = 0; j < nd; ++j)
175 5488 : memset(v[j], j, size);
176 686 : } SPEED_STOP
177 :
178 4 : printf("%8" PRIu64, ds / dt);
179 4 : printf("\n");
180 4 : printf("\n");
181 :
182 : /* crc table */
183 4 : printf("CRC used to check the content file integrity:\n");
184 :
185 4 : printf("%8s", "table");
186 4 : fflush(stdout);
187 :
188 80 : SPEED_START {
189 360 : for (j = 0; j < nd; ++j)
190 320 : side_effect += crc32c_gen(0, v[j], size);
191 40 : } SPEED_STOP
192 :
193 4 : printf("%8" PRIu64, ds / dt);
194 4 : printf("\n");
195 :
196 4 : printf("%8s", "intel");
197 4 : fflush(stdout);
198 :
199 : #if HAVE_SSE42
200 4 : if (raid_cpu_has_crc32()) {
201 100 : SPEED_START {
202 450 : for (j = 0; j < nd; ++j)
203 400 : side_effect += crc32c_x86(0, v[j], size);
204 50 : } SPEED_STOP
205 :
206 2 : printf("%8" PRIu64, ds / dt);
207 : }
208 : #endif
209 4 : printf("\n");
210 4 : printf("\n");
211 :
212 : /* hash table */
213 4 : printf("Hash used to check the data blocks integrity:\n");
214 :
215 4 : printf("%8s", "");
216 4 : printf("%8s", "best");
217 4 : printf("%8s", "murmur3");
218 4 : printf("%8s", "spooky2");
219 4 : printf("%8s", "metro");
220 4 : printf("\n");
221 :
222 4 : printf("%8s", "hash");
223 : #ifdef CONFIG_X86
224 : if (sizeof(void *) == 4 && !raid_cpu_has_slowmult())
225 : printf("%8s", "murmur3");
226 : else
227 4 : printf("%8s", "spooky2");
228 : #else
229 : if (sizeof(void *) == 4)
230 : printf("%8s", "murmur3");
231 : else
232 : printf("%8s", "spooky2");
233 : #endif
234 4 : fflush(stdout);
235 :
236 16 : SPEED_START {
237 72 : for (j = 0; j < nd; ++j)
238 64 : memhash(HASH_MURMUR3, seed, digest, v[j], size);
239 8 : } SPEED_STOP
240 :
241 4 : printf("%8" PRIu64, ds / dt);
242 4 : fflush(stdout);
243 :
244 48 : SPEED_START {
245 216 : for (j = 0; j < nd; ++j)
246 192 : memhash(HASH_SPOOKY2, seed, digest, v[j], size);
247 24 : } SPEED_STOP
248 :
249 4 : printf("%8" PRIu64, ds / dt);
250 4 : fflush(stdout);
251 :
252 32 : SPEED_START {
253 144 : for (j = 0; j < nd; ++j)
254 128 : memhash(HASH_METRO, seed, digest, v[j], size);
255 16 : } SPEED_STOP
256 :
257 4 : printf("%8" PRIu64, ds / dt);
258 4 : printf("\n");
259 4 : printf("\n");
260 :
261 : /* RAID table */
262 4 : printf("RAID functions used for computing the parity with 'sync':\n");
263 4 : printf("%8s", "");
264 4 : printf("%8s", "best");
265 4 : printf("%8s", "int8");
266 4 : printf("%8s", "int32");
267 4 : printf("%8s", "int64");
268 : #ifdef CONFIG_X86
269 4 : printf("%8s", "sse2");
270 : #ifdef CONFIG_X86_64
271 4 : printf("%8s", "sse2e");
272 : #endif
273 4 : printf("%8s", "ssse3");
274 : #ifdef CONFIG_X86_64
275 4 : printf("%8s", "ssse3e");
276 : #endif
277 4 : printf("%8s", "avx2");
278 : #ifdef CONFIG_X86_64
279 4 : printf("%8s", "avx2e");
280 : #endif
281 : #endif
282 4 : printf("\n");
283 :
284 : /* GEN1 */
285 4 : printf("%8s", "gen1");
286 4 : printf("%8s", raid_gen1_tag());
287 4 : fflush(stdout);
288 :
289 4 : printf("%8s", "");
290 :
291 188 : SPEED_START {
292 94 : raid_gen1_int32(nd, size, v);
293 94 : } SPEED_STOP
294 :
295 4 : printf("%8" PRIu64, ds / dt);
296 4 : fflush(stdout);
297 :
298 366 : SPEED_START {
299 183 : raid_gen1_int64(nd, size, v);
300 183 : } SPEED_STOP
301 :
302 4 : printf("%8" PRIu64, ds / dt);
303 4 : fflush(stdout);
304 :
305 : #ifdef CONFIG_X86
306 : #ifdef CONFIG_SSE2
307 4 : if (raid_cpu_has_sse2()) {
308 102 : SPEED_START {
309 51 : raid_gen1_sse2(nd, size, v);
310 51 : } SPEED_STOP
311 :
312 4 : printf("%8" PRIu64, ds / dt);
313 4 : fflush(stdout);
314 : }
315 : #endif
316 :
317 : #ifdef CONFIG_X86_64
318 4 : printf("%8s", "");
319 : #endif
320 4 : printf("%8s", "");
321 : #ifdef CONFIG_X86_64
322 4 : printf("%8s", "");
323 : #endif
324 : #ifdef CONFIG_AVX2
325 4 : if (raid_cpu_has_avx2()) {
326 24 : SPEED_START {
327 12 : raid_gen1_avx2(nd, size, v);
328 12 : } SPEED_STOP
329 :
330 1 : printf("%8" PRIu64, ds / dt);
331 1 : fflush(stdout);
332 : }
333 : #endif
334 : #endif
335 4 : printf("\n");
336 :
337 : /* GEN2 */
338 4 : printf("%8s", "gen2");
339 4 : printf("%8s", raid_gen2_tag());
340 4 : fflush(stdout);
341 :
342 4 : printf("%8s", "");
343 :
344 92 : SPEED_START {
345 46 : raid_gen2_int32(nd, size, v);
346 46 : } SPEED_STOP
347 :
348 4 : printf("%8" PRIu64, ds / dt);
349 4 : fflush(stdout);
350 :
351 162 : SPEED_START {
352 81 : raid_gen2_int64(nd, size, v);
353 81 : } SPEED_STOP
354 :
355 4 : printf("%8" PRIu64, ds / dt);
356 4 : fflush(stdout);
357 :
358 : #ifdef CONFIG_X86
359 : #ifdef CONFIG_SSE2
360 4 : if (raid_cpu_has_sse2()) {
361 40 : SPEED_START {
362 20 : raid_gen2_sse2(nd, size, v);
363 20 : } SPEED_STOP
364 :
365 4 : printf("%8" PRIu64, ds / dt);
366 4 : fflush(stdout);
367 :
368 : #ifdef CONFIG_X86_64
369 38 : SPEED_START {
370 19 : raid_gen2_sse2ext(nd, size, v);
371 19 : } SPEED_STOP
372 :
373 4 : printf("%8" PRIu64, ds / dt);
374 4 : fflush(stdout);
375 : #endif
376 : }
377 : #endif
378 :
379 4 : printf("%8s", "");
380 : #ifdef CONFIG_X86_64
381 4 : printf("%8s", "");
382 : #endif
383 : #ifdef CONFIG_AVX2
384 4 : if (raid_cpu_has_avx2()) {
385 8 : SPEED_START {
386 4 : raid_gen2_avx2(nd, size, v);
387 4 : } SPEED_STOP
388 :
389 1 : printf("%8" PRIu64, ds / dt);
390 1 : fflush(stdout);
391 : }
392 : #endif
393 : #endif
394 4 : printf("\n");
395 :
396 : /* GENz */
397 4 : printf("%8s", "genz");
398 4 : printf("%8s", raid_genz_tag());
399 4 : fflush(stdout);
400 :
401 4 : printf("%8s", "");
402 :
403 56 : SPEED_START {
404 28 : raid_genz_int32(nd, size, v);
405 28 : } SPEED_STOP
406 :
407 4 : printf("%8" PRIu64, ds / dt);
408 4 : fflush(stdout);
409 :
410 114 : SPEED_START {
411 57 : raid_genz_int64(nd, size, v);
412 57 : } SPEED_STOP
413 :
414 4 : printf("%8" PRIu64, ds / dt);
415 4 : fflush(stdout);
416 :
417 : #ifdef CONFIG_X86
418 : #ifdef CONFIG_SSE2
419 4 : if (raid_cpu_has_sse2()) {
420 24 : SPEED_START {
421 12 : raid_genz_sse2(nd, size, v);
422 12 : } SPEED_STOP
423 :
424 4 : printf("%8" PRIu64, ds / dt);
425 4 : fflush(stdout);
426 :
427 : #ifdef CONFIG_X86_64
428 24 : SPEED_START {
429 12 : raid_genz_sse2ext(nd, size, v);
430 12 : } SPEED_STOP
431 :
432 4 : printf("%8" PRIu64, ds / dt);
433 4 : fflush(stdout);
434 : #endif
435 : }
436 : #endif
437 :
438 4 : printf("%8s", "");
439 : #ifdef CONFIG_X86_64
440 4 : printf("%8s", "");
441 : #endif
442 4 : printf("%8s", "");
443 :
444 : #ifdef CONFIG_X86_64
445 : #ifdef CONFIG_AVX2
446 4 : if (raid_cpu_has_avx2()) {
447 4 : SPEED_START {
448 2 : raid_genz_avx2ext(nd, size, v);
449 2 : } SPEED_STOP
450 :
451 1 : printf("%8" PRIu64, ds / dt);
452 1 : fflush(stdout);
453 : }
454 : #endif
455 : #endif
456 : #endif
457 4 : printf("\n");
458 :
459 : /* GEN3 */
460 4 : printf("%8s", "gen3");
461 4 : printf("%8s", raid_gen3_tag());
462 4 : fflush(stdout);
463 :
464 20 : SPEED_START {
465 10 : raid_gen3_int8(nd, size, v);
466 10 : } SPEED_STOP
467 :
468 4 : printf("%8" PRIu64, ds / dt);
469 4 : fflush(stdout);
470 :
471 4 : printf("%8s", "");
472 4 : printf("%8s", "");
473 :
474 : #ifdef CONFIG_X86
475 4 : if (raid_cpu_has_sse2()) {
476 4 : printf("%8s", "");
477 :
478 : #ifdef CONFIG_X86_64
479 4 : printf("%8s", "");
480 : #endif
481 : }
482 : #endif
483 :
484 : #ifdef CONFIG_X86
485 : #ifdef CONFIG_SSSE3
486 4 : if (raid_cpu_has_ssse3()) {
487 16 : SPEED_START {
488 8 : raid_gen3_ssse3(nd, size, v);
489 8 : } SPEED_STOP
490 :
491 3 : printf("%8" PRIu64, ds / dt);
492 3 : fflush(stdout);
493 :
494 : #ifdef CONFIG_X86_64
495 18 : SPEED_START {
496 9 : raid_gen3_ssse3ext(nd, size, v);
497 9 : } SPEED_STOP
498 :
499 3 : printf("%8" PRIu64, ds / dt);
500 3 : fflush(stdout);
501 : #endif
502 : }
503 : #endif
504 :
505 4 : printf("%8s", "");
506 :
507 : #ifdef CONFIG_X86_64
508 : #ifdef CONFIG_AVX2
509 4 : if (raid_cpu_has_avx2()) {
510 4 : SPEED_START {
511 2 : raid_gen3_avx2ext(nd, size, v);
512 2 : } SPEED_STOP
513 :
514 1 : printf("%8" PRIu64, ds / dt);
515 1 : fflush(stdout);
516 : }
517 : #endif
518 : #endif
519 : #endif
520 4 : printf("\n");
521 :
522 : /* GEN4 */
523 4 : printf("%8s", "gen4");
524 4 : printf("%8s", raid_gen4_tag());
525 4 : fflush(stdout);
526 :
527 16 : SPEED_START {
528 8 : raid_gen4_int8(nd, size, v);
529 8 : } SPEED_STOP
530 :
531 4 : printf("%8" PRIu64, ds / dt);
532 4 : fflush(stdout);
533 :
534 4 : printf("%8s", "");
535 4 : printf("%8s", "");
536 :
537 : #ifdef CONFIG_X86
538 : #ifdef CONFIG_SSE2
539 4 : if (raid_cpu_has_sse2()) {
540 4 : printf("%8s", "");
541 :
542 : #ifdef CONFIG_X86_64
543 4 : printf("%8s", "");
544 : #endif
545 : }
546 : #endif
547 : #endif
548 :
549 : #ifdef CONFIG_X86
550 : #ifdef CONFIG_SSSE3
551 4 : if (raid_cpu_has_ssse3()) {
552 12 : SPEED_START {
553 6 : raid_gen4_ssse3(nd, size, v);
554 6 : } SPEED_STOP
555 :
556 3 : printf("%8" PRIu64, ds / dt);
557 3 : fflush(stdout);
558 :
559 : #ifdef CONFIG_X86_64
560 12 : SPEED_START {
561 6 : raid_gen4_ssse3ext(nd, size, v);
562 6 : } SPEED_STOP
563 :
564 3 : printf("%8" PRIu64, ds / dt);
565 3 : fflush(stdout);
566 : #endif
567 : }
568 : #endif
569 :
570 4 : printf("%8s", "");
571 :
572 : #ifdef CONFIG_X86_64
573 : #ifdef CONFIG_AVX2
574 4 : if (raid_cpu_has_avx2()) {
575 2 : SPEED_START {
576 1 : raid_gen4_avx2ext(nd, size, v);
577 1 : } SPEED_STOP
578 :
579 1 : printf("%8" PRIu64, ds / dt);
580 1 : fflush(stdout);
581 : }
582 : #endif
583 : #endif
584 : #endif
585 4 : printf("\n");
586 :
587 : /* GEN5 */
588 4 : printf("%8s", "gen5");
589 4 : printf("%8s", raid_gen5_tag());
590 4 : fflush(stdout);
591 :
592 16 : SPEED_START {
593 8 : raid_gen5_int8(nd, size, v);
594 8 : } SPEED_STOP
595 :
596 4 : printf("%8" PRIu64, ds / dt);
597 4 : fflush(stdout);
598 :
599 4 : printf("%8s", "");
600 4 : printf("%8s", "");
601 :
602 : #ifdef CONFIG_X86
603 : #ifdef CONFIG_SSE2
604 4 : if (raid_cpu_has_sse2()) {
605 4 : printf("%8s", "");
606 :
607 : #ifdef CONFIG_X86_64
608 4 : printf("%8s", "");
609 : #endif
610 : }
611 : #endif
612 : #endif
613 :
614 : #ifdef CONFIG_X86
615 : #ifdef CONFIG_SSSE3
616 4 : if (raid_cpu_has_ssse3()) {
617 12 : SPEED_START {
618 6 : raid_gen5_ssse3(nd, size, v);
619 6 : } SPEED_STOP
620 :
621 3 : printf("%8" PRIu64, ds / dt);
622 3 : fflush(stdout);
623 :
624 : #ifdef CONFIG_X86_64
625 12 : SPEED_START {
626 6 : raid_gen5_ssse3ext(nd, size, v);
627 6 : } SPEED_STOP
628 :
629 3 : printf("%8" PRIu64, ds / dt);
630 3 : fflush(stdout);
631 : #endif
632 : }
633 : #endif
634 :
635 4 : printf("%8s", "");
636 :
637 : #ifdef CONFIG_X86_64
638 : #ifdef CONFIG_AVX2
639 4 : if (raid_cpu_has_avx2()) {
640 2 : SPEED_START {
641 1 : raid_gen5_avx2ext(nd, size, v);
642 1 : } SPEED_STOP
643 :
644 1 : printf("%8" PRIu64, ds / dt);
645 1 : fflush(stdout);
646 : }
647 : #endif
648 : #endif
649 : #endif
650 4 : printf("\n");
651 :
652 : /* GEN6 */
653 4 : printf("%8s", "gen6");
654 4 : printf("%8s", raid_gen6_tag());
655 4 : fflush(stdout);
656 :
657 16 : SPEED_START {
658 8 : raid_gen6_int8(nd, size, v);
659 8 : } SPEED_STOP
660 :
661 4 : printf("%8" PRIu64, ds / dt);
662 4 : fflush(stdout);
663 :
664 4 : printf("%8s", "");
665 4 : printf("%8s", "");
666 :
667 : #ifdef CONFIG_X86
668 : #ifdef CONFIG_SSE2
669 4 : if (raid_cpu_has_sse2()) {
670 4 : printf("%8s", "");
671 :
672 : #ifdef CONFIG_X86_64
673 4 : printf("%8s", "");
674 : #endif
675 : }
676 : #endif
677 : #endif
678 :
679 : #ifdef CONFIG_X86
680 : #ifdef CONFIG_SSSE3
681 4 : if (raid_cpu_has_ssse3()) {
682 6 : SPEED_START {
683 3 : raid_gen6_ssse3(nd, size, v);
684 3 : } SPEED_STOP
685 :
686 3 : printf("%8" PRIu64, ds / dt);
687 3 : fflush(stdout);
688 :
689 : #ifdef CONFIG_X86_64
690 8 : SPEED_START {
691 4 : raid_gen6_ssse3ext(nd, size, v);
692 4 : } SPEED_STOP
693 :
694 3 : printf("%8" PRIu64, ds / dt);
695 3 : fflush(stdout);
696 : #endif
697 : }
698 : #endif
699 :
700 4 : printf("%8s", "");
701 :
702 : #ifdef CONFIG_X86_64
703 : #ifdef CONFIG_AVX2
704 4 : if (raid_cpu_has_avx2()) {
705 2 : SPEED_START {
706 1 : raid_gen6_avx2ext(nd, size, v);
707 1 : } SPEED_STOP
708 :
709 1 : printf("%8" PRIu64, ds / dt);
710 1 : fflush(stdout);
711 : }
712 : #endif
713 : #endif
714 : #endif
715 4 : printf("\n");
716 4 : printf("\n");
717 :
718 : /* recover table */
719 4 : printf("RAID functions used for recovering with 'fix':\n");
720 4 : printf("%8s", "");
721 4 : printf("%8s", "best");
722 4 : printf("%8s", "int8");
723 : #ifdef CONFIG_X86
724 4 : printf("%8s", "ssse3");
725 4 : printf("%8s", "avx2");
726 : #endif
727 4 : printf("\n");
728 :
729 4 : printf("%8s", "rec1");
730 4 : printf("%8s", raid_rec1_tag());
731 4 : fflush(stdout);
732 :
733 8 : SPEED_START {
734 36 : for (j = 0; j < nd; ++j)
735 : /* +1 to avoid GEN1 optimized case */
736 32 : raid_rec1_int8(1, id, ip + 1, nd, size, v);
737 4 : } SPEED_STOP
738 :
739 4 : printf("%8" PRIu64, ds / dt);
740 4 : fflush(stdout);
741 :
742 : #ifdef CONFIG_X86
743 : #ifdef CONFIG_SSSE3
744 4 : if (raid_cpu_has_ssse3()) {
745 6 : SPEED_START {
746 27 : for (j = 0; j < nd; ++j)
747 : /* +1 to avoid GEN1 optimized case */
748 24 : raid_rec1_ssse3(1, id, ip + 1, nd, size, v);
749 3 : } SPEED_STOP
750 :
751 3 : printf("%8" PRIu64, ds / dt);
752 : }
753 : #endif
754 : #ifdef CONFIG_AVX2
755 4 : if (raid_cpu_has_avx2()) {
756 2 : SPEED_START {
757 9 : for (j = 0; j < nd; ++j)
758 : /* +1 to avoid GEN1 optimized case */
759 8 : raid_rec1_avx2(1, id, ip + 1, nd, size, v);
760 1 : } SPEED_STOP
761 :
762 1 : printf("%8" PRIu64, ds / dt);
763 : }
764 : #endif
765 : #endif
766 4 : printf("\n");
767 :
768 4 : printf("%8s", "rec2");
769 4 : printf("%8s", raid_rec2_tag());
770 4 : fflush(stdout);
771 :
772 8 : SPEED_START {
773 36 : for (j = 0; j < nd; ++j)
774 : /* +1 to avoid GEN2 optimized case */
775 32 : raid_rec2_int8(2, id, ip + 1, nd, size, v);
776 4 : } SPEED_STOP
777 :
778 4 : printf("%8" PRIu64, ds / dt);
779 4 : fflush(stdout);
780 :
781 : #ifdef CONFIG_X86
782 : #ifdef CONFIG_SSSE3
783 4 : if (raid_cpu_has_ssse3()) {
784 6 : SPEED_START {
785 27 : for (j = 0; j < nd; ++j)
786 : /* +1 to avoid GEN2 optimized case */
787 24 : raid_rec2_ssse3(2, id, ip + 1, nd, size, v);
788 3 : } SPEED_STOP
789 :
790 3 : printf("%8" PRIu64, ds / dt);
791 : }
792 : #endif
793 : #ifdef CONFIG_AVX2
794 4 : if (raid_cpu_has_avx2()) {
795 2 : SPEED_START {
796 9 : for (j = 0; j < nd; ++j)
797 : /* +1 to avoid GEN1 optimized case */
798 8 : raid_rec2_avx2(2, id, ip + 1, nd, size, v);
799 1 : } SPEED_STOP
800 :
801 1 : printf("%8" PRIu64, ds / dt);
802 : }
803 : #endif
804 : #endif
805 4 : printf("\n");
806 :
807 4 : printf("%8s", "rec3");
808 4 : printf("%8s", raid_recX_tag());
809 4 : fflush(stdout);
810 :
811 8 : SPEED_START {
812 36 : for (j = 0; j < nd; ++j)
813 32 : raid_recX_int8(3, id, ip, nd, size, v);
814 4 : } SPEED_STOP
815 :
816 4 : printf("%8" PRIu64, ds / dt);
817 4 : fflush(stdout);
818 :
819 : #ifdef CONFIG_X86
820 : #ifdef CONFIG_SSSE3
821 4 : if (raid_cpu_has_ssse3()) {
822 6 : SPEED_START {
823 27 : for (j = 0; j < nd; ++j)
824 24 : raid_recX_ssse3(3, id, ip, nd, size, v);
825 3 : } SPEED_STOP
826 :
827 3 : printf("%8" PRIu64, ds / dt);
828 : }
829 : #endif
830 : #ifdef CONFIG_AVX2
831 4 : if (raid_cpu_has_avx2()) {
832 2 : SPEED_START {
833 9 : for (j = 0; j < nd; ++j)
834 8 : raid_recX_avx2(3, id, ip, nd, size, v);
835 1 : } SPEED_STOP
836 :
837 1 : printf("%8" PRIu64, ds / dt);
838 : }
839 : #endif
840 : #endif
841 4 : printf("\n");
842 :
843 4 : printf("%8s", "rec4");
844 4 : printf("%8s", raid_recX_tag());
845 4 : fflush(stdout);
846 :
847 8 : SPEED_START {
848 36 : for (j = 0; j < nd; ++j)
849 32 : raid_recX_int8(4, id, ip, nd, size, v);
850 4 : } SPEED_STOP
851 :
852 4 : printf("%8" PRIu64, ds / dt);
853 4 : fflush(stdout);
854 :
855 : #ifdef CONFIG_X86
856 : #ifdef CONFIG_SSSE3
857 4 : if (raid_cpu_has_ssse3()) {
858 6 : SPEED_START {
859 27 : for (j = 0; j < nd; ++j)
860 24 : raid_recX_ssse3(4, id, ip, nd, size, v);
861 3 : } SPEED_STOP
862 :
863 3 : printf("%8" PRIu64, ds / dt);
864 : }
865 : #endif
866 : #ifdef CONFIG_AVX2
867 4 : if (raid_cpu_has_avx2()) {
868 2 : SPEED_START {
869 9 : for (j = 0; j < nd; ++j)
870 8 : raid_recX_avx2(4, id, ip, nd, size, v);
871 1 : } SPEED_STOP
872 :
873 1 : printf("%8" PRIu64, ds / dt);
874 : }
875 : #endif
876 : #endif
877 4 : printf("\n");
878 :
879 4 : printf("%8s", "rec5");
880 4 : printf("%8s", raid_recX_tag());
881 4 : fflush(stdout);
882 :
883 8 : SPEED_START {
884 36 : for (j = 0; j < nd; ++j)
885 32 : raid_recX_int8(5, id, ip, nd, size, v);
886 4 : } SPEED_STOP
887 :
888 4 : printf("%8" PRIu64, ds / dt);
889 4 : fflush(stdout);
890 :
891 : #ifdef CONFIG_X86
892 : #ifdef CONFIG_SSSE3
893 4 : if (raid_cpu_has_ssse3()) {
894 6 : SPEED_START {
895 27 : for (j = 0; j < nd; ++j)
896 24 : raid_recX_ssse3(5, id, ip, nd, size, v);
897 3 : } SPEED_STOP
898 :
899 3 : printf("%8" PRIu64, ds / dt);
900 : }
901 : #endif
902 : #ifdef CONFIG_AVX2
903 4 : if (raid_cpu_has_avx2()) {
904 2 : SPEED_START {
905 9 : for (j = 0; j < nd; ++j)
906 8 : raid_recX_avx2(5, id, ip, nd, size, v);
907 1 : } SPEED_STOP
908 :
909 1 : printf("%8" PRIu64, ds / dt);
910 : }
911 : #endif
912 : #endif
913 4 : printf("\n");
914 :
915 4 : printf("%8s", "rec6");
916 4 : printf("%8s", raid_recX_tag());
917 4 : fflush(stdout);
918 :
919 8 : SPEED_START {
920 36 : for (j = 0; j < nd; ++j)
921 32 : raid_recX_int8(6, id, ip, nd, size, v);
922 4 : } SPEED_STOP
923 :
924 4 : printf("%8" PRIu64, ds / dt);
925 4 : fflush(stdout);
926 :
927 : #ifdef CONFIG_X86
928 : #ifdef CONFIG_SSSE3
929 4 : if (raid_cpu_has_ssse3()) {
930 6 : SPEED_START {
931 27 : for (j = 0; j < nd; ++j)
932 24 : raid_recX_ssse3(6, id, ip, nd, size, v);
933 3 : } SPEED_STOP
934 :
935 3 : printf("%8" PRIu64, ds / dt);
936 : }
937 : #endif
938 : #ifdef CONFIG_AVX2
939 4 : if (raid_cpu_has_avx2()) {
940 2 : SPEED_START {
941 9 : for (j = 0; j < nd; ++j)
942 8 : raid_recX_avx2(6, id, ip, nd, size, v);
943 1 : } SPEED_STOP
944 :
945 1 : printf("%8" PRIu64, ds / dt);
946 : }
947 : #endif
948 : #endif
949 4 : printf("\n");
950 4 : printf("\n");
951 :
952 4 : printf("If the 'best' expectations are wrong, please report it in the SnapRAID forum\n\n");
953 :
954 4 : free(v_alloc);
955 4 : free(v);
956 4 : }
957 :
|