This commit is contained in:
2023-05-24 22:19:33 +06:00
parent 5e23ef8156
commit ef6a3f82c4
8 changed files with 171 additions and 35 deletions

View File

@@ -0,0 +1,19 @@
#!/bin/bash
cd "$OUTDIR"
# deleting all files except excutable
echo "$(find . ! -name $EXEC_FILE -type f -delete)"
# executing file with callgrind
myprint "${BLUE}executing $OUTDIR/$EXEC_FILE"
valgrind --tool=callgrind --callgrind-out-file=callgrind.out ./$EXEC_FILE > exec.log
myprint "${GREEN}execution log saved to ${CYAN}$OUTDIR/exec.log"
# exit 0
# generating function call graph
myprint "${BLUE}generating function call graph..."
gprof2dot -f callgrind callgrind.out > gprof2dot.graph
dot gprof2dot.graph -Tpng -Gdpi=300 -o gprof2dot.png
myprint "${GREEN}function call graph saved to ${CYAN}$OUTDIR/gprof2dot.png"
cd ../..

View File

@@ -4,3 +4,20 @@ try_delete_dir_or_file "$OBJDIR"
try_delete_dir_or_file "$OUTDIR"
myprint "${WHITE}deleting build logs"
rm -rf *.log
for tmpfile in $(ls -a | grep -e '\.rebuild.*\.tmp'); do
try_delete_dir_or_file "$tmpfile"
done
set +e
OLDIFS="$IFS"
IFS=$'\n'
for dep in $DEPS; do
dep_dir=$(echo ${dep/=*/} | tr -d '[:blank:]')
myprint "${CYAN}--------------[$dep_dir]--------------"
cd "$DEPS_BASEDIR/$dep_dir"
make clean
cd ..
done
IFS="$OLDIFS"
set -e