star-sim

Barnes-Hut gravity simulation.
git clone git://git.amin.space/star-sim.git
Log | Files | Refs | README | LICENSE

commit 240b80eba99a243b4b81043f7c810053bb39c0d0
parent 2028f83376bfce61fd82487d2e8b924eeea3d662
Author: amin <dev@aminmesbah.com>
Date:   Sun, 15 Oct 2017 23:16:01 +0000

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

FossilOrigin-Name: af57354dc69ee9763294662931734894519cc6198bbb2a8de18d9c4caef979fa
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: