build_profile, make.log and other stuff

This commit is contained in:
2023-02-13 19:24:47 +06:00
parent 1b38b43c54
commit a0cdbf5522
15 changed files with 315 additions and 140 deletions

25
default_tasks/profile.sh Normal file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
cd "$OUTDIR"
# deleting all files except excutable
echo "$(find . ! -name $EXEC_FILE -type f -delete)"
# executing file compiled with -pg and -fprofile-gen
myprint "${BLUE}executing $OUTDIR/$EXEC_FILE"
./$EXEC_FILE > exec.log
myprint "${GREEN}execution log saved to ${CYAN}$OUTDIR/exec.log"
# moving *.gcda files from $OBJDIR/objects to $OBJDIR/profile
clean_dir ../../$OBJDIR/profile
mv ../../$OBJDIR/objects/*.gcda ../../$OBJDIR/profile/
myprint "${GREEN}$(ls ../../$OBJDIR/profile | wc -l) *.gcda profiling files have written to $OBJDIR/profile"
# generating function call graph
myprint "${BLUE}generating function call graph..."
gprof ./$EXEC_FILE > gprof.log
gprof2dot gprof.log > gprof2dot.graph
dot gprof2dot.graph -Tpng -Gdpi=300 -o gprof2dot.png
myprint "${GREEN}function call graph saved to ${CYAN}$OUTDIR/gprof2dot.png"
cd ../..