LCOV - code coverage report
Current view: top level - cmdline - speed.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 490 492 99.6 %
Date: 2026-03-15 15:58:19 Functions: 2 2 100.0 %

          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             :  * Differential us of two timeval.
      30             :  */
      31        1365 : static int64_t diffgettimeofday(struct timeval* start, struct timeval* stop)
      32             : {
      33             :         int64_t d;
      34             : 
      35        1365 :         d = 1000000LL * (stop->tv_sec - start->tv_sec);
      36        1365 :         d += stop->tv_usec - start->tv_usec;
      37             : 
      38        1365 :         return d;
      39             : }
      40             : 
      41             : /**
      42             :  * Start time measurement.
      43             :  */
      44             : #define SPEED_START \
      45             :         count = 0; \
      46             :         gettimeofday(&start, 0); \
      47             :         do { \
      48             :                 for (i = 0; i < delta; ++i)
      49             : 
      50             : /**
      51             :  * Stop time measurement.
      52             :  */
      53             : /* INDENT-OFF */
      54             : #define SPEED_STOP \
      55             :         count += delta; \
      56             :         gettimeofday(&stop, 0); \
      57             :         } while (diffgettimeofday(&start, &stop) < period * 1000LL); \
      58             :         ds = size * (int64_t)count * nd; \
      59             :         dt = diffgettimeofday(&start, &stop);
      60             : /* INDENT-ON */
      61             : 
      62             : /**
      63             :  * Global variable used to propagate side effects.
      64             :  *
      65             :  * This is required to avoid optimizing compilers
      66             :  * to remove code without side effects.
      67             :  */
      68             : static unsigned side_effect;
      69             : 
      70           4 : void speed(int period, int nd, int size)
      71             : {
      72             :         struct timeval start;
      73             :         struct timeval stop;
      74             :         int64_t ds;
      75             :         int64_t dt;
      76             :         int i, j;
      77             :         unsigned char digest[HASH_MAX];
      78             :         unsigned char seed[HASH_MAX];
      79             :         int id[RAID_PARITY_MAX];
      80             :         int ip[RAID_PARITY_MAX];
      81             :         int count;
      82             :         int delta;
      83             :         int nv;
      84             :         void* v_alloc;
      85             :         void** v;
      86             : 
      87           4 :         if (nd < 0)
      88           4 :                 nd = 8;
      89           4 :         if (size < 0)
      90           4 :                 size = 256 * KIBI;
      91             :         else
      92           0 :                 size *= KIBI;
      93           4 :         if (period < 0)
      94           0 :                 period = 1000;
      95             : 
      96           4 :         delta = period >= 1000 ? 10 : 1;
      97             : 
      98           4 :         nv = nd + RAID_PARITY_MAX + 1;
      99             : 
     100           4 :         v = malloc_nofail_vector_align(nd, nv, size, &v_alloc);
     101             : 
     102             :         /* initialize disks with fixed data */
     103          36 :         for (i = 0; i < nd; ++i)
     104          32 :                 memset(v[i], i, size);
     105             : 
     106             :         /* zero buffer */
     107           4 :         memset(v[nd + RAID_PARITY_MAX], 0, size);
     108           4 :         raid_zero(v[nd + RAID_PARITY_MAX]);
     109             : 
     110             :         /* hash seed */
     111          68 :         for (i = 0; i < HASH_MAX; ++i)
     112          64 :                 seed[i] = i;
     113             : 
     114             :         /* basic disks and parity mapping */
     115          28 :         for (i = 0; i < RAID_PARITY_MAX; ++i) {
     116          24 :                 id[i] = i;
     117          24 :                 ip[i] = i;
     118             :         }
     119             : 
     120           4 :         printf(PACKAGE " v" VERSION " by Andrea Mazzoleni, " PACKAGE_URL "\n");
     121             : 
     122             : #ifdef __GNUC__
     123           4 :         printf("Compiler gcc " __VERSION__ "\n");
     124             : #endif
     125             : 
     126             : #ifdef CONFIG_X86
     127             :         {
     128             :                 char vendor[CPU_VENDOR_MAX];
     129             :                 unsigned family;
     130             :                 unsigned model;
     131             : 
     132           4 :                 raid_cpu_info(vendor, &family, &model);
     133             : 
     134          24 :                 printf("CPU %s, family %u, model %u, flags%s%s%s%s%s%s\n", vendor, family, model,
     135           4 :                         raid_cpu_has_sse2() ? " sse2" : "",
     136           4 :                         raid_cpu_has_ssse3() ? " ssse3" : "",
     137           4 :                         raid_cpu_has_crc32() ? " crc32" : "",
     138           4 :                         raid_cpu_has_avx2() ? " avx2" : "",
     139           4 :                         raid_cpu_has_slowmult() ? " slowmult" : "",
     140           4 :                         raid_cpu_has_slowextendedreg() ? " slowext" : ""
     141             :                 );
     142             :         }
     143             : #else
     144             :         printf("CPU is not a x86/x64\n");
     145             : #endif
     146             : #if WORDS_BIGENDIAN
     147             :         printf("Memory is big-endian %d-bit\n", (int)sizeof(void*) * 8);
     148             : #else
     149           4 :         printf("Memory is little-endian %d-bit\n", (int)sizeof(void*) * 8);
     150             : #endif
     151             : 
     152             : #if HAVE_FUTIMENS
     153           4 :         printf("Support nanosecond timestamps with futimens()\n");
     154             : #elif HAVE_FUTIMES
     155             :         printf("Support nanosecond timestamps with futimes()\n");
     156             : #elif HAVE_FUTIMESAT
     157             :         printf("Support nanosecond timestamps with futimesat()\n");
     158             : #else
     159             :         printf("Does not support nanosecond timestamps\n");
     160             : #endif
     161             : 
     162           4 :         printf("\n");
     163             : 
     164           4 :         printf("Speed test using %u data buffers of %u bytes, for a total of %u KiB.\n", nd, size, nd * size / KIBI);
     165           4 :         printf("Memory blocks have a displacement of %u bytes to improve cache performance.\n", RAID_MALLOC_DISPLACEMENT);
     166           4 :         printf("The reported values are the aggregate bandwidth of all data blocks in MB/s,\n");
     167           4 :         printf("not counting parity blocks.\n");
     168           4 :         printf("\n");
     169             : 
     170           4 :         printf("Memory write speed using the C memset() function:\n");
     171           4 :         printf("%8s", "memset");
     172           4 :         fflush(stdout);
     173             : 
     174        1024 :         SPEED_START {
     175        4608 :                 for (j = 0; j < nd; ++j)
     176        4096 :                         memset(v[j], j, size);
     177         512 :         } SPEED_STOP
     178             : 
     179           4 :         printf("%8" PRIu64, ds / dt);
     180           4 :         printf("\n");
     181           4 :         printf("\n");
     182             : 
     183             :         /* crc table */
     184           4 :         printf("CRC used to check the content file integrity:\n");
     185             : 
     186           4 :         printf("%8s", "table");
     187           4 :         fflush(stdout);
     188             : 
     189          58 :         SPEED_START {
     190         261 :                 for (j = 0; j < nd; ++j)
     191         232 :                         side_effect += crc32c_gen(0, v[j], size);
     192          29 :         } SPEED_STOP
     193             : 
     194           4 :         printf("%8" PRIu64, ds / dt);
     195           4 :         printf("\n");
     196             : 
     197           4 :         printf("%8s", "intel");
     198           4 :         fflush(stdout);
     199             : 
     200             : #if HAVE_SSE42
     201           4 :         if (raid_cpu_has_crc32()) {
     202          82 :                 SPEED_START {
     203         369 :                         for (j = 0; j < nd; ++j)
     204         328 :                                 side_effect += crc32c_x86(0, v[j], size);
     205          41 :                 } SPEED_STOP
     206             : 
     207           2 :                 printf("%8" PRIu64, ds / dt);
     208             :         }
     209             : #endif
     210           4 :         printf("\n");
     211           4 :         printf("\n");
     212             : 
     213             :         /* hash table */
     214           4 :         printf("Hash used to check the data blocks integrity:\n");
     215             : 
     216           4 :         printf("%8s", "");
     217           4 :         printf("%8s", "best");
     218           4 :         printf("%8s", "murmur3");
     219           4 :         printf("%8s", "spooky2");
     220           4 :         printf("%8s", "metro");
     221           4 :         printf("%8s", "museair");
     222           4 :         printf("\n");
     223             : 
     224           4 :         printf("%8s", "hash");
     225           4 :         printf("%8s", memhashname(membesthash()));
     226           4 :         fflush(stdout);
     227             : 
     228          16 :         SPEED_START {
     229          72 :                 for (j = 0; j < nd; ++j)
     230          64 :                         memhash(HASH_MURMUR3, seed, digest, v[j], size);
     231           8 :         } SPEED_STOP
     232             : 
     233           4 :         printf("%8" PRIu64, ds / dt);
     234           4 :         fflush(stdout);
     235             : 
     236          32 :         SPEED_START {
     237         144 :                 for (j = 0; j < nd; ++j)
     238         128 :                         memhash(HASH_SPOOKY2, seed, digest, v[j], size);
     239          16 :         } SPEED_STOP
     240             : 
     241           4 :         printf("%8" PRIu64, ds / dt);
     242           4 :         fflush(stdout);
     243             : 
     244          26 :         SPEED_START {
     245         117 :                 for (j = 0; j < nd; ++j)
     246         104 :                         memhash(HASH_METRO, seed, digest, v[j], size);
     247          13 :         } SPEED_STOP
     248             : 
     249           4 :         printf("%8" PRIu64, ds / dt);
     250           4 :         fflush(stdout);
     251             : 
     252          34 :         SPEED_START {
     253         153 :                 for (j = 0; j < nd; ++j)
     254         136 :                         memhash(HASH_MUSEAIR, seed, digest, v[j], size);
     255          17 :         } 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         128 :         SPEED_START {
     292          64 :                 raid_gen1_int32(nd, size, v);
     293          64 :         } SPEED_STOP
     294             : 
     295           4 :         printf("%8" PRIu64, ds / dt);
     296           4 :         fflush(stdout);
     297             : 
     298         222 :         SPEED_START {
     299         111 :                 raid_gen1_int64(nd, size, v);
     300         111 :         } 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          94 :                 SPEED_START {
     309          47 :                         raid_gen1_sse2(nd, size, v);
     310          47 :                 } 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          26 :                 SPEED_START {
     327          13 :                         raid_gen1_avx2(nd, size, v);
     328          13 :                 } 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          64 :         SPEED_START {
     345          32 :                 raid_gen2_int32(nd, size, v);
     346          32 :         } SPEED_STOP
     347             : 
     348           4 :         printf("%8" PRIu64, ds / dt);
     349           4 :         fflush(stdout);
     350             : 
     351         116 :         SPEED_START {
     352          58 :                 raid_gen2_int64(nd, size, v);
     353          58 :         } 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          36 :                 SPEED_START {
     362          18 :                         raid_gen2_sse2(nd, size, v);
     363          18 :                 } SPEED_STOP
     364             : 
     365           4 :                 printf("%8" PRIu64, ds / dt);
     366           4 :                 fflush(stdout);
     367             : 
     368             : #ifdef CONFIG_X86_64
     369          34 :                 SPEED_START {
     370          17 :                         raid_gen2_sse2ext(nd, size, v);
     371          17 :                 } 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           6 :                 SPEED_START {
     386           3 :                         raid_gen2_avx2(nd, size, v);
     387           3 :                 } 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          40 :         SPEED_START {
     404          20 :                 raid_genz_int32(nd, size, v);
     405          20 :         } SPEED_STOP
     406             : 
     407           4 :         printf("%8" PRIu64, ds / dt);
     408           4 :         fflush(stdout);
     409             : 
     410          74 :         SPEED_START {
     411          37 :                 raid_genz_int64(nd, size, v);
     412          37 :         } 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          20 :                 SPEED_START {
     421          10 :                         raid_genz_sse2(nd, size, v);
     422          10 :                 } SPEED_STOP
     423             : 
     424           4 :                 printf("%8" PRIu64, ds / dt);
     425           4 :                 fflush(stdout);
     426             : 
     427             : #ifdef CONFIG_X86_64
     428          20 :                 SPEED_START {
     429          10 :                         raid_genz_sse2ext(nd, size, v);
     430          10 :                 } 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          16 :         SPEED_START {
     465           8 :                 raid_gen3_int8(nd, size, v);
     466           8 :         } 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          14 :                 SPEED_START {
     488           7 :                         raid_gen3_ssse3(nd, size, v);
     489           7 :                 } SPEED_STOP
     490             : 
     491           3 :                 printf("%8" PRIu64, ds / dt);
     492           3 :                 fflush(stdout);
     493             : 
     494             : #ifdef CONFIG_X86_64
     495          14 :                 SPEED_START {
     496           7 :                         raid_gen3_ssse3ext(nd, size, v);
     497           7 :                 } 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           2 :                 SPEED_START {
     511           1 :                         raid_gen3_avx2ext(nd, size, v);
     512           1 :                 } 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          14 :         SPEED_START {
     593           7 :                 raid_gen5_int8(nd, size, v);
     594           7 :         } 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           8 :                 SPEED_START {
     618           4 :                         raid_gen5_ssse3(nd, size, v);
     619           4 :                 } SPEED_STOP
     620             : 
     621           3 :                 printf("%8" PRIu64, ds / dt);
     622           3 :                 fflush(stdout);
     623             : 
     624             : #ifdef CONFIG_X86_64
     625          10 :                 SPEED_START {
     626           5 :                         raid_gen5_ssse3ext(nd, size, v);
     627           5 :                 } 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          12 :         SPEED_START {
     658           6 :                 raid_gen6_int8(nd, size, v);
     659           6 :         } 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           6 :                 SPEED_START {
     691           3 :                         raid_gen6_ssse3ext(nd, size, v);
     692           3 :                 } 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             : 

Generated by: LCOV version 1.0