Added helper script for profile-guided optimization (PGO).
This commit is contained in:
parent
6c26203c30
commit
37b6c40278
16
Makefile
16
Makefile
@ -3,8 +3,9 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
DEBUG ?= 0
|
||||
ASAN ?= 0
|
||||
STATIC ?= 0
|
||||
|
||||
FPGO ?= 0
|
||||
MARCH ?= native
|
||||
MTUNE ?= native
|
||||
|
||||
@ -25,12 +26,20 @@ ifeq ($(DEBUG),1)
|
||||
CONFIG := _g
|
||||
CFLAGS += -Og -g
|
||||
LDFLGS :=
|
||||
else ifeq ($(ASAN),1)
|
||||
CONFIG := _a
|
||||
CFLAGS += -O1 -g -fsanitize=address -fno-omit-frame-pointer
|
||||
LDFLGS :=
|
||||
else
|
||||
CONFIG :=
|
||||
CFLAGS += -O3 -DNDEBUG
|
||||
LDFLGS := -s
|
||||
endif
|
||||
|
||||
ifneq ($(FPGO),0)
|
||||
CFLAGS += -fprofile-$(FPGO)
|
||||
endif
|
||||
|
||||
MACHINE := $(shell $(CC) -dumpmachine)
|
||||
|
||||
ifneq ($(filter %mingw32 %-windows-gnu %-cygwin %-cygnus,$(MACHINE)),)
|
||||
@ -101,5 +110,6 @@ $(SUBDIR_LIB)/obj/%$(CONFIG).o: $(SUBDIR_LIB)/src/%.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
$(RM) $(SUBDIR_APP)/obj/*.o $(SUBDIR_APP)/lib/*.a $(SUBDIR_APP)/bin/*$(SUFFIX)
|
||||
$(RM) $(SUBDIR_LIB)/obj/*.o $(SUBDIR_LIB)/lib/*.a $(SUBDIR_LIB)/bin/*$(SUFFIX)
|
||||
$(RM) $(SUBDIR_APP)/obj/*.o $(SUBDIR_APP)/obj/*.gcda $(SUBDIR_APP)/lib/*.a $(SUBDIR_APP)/bin/*$(SUFFIX)
|
||||
$(RM) $(SUBDIR_LIB)/obj/*.o $(SUBDIR_LIB)/obj/*.gcda $(SUBDIR_LIB)/lib/*.a $(SUBDIR_LIB)/bin/*$(SUFFIX)
|
||||
|
||||
|
27
mk-profiled.sh
Executable file
27
mk-profiled.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
readonly PLATFORM="$(uname -a)"
|
||||
unset SUFFIX
|
||||
if [[ "${PLATFORM}" == MINGW* || "${PLATFORM}" == CYGWIN* ]]; then
|
||||
SUFFIX=".exe"
|
||||
fi
|
||||
|
||||
echo -e "\n------------------------------------------------------------------------------"
|
||||
echo -e "Instrument"
|
||||
echo -e "------------------------------------------------------------------------------\n"
|
||||
|
||||
make clean
|
||||
make FPGO=generate -B "$@"
|
||||
|
||||
echo -e "\n------------------------------------------------------------------------------"
|
||||
echo -e "Profiling"
|
||||
echo -e "------------------------------------------------------------------------------\n"
|
||||
|
||||
./frontend/bin/slunkcrypt${SUFFIX} -t
|
||||
|
||||
echo -e "\n------------------------------------------------------------------------------"
|
||||
echo -e "Re-compile"
|
||||
echo -e "------------------------------------------------------------------------------\n"
|
||||
|
||||
make FPGO=use -B "$@"
|
Loading…
Reference in New Issue
Block a user