Build system: switched to valgrind for profiling
This commit is contained in:
parent
f6008b603d
commit
201ac2d401
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,4 +2,4 @@
|
|||||||
first
|
first
|
||||||
*.rom
|
*.rom
|
||||||
make.deps
|
make.deps
|
||||||
gmon.out
|
callgrind.out
|
||||||
|
21
Makefile
21
Makefile
@ -1,5 +1,4 @@
|
|||||||
QUIET=1
|
QUIET=1
|
||||||
PROFILING=1
|
|
||||||
ADDRESS_SANITIZE=1
|
ADDRESS_SANITIZE=1
|
||||||
|
|
||||||
all:first
|
all:first
|
||||||
@ -19,6 +18,7 @@ ifeq "${QUIET}" "1"
|
|||||||
QUIET_LINK = @echo ' LINK '$@;
|
QUIET_LINK = @echo ' LINK '$@;
|
||||||
QUIET_FAS = @echo ' FAS '$@;
|
QUIET_FAS = @echo ' FAS '$@;
|
||||||
QUIET_CLEAN = @echo ' CLEAN .';
|
QUIET_CLEAN = @echo ' CLEAN .';
|
||||||
|
QUIET_VALGRIND = @echo ' VALGRIND '$@;
|
||||||
Q = @
|
Q = @
|
||||||
else
|
else
|
||||||
Q =
|
Q =
|
||||||
@ -26,10 +26,6 @@ endif
|
|||||||
|
|
||||||
CFLAGS::=-O2 $(shell pkg-config ncursesw --cflags)
|
CFLAGS::=-O2 $(shell pkg-config ncursesw --cflags)
|
||||||
|
|
||||||
ifeq "${PROFILING}" "1"
|
|
||||||
CFLAGS += -pg
|
|
||||||
LDFLAGS += -pg
|
|
||||||
endif
|
|
||||||
ifeq "${ADDRESS_SANITIZE}" "1"
|
ifeq "${ADDRESS_SANITIZE}" "1"
|
||||||
CFLAGS += -fsanitize=address -ggdb
|
CFLAGS += -fsanitize=address -ggdb
|
||||||
LDFLAGS += -fsanitize=address -fsanitize=undefined -fsanitize=leak
|
LDFLAGS += -fsanitize=address -fsanitize=undefined -fsanitize=leak
|
||||||
@ -52,7 +48,20 @@ gprof:
|
|||||||
${QUIET_CC}
|
${QUIET_CC}
|
||||||
${Q}gcc -c $< -Wall -Wextra -Werror ${CFLAGS}
|
${Q}gcc -c $< -Wall -Wextra -Werror ${CFLAGS}
|
||||||
|
|
||||||
|
callgrind.out:first ${MAIN_ROM}
|
||||||
|
${QUIET_VALGRIND}
|
||||||
|
${Q}if ldd first |grep asan > /dev/null;\
|
||||||
|
then\
|
||||||
|
echo ERROR: Binary build with libasan, please rebuild without address sanitiser;\
|
||||||
|
else\
|
||||||
|
valgrind --tool=callgrind --dump-instr=yes --simulate-cache=yes --collect-jumps=yes --callgrind-out-file=callgrind.out ./first -i programs/3d_renderer.rom;\
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
profile: callgrind.out
|
||||||
|
kcachegrind $<
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
${QUIET_CLEAN}
|
${QUIET_CLEAN}
|
||||||
${Q} rm -f ${OBJECT_FILES} first ${ROMS} gmon.out
|
${Q} rm -f ${OBJECT_FILES} first ${ROMS} callgrind.out
|
||||||
|
Loading…
Reference in New Issue
Block a user