btrfs-progs: add SHA256 to hash-speedtest

Sample results, Intel(R) Xeon(R) CPU E5-1620 v3 @ 3.50GHz

Block size: 4096
Iterations: 1000000

    NULL-NOP: cycles:    314296257, c/i      314
 NULL-MEMCPY: cycles:    582807266, c/i      582
      CRC32C: cycles:   1738544130, c/i     1738
      XXHASH: cycles:   1449519934, c/i     1449
      SHA256: cycles: 110648340548, c/i   110648

Note this is unoptimized reference implementation.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2019-10-07 18:23:52 +02:00
parent 2047b6de3d
commit f5e952b13d

View File

@ -1,6 +1,7 @@
#include "../kerncompat.h"
#include "crypto/hash.h"
#include "crypto/crc32c.h"
#include "crypto/sha.h"
#ifndef __x86_64__
#error "Only x86_64 supported"
@ -60,6 +61,7 @@ int main(int argc, char **argv) {
{ .name = "NULL-MEMCPY", .digest = hash_null_memcpy, .digest_size = 32 },
{ .name = "CRC32C", .digest = hash_crc32c, .digest_size = 4 },
{ .name = "XXHASH", .digest = hash_xxhash, .digest_size = 8 },
{ .name = "SHA256", .digest = hash_sha256, .digest_size = 32 },
};
if (argc > 1) {