mirror of
https://github.com/intel/isa-l.git
synced 2025-10-28 19:51:56 +01:00
crc: reformat using new code style
Signed-off-by: Marcel Cornu <marcel.d.cornu@intel.com>
This commit is contained in:
committed by
Pablo de Lara
parent
07bca509e7
commit
671e67b62d
@@ -37,72 +37,73 @@
|
||||
#include "test.h"
|
||||
|
||||
#ifndef GT_L3_CACHE
|
||||
# define GT_L3_CACHE 32*1024*1024 /* some number > last level cache */
|
||||
#define GT_L3_CACHE 32 * 1024 * 1024 /* some number > last level cache */
|
||||
#endif
|
||||
|
||||
#if !defined(COLD_TEST) && !defined(TEST_CUSTOM)
|
||||
// Cached test, loop many times over small dataset
|
||||
# define TEST_LEN 8*1024
|
||||
# define TEST_TYPE_STR "_warm"
|
||||
#elif defined (COLD_TEST)
|
||||
#define TEST_LEN 8 * 1024
|
||||
#define TEST_TYPE_STR "_warm"
|
||||
#elif defined(COLD_TEST)
|
||||
// Uncached test. Pull from large mem base.
|
||||
# define TEST_LEN (2 * GT_L3_CACHE)
|
||||
# define TEST_TYPE_STR "_cold"
|
||||
#define TEST_LEN (2 * GT_L3_CACHE)
|
||||
#define TEST_TYPE_STR "_cold"
|
||||
#endif
|
||||
|
||||
#ifndef TEST_SEED
|
||||
# define TEST_SEED 0x1234
|
||||
#define TEST_SEED 0x1234
|
||||
#endif
|
||||
|
||||
#define TEST_MEM TEST_LEN
|
||||
|
||||
typedef uint64_t(*crc64_func_t) (uint64_t, const uint8_t *, uint64_t);
|
||||
typedef uint64_t (*crc64_func_t)(uint64_t, const uint8_t *, uint64_t);
|
||||
|
||||
typedef struct func_case {
|
||||
char *note;
|
||||
crc64_func_t crc64_func_call;
|
||||
crc64_func_t crc64_ref_call;
|
||||
char *note;
|
||||
crc64_func_t crc64_func_call;
|
||||
crc64_func_t crc64_ref_call;
|
||||
} func_case_t;
|
||||
|
||||
func_case_t test_funcs[] = {
|
||||
{"crc64_ecma_norm", crc64_ecma_norm, crc64_ecma_norm_base},
|
||||
{"crc64_ecma_refl", crc64_ecma_refl, crc64_ecma_refl_base},
|
||||
{"crc64_iso_norm", crc64_iso_norm, crc64_iso_norm_base},
|
||||
{"crc64_iso_refl", crc64_iso_refl, crc64_iso_refl_base},
|
||||
{"crc64_jones_norm", crc64_jones_norm, crc64_jones_norm_base},
|
||||
{"crc64_jones_refl", crc64_jones_refl, crc64_jones_refl_base},
|
||||
{"crc64_rocksoft_norm", crc64_rocksoft_norm, crc64_rocksoft_norm_base},
|
||||
{"crc64_rocksoft_refl", crc64_rocksoft_refl, crc64_rocksoft_refl_base}
|
||||
{ "crc64_ecma_norm", crc64_ecma_norm, crc64_ecma_norm_base },
|
||||
{ "crc64_ecma_refl", crc64_ecma_refl, crc64_ecma_refl_base },
|
||||
{ "crc64_iso_norm", crc64_iso_norm, crc64_iso_norm_base },
|
||||
{ "crc64_iso_refl", crc64_iso_refl, crc64_iso_refl_base },
|
||||
{ "crc64_jones_norm", crc64_jones_norm, crc64_jones_norm_base },
|
||||
{ "crc64_jones_refl", crc64_jones_refl, crc64_jones_refl_base },
|
||||
{ "crc64_rocksoft_norm", crc64_rocksoft_norm, crc64_rocksoft_norm_base },
|
||||
{ "crc64_rocksoft_refl", crc64_rocksoft_refl, crc64_rocksoft_refl_base }
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int j;
|
||||
void *buf;
|
||||
uint64_t crc;
|
||||
struct perf start;
|
||||
func_case_t *test_func;
|
||||
int j;
|
||||
void *buf;
|
||||
uint64_t crc;
|
||||
struct perf start;
|
||||
func_case_t *test_func;
|
||||
|
||||
if (posix_memalign(&buf, 1024, TEST_LEN)) {
|
||||
printf("alloc error: Fail");
|
||||
return -1;
|
||||
}
|
||||
memset(buf, (char)TEST_SEED, TEST_LEN);
|
||||
if (posix_memalign(&buf, 1024, TEST_LEN)) {
|
||||
printf("alloc error: Fail");
|
||||
return -1;
|
||||
}
|
||||
memset(buf, (char) TEST_SEED, TEST_LEN);
|
||||
|
||||
for (j = 0; j < sizeof(test_funcs) / sizeof(test_funcs[0]); j++) {
|
||||
test_func = &test_funcs[j];
|
||||
printf("%s_perf:\n", test_func->note);
|
||||
for (j = 0; j < sizeof(test_funcs) / sizeof(test_funcs[0]); j++) {
|
||||
test_func = &test_funcs[j];
|
||||
printf("%s_perf:\n", test_func->note);
|
||||
|
||||
printf("Start timed tests\n");
|
||||
fflush(0);
|
||||
printf("Start timed tests\n");
|
||||
fflush(0);
|
||||
|
||||
BENCHMARK(&start, BENCHMARK_TIME, crc =
|
||||
test_func->crc64_func_call(TEST_SEED, buf, TEST_LEN));
|
||||
printf("%s" TEST_TYPE_STR ": ", test_func->note);
|
||||
perf_print(start, (long long)TEST_LEN);
|
||||
BENCHMARK(&start, BENCHMARK_TIME,
|
||||
crc = test_func->crc64_func_call(TEST_SEED, buf, TEST_LEN));
|
||||
printf("%s" TEST_TYPE_STR ": ", test_func->note);
|
||||
perf_print(start, (long long) TEST_LEN);
|
||||
|
||||
printf("finish 0x%" PRIx64 "\n", crc);
|
||||
}
|
||||
printf("finish 0x%" PRIx64 "\n", crc);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user