star-sim

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

commit ea77610582e13cfc663faab184bc40bc12fe4292
parent 20e5577ee6e1fdba329b254c6085de10f1dfdb60
Author: Amin Mesbah <mesbahamin@gmail.com>
Date:   Sun,  9 Jul 2017 21:52:32 -0700

Use gprof for performance profiling.

The debug version is now compiled with the `-pg` tag, which enables
profiling with gprof. `make profile` compiles the program, runs it, and
generates a file with detailed profiling information.

Diffstat:
M.gitignore | 5++++-
MMakefile | 7+++++--
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,3 +1,6 @@ -*.swp +profile_output debug/* release/* +*.out +*.png +*.swp diff --git a/Makefile b/Makefile @@ -12,13 +12,13 @@ EXE = star-garden DBGDIR = debug DBGEXE = $(DBGDIR)/$(EXE) -DBGCFLAGS = -g -Og -Werror +DBGCFLAGS = -g -Og -Werror -pg RELDIR = release RELEXE = $(RELDIR)/$(EXE) RELCFLAGS = -O2 -Os -.PHONY: all clean debug memcheck prep release run +.PHONY: all clean debug memcheck prep profile release run all: debug release @@ -34,6 +34,9 @@ memcheck: debug prep: @mkdir -p $(DBGDIR) $(RELDIR) +profile: run + gprof $(DBGEXE) gmon.out > profile_output + release: prep $(CC) $(CFLAGS) $(RELCFLAGS) $(SRC) -o $(RELEXE) $(LDFLAGS)