Skip to content

Commit

Permalink
makefile updates and got profiling working again
Browse files Browse the repository at this point in the history
  • Loading branch information
reginaldford committed Nov 24, 2024
1 parent 71eab1b commit bc40b7c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CC_DEBUG := clang
CC_PROF := clang
CC_UNIFIED := zig cc
CFLAGS_UNIFIED := -Oz -static
CFLAGS := -Ofast -Wall
CFLAGS := -Ofast
CFLAGS_DEBUG := -g
CFLAGS_PROF := -fprofile-instr-generate -fcoverage-mapping
LDFLAGS := -lm -flto
Expand Down Expand Up @@ -139,7 +139,7 @@ prof:
$(MAKE) -j$(THREADS) bin/$(BIN_NAME_PROF)

bin/$(BIN_NAME_PROF): $(OBJS_PARSER_PROF) $(OBJS_BASE_PROF) $(BUILD_DIR)/$(SRC_MAIN)/sm_main.c.prof.o
$(CC_PROF) $(CFLAGS_PROF) -lm $(OBJS_PARSER_PROF) $(OBJS_BASE_PROF) $(BUILD_DIR)/$(SRC_MAIN)/sm_main.c.prof.o -o $@
$(CC_PROF) $(CFLAGS_PROF) $(OBJS_PARSER_PROF) $(OBJS_BASE_PROF) $(BUILD_DIR)/$(SRC_MAIN)/sm_main.c.prof.o -o $@ $(LDFLAGS)

# Run the unit tests
check: dev
Expand Down
14 changes: 7 additions & 7 deletions scripts/profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# openbsd uses gmake
MAKE=make
# 1400 seems just enough for non-memoized recursive fib 27
MEM_MB=1400
MEM_MB=1

# Provide an SMS file name as the argument
if [ $# -eq 0 ]; then
Expand All @@ -20,13 +20,13 @@ cd scripts &&

# You may need to adjust the memory usage:
../bin/sms_prof -m1400 -s $1
llvm-profdata merge -o default.profdata default.profraw &&
llvm-profdata-18 merge -o default.profdata-18 default.profraw &&

mkdir -p prof_results

llvm-cov show ../bin/sms_prof -instr-profile=default.profdata > prof_results/coverage_count.dat
llvm-profdata show default.profdata > prof_results/summary.dat
llvm-profdata show --all-functions default.profdata > prof_results/thorough.dat
llvm-profdata show --topn=40 default.profdata > prof_results/top_40.dat
mv *.profdata *.profraw ../scripts/prof_results
llvm-cov-18 show ../bin/sms_prof -instr-profile=default.profdata-18 > prof_results/coverage_count.dat
llvm-profdata-18 show default.profdata-18 > prof_results/summary.dat
llvm-profdata-18 show --all-functions default.profdata-18 > prof_results/thorough.dat
llvm-profdata-18 show --topn=40 default.profdata-18 > prof_results/top_40.dat
mv *.profdata-18 *.profraw ../scripts/prof_results
grep -v "| " -C1 ../scripts/prof_results/coverage_count.dat > prof_results/coverage_count_nonzero.dat

0 comments on commit bc40b7c

Please sign in to comment.