mirror of
https://github.com/ceph/ceph
synced 2026-08-01 22:45:39 +00:00
Merge pull request #68209 from sunyuechi/riscv-bench-crc
test/common: add RISC-V CRC32C performance benchmark to unittest_crc32c Reviewed-by: Kefu Chai <k.chai@proxmox.com>
This commit is contained in:
commit
6f4345554d
@ -10,6 +10,8 @@
|
||||
#define CEPH_COMMON_CRC32C_RISCV_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "acconfig.h"
|
||||
#include "arch/riscv.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include "common/sctp_crc32.h"
|
||||
#include "common/crc32c_intel_baseline.h"
|
||||
#include "common/crc32c_aarch64.h"
|
||||
#include "common/crc32c_riscv.h"
|
||||
|
||||
TEST(Crc32c, Small) {
|
||||
const char *a = "foo bar baz";
|
||||
@ -94,6 +95,17 @@ TEST(Crc32c, Performance) {
|
||||
std::cout << "aarch64 = " << rate << " MB/sec" << std::endl;
|
||||
ASSERT_EQ(261108528u, val);
|
||||
}
|
||||
#endif
|
||||
#if defined(__riscv) && defined(HAVE_RISCV_ZVBC)
|
||||
if (ceph_arch_riscv_zbc && ceph_arch_riscv_zvbc)
|
||||
{
|
||||
utime_t start = ceph_clock_now();
|
||||
unsigned val = ceph_crc32c_riscv(0, (unsigned char *)a, len);
|
||||
utime_t end = ceph_clock_now();
|
||||
float rate = (float)len / (float)(1024*1024) / (float)(end - start);
|
||||
std::cout << "riscv = " << rate << " MB/sec" << std::endl;
|
||||
ASSERT_EQ(261108528u, val);
|
||||
}
|
||||
#endif
|
||||
free(a);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user