-
Notifications
You must be signed in to change notification settings - Fork 0
/
pmemkv-bench_spp.patch_O1
59 lines (53 loc) · 2.73 KB
/
pmemkv-bench_spp.patch_O1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
diff --git a/Makefile b/Makefile
index 0d934da..fceefbc 100644
--- a/Makefile
+++ b/Makefile
@@ -3,19 +3,50 @@
.ONESHELL:
-bench: CFLAGS = $(shell pkg-config --cflags libpmemkv libpmempool) -DOS_LINUX -fno-builtin-memcmp -march=native -DNDEBUG -O2 -std=c++11
-bench: LDFLAGS = -ldl -lpthread $(shell pkg-config --libs libpmemkv libpmempool)
+bench: CFLAGS = $(shell pkg-config --cflags libpmem libpmemobj libpmemobj++ libpmemkv libpmempool) -DOS_LINUX -fno-builtin-memcmp -march=native -DNDEBUG -std=c++11
+bench: LDFLAGS = -ldl -lpthread $(shell pkg-config --libs libpmem libpmemobj libpmempool)
CPP_FILES = $(shell find . -iname "*.h" -o -iname "*.cc" -o -iname "*.cpp" -o -iname "*.hpp")
PYTHON_FILES = $(shell find . -iname "*.py")
KV_BENCH_TEST_PATH ?= /dev/shm/pmemkv
+SPPROOT:=/SPP
+SPPLIB:=$(SPPROOT)/runtime
+SPPLIBSRC:=$(SPPLIB)/src
+SPPLIBOBJ:=$(SPPLIB)/obj
+
+WRAP_LIST:=-Wl,-wrap,free -Wl,-wrap,strcpy -Wl,-wrap,strcmp \
+ -Wl,-wrap,strncpy -Wl,-wrap,strncmp -Wl,-wrap,memcmp \
+ -Wl,-wrap,memchr -Wl,-wrap,strchr -Wl,-wrap,strncat \
+ -Wl,-wrap,strtol -Wl,-wrap,strlen -Wl,-wrap,strchrnul \
+ -Wl,-wrap,strcat -Wl,-wrap,snprintf \
+ -Wl,-wrap,memcpy -Wl,-wrap,memset -Wl,-wrap,memmove \
+ -Wl,-wrap,pmem_memmove_persist -Wl,-wrap,pmem_memcpy_persist \
+ -Wl,-wrap,pmem_memmove_nodrain -Wl,-wrap,pmem_memcpy_nodrain \
+ -Wl,-wrap,pmem_memmove -Wl,-wrap,pmem_memcpy \
+ -Wl,-wrap,pmem_memset_nodrain -Wl,-wrap,pmem_memset \
+ -Wl,-wrap,pmem_memset_persist -Wl,-wrap,pmemobj_memcpy \
+ -Wl,-wrap,pmemobj_memcpy_persist -Wl,-wrap,pmemobj_memmove \
+ -Wl,-wrap,pmemobj_memset -Wl,-wrap,pmemobj_memset_persist
+OPT_LEVEL:=-O1
+FORTIFY:=-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
+
+CXXFLAGS += -flto $(OPT_LEVEL) $(FORTIFY)
+PROGFLAGS := $(CXXFLAGS)
+CXXFLAGS += -Xclang -load -Xclang /llvm/lib/LLVMSPP.so
+BUILD_EXEC_FLAGS := $(WRAP_LIST) $(SPPLIBOBJ)/wrappers_spp.o -Xlinker ${SPPLIBOBJ}/spp.o
+
+INCS += -I$(SPPLIBSRC)/spp.h
+LDFLAGS += -fuse-ld=gold
+
+PMEMKV_LIB := /usr/local/lib/libpmemkv.a
+
.PHONY: cppformat $(CPP_FILES) pythonformat $(PYTHON_FILES)
bench: reset
- g++ ./bench/db_bench.cc ./bench/port/port_posix.cc ./bench/util/env.cc ./bench/util/env_posix.cc \
+ clang++ ./bench/db_bench.cc ./bench/port/port_posix.cc ./bench/util/env.cc ./bench/util/env_posix.cc \
./bench/util/histogram.cc ./bench/util/logging.cc ./bench/util/status.cc ./bench/util/testutil.cc \
- -o pmemkv_bench -I./bench/include -I./bench -I./bench/util $(CFLAGS) $(LDFLAGS)
+ -o pmemkv_bench -I./bench/include -I./bench -I./bench/util $(CFLAGS) $(INCS) $(CXXFLAGS) $(BUILD_EXEC_FLAGS) -fuse-ld=gold $(PMEMKV_LIB) $(LDFLAGS)
reset:
rm -rf $(KV_BENCH_TEST_PATH)