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

Generated by: LCOV version 1.10