|
|
|
@ -23,6 +23,9 @@ |
|
|
|
|
#include <mach/mach_host.h> |
|
|
|
|
#include <sys/sysctl.h> |
|
|
|
|
#endif |
|
|
|
|
#ifdef __FreeBSD__ |
|
|
|
|
#include <sys/sysctl.h> |
|
|
|
|
#endif |
|
|
|
|
#include <atomic> |
|
|
|
|
#include <cinttypes> |
|
|
|
|
#include <condition_variable> |
|
|
|
@ -2638,7 +2641,7 @@ class Benchmark { |
|
|
|
|
fprintf(stderr, "RocksDB: version %d.%d\n", |
|
|
|
|
kMajorVersion, kMinorVersion); |
|
|
|
|
|
|
|
|
|
#if defined(__linux) || defined(__APPLE__) |
|
|
|
|
#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__) |
|
|
|
|
time_t now = time(nullptr); |
|
|
|
|
char buf[52]; |
|
|
|
|
// Lint complains about ctime() usage, so replace it with ctime_r(). The
|
|
|
|
@ -2696,6 +2699,19 @@ class Benchmark { |
|
|
|
|
fprintf(stderr, "CPU: %d * %s\n", h.max_cpus, cpu_type.c_str()); |
|
|
|
|
fprintf(stderr, "CPUCache: %s\n", cache_size.c_str()); |
|
|
|
|
} |
|
|
|
|
#elif defined(__FreeBSD__) |
|
|
|
|
int ncpus; |
|
|
|
|
size_t len = sizeof(ncpus); |
|
|
|
|
int mib[2] = {CTL_HW, HW_NCPU}; |
|
|
|
|
if (sysctl(mib, 2, &ncpus, &len, nullptr, 0) == 0) { |
|
|
|
|
char cpu_type[16]; |
|
|
|
|
len = sizeof(cpu_type) - 1; |
|
|
|
|
mib[1] = HW_MACHINE; |
|
|
|
|
if (sysctl(mib, 2, cpu_type, &len, nullptr, 0) == 0) cpu_type[len] = 0; |
|
|
|
|
|
|
|
|
|
fprintf(stderr, "CPU: %d * %s\n", ncpus, cpu_type); |
|
|
|
|
// no programmatic way to get the cache line size except on PPC
|
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|