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

Generated by: LCOV version 1.10