From aa6509d8e43f3e741d3b3805eb1dce7bbae32c82 Mon Sep 17 00:00:00 2001 From: Guo Xiao Date: Mon, 18 Dec 2017 12:23:40 -0800 Subject: [PATCH] Fix build for linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: * Include `unistd.h` for `sleep(3)` * Include `sys/time.h` for `gettimeofday(3)` * Include `utils/random.h` for `Random64` Error messages: utilities/persistent_cache/hash_table_bench.cc: In constructor ‘rocksdb::HashTableBenchmark::HashTableBenchmark(rocksdb::HashTableImpl >*, size_t, size_t, size_t, size_t)’: utilities/persistent_cache/hash_table_bench.cc:76:28: error: ‘sleep’ was not declared in this scope /* sleep override */ sleep(1); ^~~~~ utilities/persistent_cache/hash_table_bench.cc:76:28: note: suggested alternative: ‘strsep’ /* sleep override */ sleep(1); ^~~~~ strsep utilities/persistent_cache/hash_table_bench.cc: In member function ‘void rocksdb::HashTableBenchmark::RunRead()’: utilities/persistent_cache/hash_table_bench.cc:107:5: error: ‘Random64’ was not declared in this scope Random64 rgen(time(nullptr)); ^~~~~~~~ utilities/persistent_cache/hash_table_bench.cc:107:5: note: suggested alternative: ‘random_r’ Random64 rgen(time(nullptr)); ^~~~~~~~ random_r utilities/persistent_cache/hash_table_bench.cc:110:18: error: ‘rgen’ was not declared in this scope size_t k = rgen.Next() % max_prepop_key; ^~~~ utilities/persistent_cache/hash_table_bench.cc: In static member function ‘static uint64_t rocksdb::HashTableBenchmark::NowInMillSec()’: utilities/persistent_cache/hash_table_bench.cc:153:5: error: ‘gettimeofday’ was not declared in this scope gettimeofday(&tv, /*tz=*/nullptr); ^~~~~~~~~~~~ make[2]: *** [CMakeFiles/hash_table_bench.dir/build.make:63: CMakeFiles/hash_table_bench.dir/utilities/persistent_cache/hash_table_bench.cc.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:3346: CMakeFiles/hash_table_bench.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... Closes https://github.com/facebook/rocksdb/pull/3283 Differential Revision: D6594850 Pulled By: ajkr fbshipit-source-id: fd83957338c210cdfd253763347aafd39476824f --- utilities/persistent_cache/hash_table_bench.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utilities/persistent_cache/hash_table_bench.cc b/utilities/persistent_cache/hash_table_bench.cc index 7505c43c0..7797f458c 100644 --- a/utilities/persistent_cache/hash_table_bench.cc +++ b/utilities/persistent_cache/hash_table_bench.cc @@ -15,11 +15,14 @@ int main() { fprintf(stderr, "Please install gflags to run tools\n"); } #include #include #include +#include +#include #include "port/port_posix.h" #include "rocksdb/env.h" #include "util/gflags_compat.h" #include "util/mutexlock.h" +#include "util/random.h" #include "utilities/persistent_cache/hash_table.h" using std::string;