mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Adds the speed test for CRC.
This commit is contained in:
parent
9324933be0
commit
28bdd0f7b7
3 changed files with 23 additions and 2 deletions
19
speed.c
19
speed.c
|
|
@ -161,6 +161,25 @@ void speed(void)
|
|||
|
||||
printf("memset0 %"PRIu64" [MB/s]\n", ds / dt);
|
||||
|
||||
SPEED_START {
|
||||
for(j=0;j<diskmax;++j) {
|
||||
crc32c_gen(0, buffer[j], block_size);
|
||||
}
|
||||
} SPEED_STOP
|
||||
|
||||
printf("CRC table %"PRIu64" [MB/s]\n", ds / dt);
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
if (cpu_has_sse42()) {
|
||||
SPEED_START {
|
||||
for(j=0;j<diskmax;++j) {
|
||||
crc32c_x86(0, buffer[j], block_size);
|
||||
}
|
||||
} SPEED_STOP
|
||||
|
||||
printf("CRC intel-crc32l %"PRIu64" [MB/s]\n", ds / dt);
|
||||
}
|
||||
#endif
|
||||
SPEED_START {
|
||||
for(j=0;j<diskmax;++j) {
|
||||
memhash(HASH_MURMUR3, seed, digest, buffer[j], block_size);
|
||||
|
|
|
|||
4
util.c
4
util.c
|
|
@ -1067,7 +1067,7 @@ static uint32_t CRC32C_3[256] = {
|
|||
*/
|
||||
#define CRC_IV 0xffffffffU
|
||||
|
||||
static uint32_t crc32c_gen(uint32_t crc, const unsigned char* ptr, unsigned size)
|
||||
uint32_t crc32c_gen(uint32_t crc, const unsigned char* ptr, unsigned size)
|
||||
{
|
||||
crc ^= CRC_IV;
|
||||
|
||||
|
|
@ -1091,7 +1091,7 @@ static uint32_t crc32c_gen(uint32_t crc, const unsigned char* ptr, unsigned size
|
|||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
|
||||
static uint32_t crc32c_x86(uint32_t crc, const unsigned char* ptr, unsigned size)
|
||||
uint32_t crc32c_x86(uint32_t crc, const unsigned char* ptr, unsigned size)
|
||||
{
|
||||
crc ^= CRC_IV;
|
||||
|
||||
|
|
|
|||
2
util.h
2
util.h
|
|
@ -500,6 +500,8 @@ void randomize(void* ptr, unsigned size);
|
|||
* Computes the CRC-32 (Castagnoli)
|
||||
*/
|
||||
uint32_t (*crc32c)(uint32_t crc, const unsigned char* ptr, unsigned size);
|
||||
uint32_t crc32c_gen(uint32_t crc, const unsigned char* ptr, unsigned size);
|
||||
uint32_t crc32c_x86(uint32_t crc, const unsigned char* ptr, unsigned size);
|
||||
|
||||
/**
|
||||
* Initializes the CRC-32 (Castagnoli) support.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue