Imported Upstream version 11.2

This commit is contained in:
Mario Fetka
2019-01-07 14:06:15 +01:00
commit 8d2a0b593e
130 changed files with 86303 additions and 0 deletions

99
raid/test/Makefile Normal file
View File

@@ -0,0 +1,99 @@
#
# Test programs for the RAID library
#
# selftest - Runs the same selftest and speedtest executed at the module startup.
# fulltest - Runs a more extensive test that checks all the built-in functions.
# speetest - Runs a more complete speed test.
# invtest - Runs an extensive matrix inversion test of all the 377.342.351.231
# possible square submatrices of the Cauchy matrix used.
# covtest - Runs a coverage test.
# sdecovtest - Runs a coverage test with the sde emulator.
#
MACHINE = $(shell uname -m)
ifeq ($(MACHINE),i686)
SDE = sde
else
SDE = sde64
endif
CC = gcc
LD = ld
CFLAGS = -I.. -Wall -Wextra -g
ifeq ($(COVERAGE),)
CFLAGS += -O2
else
CFLAGS += -O0 --coverage -DCOVERAGE=1 -DNDEBUG=1
endif
OBJS = raid.o check.o int.o intz.o x86.o x86z.o tables.o memory.o test.o helper.o module.o tag.o
%.o: ../%.c
$(CC) $(CFLAGS) -c -o $@ $<
all: fulltest speedtest selftest invtest
fulltest: $(OBJS) fulltest.o
$(CC) $(CFLAGS) -o fulltest $^
speedtest: $(OBJS) speedtest.o
$(CC) $(CFLAGS) -o speedtest $^
selftest: $(OBJS) selftest.o
$(CC) $(CFLAGS) -o selftest $^
invtest: $(OBJS) invtest.o
$(CC) $(CFLAGS) -o invtest $^
mktables: mktables.o
$(CC) $(CFLAGS) -o mktables $^
tables.c: mktables
./mktables > tables.c
# Use this target to run a coverage test using lcov
covtest:
$(MAKE) clean
$(MAKE) lcov_reset
$(MAKE) COVERAGE=1 all
./fulltest
./selftest
./speedtest
$(MAKE) lcov_capture
$(MAKE) lcov_html
# Use this target to run a coverage test using lcov and the sde
sdecovtest:
$(MAKE) clean
$(MAKE) lcov_reset
$(MAKE) COVERAGE=1 all
$(SDE) -p4p -- ./fulltest
$(SDE) -mrm -- ./fulltest
$(SDE) -nhm -- ./fulltest
$(SDE) -hsw -- ./fulltest
$(SDE) -p4p -- ./selftest
$(SDE) -mrm -- ./selftest
$(SDE) -nhm -- ./selftest
$(SDE) -hsw -- ./selftest
$(SDE) -hsw -- ./speedtest
$(MAKE) lcov_capture
$(MAKE) lcov_html
lcov_reset:
lcov --directory . -z
rm -f lcov.info
lcov_capture:
lcov --directory . --capture --rc lcov_branch_coverage=1 -o lcov.info
lcov_html:
rm -rf coverage
mkdir coverage
genhtml --branch-coverage -o coverage lcov.info
clean:
rm -f *.o mktables tables.c
rm -f *.gcda *.gcno lcov.info
rm -rf coverage
distclean: clean
rm -f fulltest speedtest selftest invtest

124
raid/test/fulltest.c Normal file
View File

