star-sim

Barnes-Hut gravity simulation.
Log | Files | Refs | README | LICENSE

commit 1ae1dada667694336a99d8df8197375e0dc16407
parent 9d6fe90593a5bdf5388cb602f2e88272e81e845f
Author: Amin Mesbah <mesbahamin@gmail.com>
Date:   Sun, 15 Oct 2017 16:16:02 -0700

Don't use gprof for profiling

- It hasn't worked for a long time because of this bug [1].
- It can give misleading analysis [2].
- Using the random pause method [3] is what I really want.

[1] https://bugs.launchpad.net/ubuntu/+source/gcc-6/+bug/1678510
[2] https://yosefk.com/blog/how-profilers-lie-the-cases-of-gprof-and-kcachegrind.html
[3] https://stackoverflow.com/a/378024/4721953

Diffstat:
MMakefile | 24++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile @@ -13,35 +13,35 @@ EXE = star-garden DBGDIR = debug DBGEXE = $(DBGDIR)/$(EXE) -DBGCFLAGS = -g -Og -Werror -pg +DBGCFLAGS = -g -Og -Werror RELDIR = release RELEXE = $(RELDIR)/$(EXE) RELCFLAGS = -O2 -Os -.PHONY: all clean debug memcheck prep profile release run todo +.PHONY: all clean compile_debug compile_release debug memcheck prep run todo -all: debug release +all: compile_debug compile_release clean: rm -f $(RELDIR)/* $(DBGDIR)/* -debug: prep +compile_debug: prep $(CC) $(CFLAGS) $(DBGCFLAGS) $(SRC) -o $(DBGEXE) $(LDFLAGS) -memcheck: debug +compile_release: prep + $(CC) $(CFLAGS) $(RELCFLAGS) $(SRC) -o $(RELEXE) $(LDFLAGS) + +debug: compile_debug + gdb $(DBGEXE) + +memcheck: compile_debug valgrind --track-origins=yes ./$(DBGEXE) prep: @mkdir -p $(DBGDIR) $(RELDIR) -profile: run - gprof $(DBGEXE) gmon.out > profile_output - -release: prep - $(CC) $(CFLAGS) $(RELCFLAGS) $(SRC) -o $(RELEXE) $(LDFLAGS) - -run: debug +run: compile_release ./$(DBGEXE) todo: