build_profile, make.log and other stuff
This commit is contained in:
@@ -1,5 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# delete old objects
|
||||
clean_dir "$OBJDIR/objects"
|
||||
|
||||
# copy profiling info
|
||||
prof_files=$(find "$OBJDIR/profile/" -name '*.gcda')
|
||||
if [ -z "$prof_files" ]; then
|
||||
myprint "${YELLOW}no profiling info found"
|
||||
else
|
||||
for prof_file in $prof_files; do
|
||||
myprint "${GRAY}$(basename $prof_file)"
|
||||
cp $prof_file "$OBJDIR/objects/"
|
||||
done
|
||||
fi
|
||||
|
||||
compile_c "$C_ARGS" "$SRC_C $TESTS_C"
|
||||
compile_cpp "$CPP_ARGS" "$SRC_CPP $TESTS_CPP"
|
||||
link "$CPP_ARGS" "$EXEC_FILE"
|
||||
link "$LINKER_ARGS" "$EXEC_FILE"
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# delete old objects
|
||||
clean_dir "$OBJDIR/objects"
|
||||
compile_c "$C_ARGS" "$SRC_C"
|
||||
compile_cpp "$CPP_ARGS" "$SRC_CPP"
|
||||
link "$CPP_ARGS" "$SHARED_LIB_FILE"
|
||||
link "$LINKER_ARGS" "$SHARED_LIB_FILE"
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# delete old objects
|
||||
clean_dir "$OBJDIR/objects"
|
||||
compile_c "$C_ARGS" "$SRC_C"
|
||||
compile_cpp "$CPP_ARGS" "$SRC_CPP"
|
||||
pack_static_lib "$STATIC_LIB_FILE"
|
||||
|
||||
4
default_tasks/clean.sh
Normal file
4
default_tasks/clean.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
delete_dir "$OBJDIR"
|
||||
delete_dir "$OUTDIR"
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $OUTDIR
|
||||
cd "$OUTDIR"
|
||||
./$EXEC_FILE
|
||||
cd ..
|
||||
|
||||
25
default_tasks/profile.sh
Normal file
25
default_tasks/profile.sh
Normal 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 ../..
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $OUTDIR
|
||||
cd "$OUTDIR"
|
||||
valgrind $VALGRIND_ARGS ./$EXEC_FILE
|
||||
cat "valgrind.log"
|
||||
myprint "${GREEN}valgrind log saved to ${CYAN}$OUTDIR/exec.log"
|
||||
cd ..
|
||||
|
||||
Reference in New Issue
Block a user