@@ -0,0 +1,124 @@
/*
* Copyright (C) 2013 Andrea Mazzoleni
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/* Full sanity test for the RAID library */
#include "internal.h"
#include "test.h"
#include "cpu.h"
#include <stdio.h>
#include <stdlib.h>
/*
* Size of the blocks to test.
*/
#define TEST_SIZE 256
/**
* Number of disks in the long parity test.
*/
#ifdef COVERAGE
#define TEST_COUNT 10
#else
#define TEST_COUNT 32
#endif
int main(void)
{
printf("Full sanity test for the RAID Cauchy library\n\n");
raid_init();
#ifdef CONFIG_X86
if (raid_cpu_has_sse2())
printf("Including x86 SSE2 functions\n");
if (raid_cpu_has_ssse3())
printf("Including x86 SSSE3 functions\n");
if (raid_cpu_has_avx2())
printf("Including x86 AVX2 functions\n");
#endif
#ifdef CONFIG_X86_64
printf("Including x64 extended SSE register set\n");
#endif
printf("\nPlease wait about 60 seconds...\n\n");
printf("Test sorting...\n");
if (raid_test_sort() != 0) {
/* LCOV_EXCL_START */
goto bail;
/* LCOV_EXCL_STOP */
}
printf("Test insertion...\n");
if (raid_test_insert() != 0) {
/* LCOV_EXCL_START */
goto bail;
/* LCOV_EXCL_STOP */
}
printf("Test combinations/permutations...\n");
if (raid_test_combo() != 0) {
/* LCOV_EXCL_START */
goto bail;
/* LCOV_EXCL_STOP */
}
printf("Test Cauchy parity generation with %u data disks...\n", RAID_DATA_MAX);
if (raid_test_par(RAID_MODE_CAUCHY, RAID_DATA_MAX, TEST_SIZE) != 0) {
/* LCOV_EXCL_START */
goto bail;
/* LCOV_EXCL_STOP */
}
printf("Test Cauchy parity generation with 1 data disk...\n");
if (raid_test_par(RAID_MODE_CAUCHY, 1, TEST_SIZE) != 0) {
/* LCOV_EXCL_START */
goto bail;
/* LCOV_EXCL_STOP */
}
printf("Test Cauchy recovering with all combinations of %u data and 6 parity blocks...\n", TEST_COUNT);
if (raid_test_rec(RAID_MODE_CAUCHY, TEST_COUNT, TEST_SIZE) != 0) {
/* LCOV_EXCL_START */
goto bail;
/* LCOV_EXCL_STOP */
}
printf("Test Vandermonde parity generation with %u data disks...\n", RAID_DATA_MAX);
if (raid_test_par(RAID_MODE_VANDERMONDE, RAID_DATA_MAX, TEST_SIZE) != 0) {
/* LCOV_EXCL_START */
goto bail;
/* LCOV_EXCL_STOP */
}
printf("Test Vandermonde recovering with all combinations of %u data and 3 parity blocks...\n", TEST_COUNT);
if (raid_test_rec(RAID_MODE_VANDERMONDE, TEST_COUNT, TEST_SIZE) != 0) {
/* LCOV_EXCL_START */
goto bail;
/* LCOV_EXCL_STOP */
}
printf("OK\n");
return 0;
bail:
/* LCOV_EXCL_START */
printf("FAILED!\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}

176
raid/test/invtest.c Normal file
View File

@@ -0,0 +1,176 @@
/*
* Copyright (C) 2013 Andrea Mazzoleni
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/* Matrix inversion test for the RAID library */
#include "internal.h"
#include "combo.h"
#include "gf.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <inttypes.h>
/**
* Like raid_invert() but optimized to only check if the matrix is
* invertible.
*/
static __always_inline int raid_invert_fast(uint8_t *M, int n)
{
int i, j, k;
/* for each element in the diagonal */
for (k = 0; k < n; ++k) {
uint8_t f;
/* the diagonal element cannot be 0 because */
/* we are inverting matrices with all the square */
/* submatrices not singular */
if (M[k * n + k] == 0)
return -1;
/* make the diagonal element to be 1 */
f = inv(M[k * n + k]);
for (j = 0; j < n; ++j)
M[k * n + j] = mul(f, M[k * n + j]);
/* make all the elements over and under the diagonal */
/* to be zero */
for (i = 0; i < n; ++i) {
if (i == k)
continue;
f = M[i * n + k];
for (j = 0; j < n; ++j)
M[i * n + j] ^= mul(f, M[k * n + j]);
}
}
return 0;
}
#define TEST_REFRESH (4 * 1024 * 1024)
/**
* Precomputed number of square submatrices of size nr.
*
* It's bc(np,nr) * bc(nd,nr)
*
* With 1<=nr<=6 and bc(n, r) == binomial coefficient of (n over r).
*/
long long EXPECTED[RAID_PARITY_MAX] = {
1506LL,
470625LL,
52082500LL,
2421836250LL,
47855484300LL,
327012476050LL
};
static __always_inline int test_sub_matrix(int nr, long long *total)
{
uint8_t M[RAID_PARITY_MAX * RAID_PARITY_MAX];
int np = RAID_PARITY_MAX;
int nd = RAID_DATA_MAX;
int ip[RAID_PARITY_MAX];
int id[RAID_DATA_MAX];
long long count;
long long expected;
printf("\n%ux%u\n", nr, nr);
count = 0;
expected = EXPECTED[nr - 1];
/* all combinations (nr of nd) disks */
combination_first(nr, nd, id);
do {
/* all combinations (nr of np) parities */
combination_first(nr, np, ip);
do {
int i, j;
/* setup the submatrix */
for (i = 0; i < nr; ++i)
for (j = 0; j < nr; ++j)
M[i * nr + j] = gfgen[ip[i]][id[j]];
/* invert */
if (raid_invert_fast(M, nr) != 0)
return -1;
if (++count % TEST_REFRESH == 0) {
printf("\r%.3f %%", count * (double)100 / expected);
fflush(stdout);
}
} while (combination_next(nr, np, ip));
} while (combination_next(nr, nd, id));
if (count != expected)
return -1;
printf("\rTested %" PRIi64 " matrix\n", count);
*total += count;
return 0;
}
int test_all_sub_matrix(void)
{
long long total;
printf("Invert all square submatrices of the %dx%d Cauchy matrix\n",
RAID_PARITY_MAX, RAID_DATA_MAX);
printf("\nPlease wait about 2 days...\n");
total = 0;
/* force inlining of everything */
if (test_sub_matrix(1, &total) != 0)
return -1;
if (test_sub_matrix(2, &total) != 0)
return -1;
if (test_sub_matrix(3, &total) != 0)
return -1;
if (test_sub_matrix(4, &total) != 0)
return -1;
if (test_sub_matrix(5, &total) != 0)
return -1;
if (test_sub_matrix(6, &total) != 0)
return -1;
printf("\nTested in total %" PRIi64 " matrix\n", total);
return 0;
}
int main(void)
{
printf("Matrix inversion test for the RAID Cauchy library\n\n");
/* required to set the gfgen table */
raid_init();
if (test_all_sub_matrix() != 0) {
printf("FAILED!\n");
exit(EXIT_FAILURE);
}
printf("OK\n");
return 0;
}

40
raid/test/selftest.c Normal file
View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2013 Andrea Mazzoleni
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/* Self sanity test for the RAID library */
#include "internal.h"
#include "cpu.h"
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
printf("Self sanity test for the RAID Cauchy library\n\n");
raid_init();
printf("Self test...\n");
if (raid_selftest() != 0) {
/* LCOV_EXCL_START */
printf("FAILED!\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
printf("OK\n\n");
return 0;
}

851
raid/test/speedtest.c Normal file
View File

@@ -0,0 +1,851 @@
/*
* Copyright (C) 2013 Andrea Mazzoleni
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/* Speed test for the RAID library */
#include "internal.h"
#include "memory.h"
#include "cpu.h"
#include <sys/time.h>
#include <stdio.h>
#include <inttypes.h>
/*
* Size of the blocks to test.
*/
#define TEST_SIZE (256 * 1024)
/*
* Number of data blocks to test.
*/
#define TEST_COUNT (8)
/**
* Differential us of two timeval.
*/
static int64_t diffgettimeofday(struct timeval *start, struct timeval *stop)
{
int64_t d;
d = 1000000LL * (stop->tv_sec - start->tv_sec);
d += stop->tv_usec - start->tv_usec;
return d;
}
/**
* Test period.
*/
#ifdef COVERAGE
#define TEST_PERIOD 100000LL
#define TEST_DELTA 1
#else
#define TEST_PERIOD 1000000LL
#define TEST_DELTA 10
#endif
/**
* Start time measurement.
*/
#define SPEED_START \
count = 0; \
gettimeofday(&start, 0); \
do { \
for (i = 0; i < delta; ++i)
/**
* Stop time measurement.
*/
#define SPEED_STOP \
count += delta; \
gettimeofday(&stop, 0); \
} while (diffgettimeofday(&start, &stop) < TEST_PERIOD); \
ds = size * (int64_t)count * nd; \
dt = diffgettimeofday(&start, &stop);
void speed(void)
{
struct timeval start;
struct timeval stop;
int64_t ds;
int64_t dt;
int i, j;
int id[RAID_PARITY_MAX];
int ip[RAID_PARITY_MAX];
int count;
int delta = TEST_DELTA;
int size = TEST_SIZE;
int nd = TEST_COUNT;
int nv;
void *v_alloc;
void **v;
nv = nd + RAID_PARITY_MAX + 1;
v = raid_malloc_vector(nd, nv, size, &v_alloc);
/* initialize disks with fixed data */
for (i = 0; i < nd; ++i)
memset(v[i], i, size);
/* zero buffer */
memset(v[nd + RAID_PARITY_MAX], 0, size);
raid_zero(v[nd + RAID_PARITY_MAX]);
/* basic disks and parity mapping */
for (i = 0; i < RAID_PARITY_MAX; ++i) {
id[i] = i;
ip[i] = i;
}
printf("Speed test using %u data buffers of %u bytes, for a total of %u KiB.\n", nd, size, nd * size / 1024);
printf("Memory blocks have a displacement of %u bytes to improve cache performance.\n", RAID_MALLOC_DISPLACEMENT);
printf("The reported values are the aggregate bandwidth of all data blocks in MiB/s,\n");
printf("not counting parity blocks.\n");
printf("\n");
printf("Memory write speed using the C memset() function:\n");
printf("%8s", "memset");
fflush(stdout);
SPEED_START {
for (j = 0; j < nd; ++j)
memset(v[j], j, size);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
printf("\n");
printf("\n");
/* RAID table */
printf("RAID functions used for computing the parity:\n");
printf("%8s", "");
printf("%8s", "best");
printf("%8s", "int8");
printf("%8s", "int32");
printf("%8s", "int64");
#ifdef CONFIG_X86
printf("%8s", "sse2");
#ifdef CONFIG_X86_64
printf("%8s", "sse2e");
#endif
printf("%8s", "ssse3");
#ifdef CONFIG_X86_64
printf("%8s", "ssse3e");
#endif
printf("%8s", "avx2");
#ifdef CONFIG_X86_64
printf("%8s", "avx2e");
#endif
#endif
printf("\n");
/* GEN1 */
printf("%8s", "gen1");
printf("%8s", raid_gen1_tag());
fflush(stdout);
printf("%8s", "");
SPEED_START {
raid_gen1_int32(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
SPEED_START {
raid_gen1_int64(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#ifdef CONFIG_X86
#ifdef CONFIG_SSE2
if (raid_cpu_has_sse2()) {
SPEED_START {
raid_gen1_sse2(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#ifdef CONFIG_X86_64
printf("%8s", "");
#endif
printf("%8s", "");
#ifdef CONFIG_X86_64
printf("%8s", "");
#endif
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
raid_gen1_avx2(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#endif
printf("\n");
/* GEN2 */
printf("%8s", "gen2");
printf("%8s", raid_gen2_tag());
fflush(stdout);
printf("%8s", "");
SPEED_START {
raid_gen2_int32(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
SPEED_START {
raid_gen2_int64(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#ifdef CONFIG_X86
#ifdef CONFIG_SSE2
if (raid_cpu_has_sse2()) {
SPEED_START {
raid_gen2_sse2(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#ifdef CONFIG_X86_64
SPEED_START {
raid_gen2_sse2ext(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#endif
}
#endif
printf("%8s", "");
#ifdef CONFIG_X86_64
printf("%8s", "");
#endif
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
raid_gen2_avx2(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#endif
printf("\n");
/* GENz */
printf("%8s", "genz");
printf("%8s", raid_genz_tag());
fflush(stdout);
printf("%8s", "");
SPEED_START {
raid_genz_int32(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
SPEED_START {
raid_genz_int64(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#ifdef CONFIG_X86
#ifdef CONFIG_SSE2
if (raid_cpu_has_sse2()) {
SPEED_START {
raid_genz_sse2(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#ifdef CONFIG_X86_64
SPEED_START {
raid_genz_sse2ext(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#endif
}
#endif
printf("%8s", "");
#ifdef CONFIG_X86_64
printf("%8s", "");
#endif
printf("%8s", "");
#ifdef CONFIG_X86_64
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
raid_genz_avx2ext(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#endif
#endif
printf("\n");
/* GEN3 */
printf("%8s", "gen3");
printf("%8s", raid_gen3_tag());
fflush(stdout);
SPEED_START {
raid_gen3_int8(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
printf("%8s", "");
printf("%8s", "");
#ifdef CONFIG_X86
if (raid_cpu_has_sse2()) {
printf("%8s", "");
#ifdef CONFIG_X86_64
printf("%8s", "");
#endif
}
#endif
#ifdef CONFIG_X86
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
raid_gen3_ssse3(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#ifdef CONFIG_X86_64
SPEED_START {
raid_gen3_ssse3ext(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#endif
}
#endif
printf("%8s", "");
#ifdef CONFIG_X86_64
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
raid_gen3_avx2ext(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#endif
#endif
printf("\n");
/* GEN4 */
printf("%8s", "gen4");
printf("%8s", raid_gen4_tag());
fflush(stdout);
SPEED_START {
raid_gen4_int8(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
printf("%8s", "");
printf("%8s", "");
#ifdef CONFIG_X86
#ifdef CONFIG_SSE2
if (raid_cpu_has_sse2()) {
printf("%8s", "");
#ifdef CONFIG_X86_64
printf("%8s", "");
#endif
}
#endif
#endif
#ifdef CONFIG_X86
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
raid_gen4_ssse3(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#ifdef CONFIG_X86_64
SPEED_START {
raid_gen4_ssse3ext(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#endif
}
#endif
printf("%8s", "");
#ifdef CONFIG_X86_64
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
raid_gen4_avx2ext(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#endif
#endif
printf("\n");
/* GEN5 */
printf("%8s", "gen5");
printf("%8s", raid_gen5_tag());
fflush(stdout);
SPEED_START {
raid_gen5_int8(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
printf("%8s", "");
printf("%8s", "");
#ifdef CONFIG_X86
#ifdef CONFIG_SSE2
if (raid_cpu_has_sse2()) {
printf("%8s", "");
#ifdef CONFIG_X86_64
printf("%8s", "");
#endif
}
#endif
#endif
#ifdef CONFIG_X86
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
raid_gen5_ssse3(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#ifdef CONFIG_X86_64
SPEED_START {
raid_gen5_ssse3ext(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#endif
}
#endif
printf("%8s", "");
#ifdef CONFIG_X86_64
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
raid_gen5_avx2ext(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#endif
#endif
printf("\n");
/* GEN6 */
printf("%8s", "gen6");
printf("%8s", raid_gen6_tag());
fflush(stdout);
SPEED_START {
raid_gen6_int8(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
printf("%8s", "");
printf("%8s", "");
#ifdef CONFIG_X86
#ifdef CONFIG_SSE2
if (raid_cpu_has_sse2()) {
printf("%8s", "");
#ifdef CONFIG_X86_64
printf("%8s", "");
#endif
}
#endif
#endif
#ifdef CONFIG_X86
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
raid_gen6_ssse3(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#ifdef CONFIG_X86_64
SPEED_START {
raid_gen6_ssse3ext(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#endif
}
#endif
printf("%8s", "");
#ifdef CONFIG_X86_64
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
raid_gen6_avx2ext(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#endif
#endif
printf("\n");
printf("\n");
/* recover table */
printf("RAID functions used for recovering:\n");
printf("%8s", "");
printf("%8s", "best");
printf("%8s", "int8");
#ifdef CONFIG_X86
printf("%8s", "ssse3");
printf("%8s", "avx2");
#endif
printf("\n");
printf("%8s", "rec1");
printf("%8s", raid_rec1_tag());
fflush(stdout);
SPEED_START {
for (j = 0; j < nd; ++j)
/* +1 to avoid GEN1 optimized case */
raid_rec1_int8(1, id, ip + 1, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#ifdef CONFIG_X86
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
for (j = 0; j < nd; ++j)
/* +1 to avoid GEN1 optimized case */
raid_rec1_ssse3(1, id, ip + 1, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
}
#endif
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
for (j = 0; j < nd; ++j)
/* +1 to avoid GEN1 optimized case */
raid_rec1_avx2(1, id, ip + 1, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
}
#endif
#endif
printf("\n");
printf("%8s", "rec2");
printf("%8s", raid_rec2_tag());
fflush(stdout);
SPEED_START {
for (j = 0; j < nd; ++j)
/* +1 to avoid GEN2 optimized case */
raid_rec2_int8(2, id, ip + 1, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#ifdef CONFIG_X86
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
for (j = 0; j < nd; ++j)
/* +1 to avoid GEN2 optimized case */
raid_rec2_ssse3(2, id, ip + 1, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
}
#endif
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
for (j = 0; j < nd; ++j)
/* +1 to avoid GEN1 optimized case */
raid_rec2_avx2(2, id, ip + 1, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
}
#endif
#endif
printf("\n");
printf("%8s", "rec3");
printf("%8s", raid_recX_tag());
fflush(stdout);
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_int8(3, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#ifdef CONFIG_X86
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_ssse3(3, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
}
#endif
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_avx2(3, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
}
#endif
#endif
printf("\n");
printf("%8s", "rec4");
printf("%8s", raid_recX_tag());
fflush(stdout);
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_int8(4, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#ifdef CONFIG_X86
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_ssse3(4, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
}
#endif
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_avx2(4, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
}
#endif
#endif
printf("\n");
printf("%8s", "rec5");
printf("%8s", raid_recX_tag());
fflush(stdout);
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_int8(5, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#ifdef CONFIG_X86
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_ssse3(5, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
}
#endif
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_avx2(5, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
}
#endif
#endif
printf("\n");
printf("%8s", "rec6");
printf("%8s", raid_recX_tag());
fflush(stdout);
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_int8(6, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
#ifdef CONFIG_X86
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_ssse3(6, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
}
#endif
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_avx2(6, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
}
#endif
#endif
printf("\n");
printf("\n");
free(v_alloc);
free(v);
}
int main(void)
{
printf("Speed test for the RAID Cauchy library\n\n");
raid_init();
#ifdef CONFIG_X86
if (raid_cpu_has_sse2())
printf("Including x86 SSE2 functions\n");
if (raid_cpu_has_ssse3())
printf("Including x86 SSSE3 functions\n");
if (raid_cpu_has_avx2())
printf("Including x86 AVX2 functions\n");
#endif
#ifdef CONFIG_X86_64
printf("Including x64 extended SSE register set\n");
#endif
printf("\nPlease wait about 30 seconds...\n\n");
speed();
return 0;
}