star-sim

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

commit fe5672b1fd1af1cdda3aa3589fd9f6536724a217
parent 8193d7e2a3f25831bc1019e1c2a6c4538bc644f9
Author: amin <dev@aminmesbah.com>
Date:   Mon, 10 Jul 2017 04:52:31 +0000

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.

FossilOrigin-Name: ff0e452e4126164fc24a5cc17838a0d2f2ff2278edcbab6d63920575953e0fb4
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)