aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-01-02 06:38:20 +0100
committerSven Gothel <[email protected]>2021-01-02 06:38:20 +0100
commitce785560ce1ef7ae955798e09d094d7ae987e357 (patch)
tree50383e194b52efdb110873d9e04020668e332cc3 /scripts
parentf5c5d5a60b9e4b8c0b75ac79692b0670ecf5987f (diff)
CMakeLists, scripts/build.sh: Add GPROF and PERF_ANALYSIS: Manual performance analysis via gprof and callgrind
also adding test-exe scripts for this purpose
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build.sh2
l---------scripts/test_cow_darray_perf01.sh1
-rwxr-xr-xscripts/test_exe_template.sh65
3 files changed, 68 insertions, 0 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
index 7175961..f9a7cd5 100644
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -29,6 +29,8 @@ buildit() {
cd build-$archabi
# CLANG_ARGS="-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++"
cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILD_TESTING=ON ..
+ # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILD_TESTING=ON -DGPROF=ON ..
+ # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILD_TESTING=ON -DPERF_ANALYSIS=ON ..
# cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILD_TESTING=ON -DDEBUG=ON ..
# cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILD_TESTING=ON -DDEBUG=ON -DINSTRUMENTATION=ON ..
# cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILD_TESTING=ON -DDEBUG=ON -DINSTRUMENTATION_UNDEFINED=ON ..
diff --git a/scripts/test_cow_darray_perf01.sh b/scripts/test_cow_darray_perf01.sh
new file mode 120000
index 0000000..318827b
--- /dev/null
+++ b/scripts/test_cow_darray_perf01.sh
@@ -0,0 +1 @@
+test_exe_template.sh \ No newline at end of file
diff --git a/scripts/test_exe_template.sh b/scripts/test_exe_template.sh
new file mode 100755
index 0000000..3f42e44
--- /dev/null
+++ b/scripts/test_exe_template.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+# Arguments:
+# --perf_analysis special performance analysis using 3rd party tools
+# -v normal dummy for full benchmarking
+# <none> auto_run, no benchmarking
+#
+
+sdir=`dirname $(readlink -f $0)`
+rootdir=`dirname $sdir`
+bname=`basename $0 .sh`
+
+. $sdir/setup-machine-arch.sh
+
+build_dir=$rootdir/build-$archabi
+
+if [ ! -e $build_dir/test/$bname ] ; then
+ echo "test exe $build_dir/test/$bname not existing"
+ exit 1
+fi
+
+if [ "$1" = "-log" ] ; then
+ logbasename=$2
+ shift 2
+else
+ logbasename=$bname.$archabi
+fi
+
+logfile=$rootdir/doc/test/$logbasename.0.log
+rm -f $logfile
+
+valgrindlogfile=$rootdir/doc/test/$logbasename.valgrind.0.log
+rm -f $valgrindlogfile
+
+callgrindoutfile=$rootdir/doc/test/$logbasename.callgrind.0.out
+rm -f $callgrindoutfile
+
+ulimit -c unlimited
+
+# run 'dpkg-reconfigure locales' enable 'en_US.UTF-8'
+export LANG=en_US.UTF-8
+export LC_MEASUREMENT=en_US.UTF-8
+
+# export EXE_WRAPPER="valgrind --tool=memcheck --leak-check=full --show-reachable=yes --error-limit=no --default-suppressions=yes --suppressions=$sdir/valgrind.supp --gen-suppressions=all -s --log-file=$valgrindlogfile"
+# export EXE_WRAPPER="valgrind --tool=helgrind --track-lockorders=yes --ignore-thread-creation=yes --default-suppressions=yes --suppressions=$sdir/valgrind.supp --gen-suppressions=all -s --log-file=$valgrindlogfile"
+# export EXE_WRAPPER="valgrind --tool=drd --segment-merging=no --ignore-thread-creation=yes --trace-barrier=no --trace-cond=no --trace-fork-join=no --trace-mutex=no --trace-rwlock=no --trace-semaphore=no --default-suppressions=yes --suppressions=$sdir/valgrind.supp --gen-suppressions=all -s --log-file=$valgrindlogfile"
+#export EXE_WRAPPER="valgrind --tool=callgrind --instr-atstart=yes --collect-atstart=yes --collect-systime=nsec --combine-dumps=yes --separate-threads=no --callgrind-out-file=$callgrindoutfile --log-file=$valgrindlogfile"
+# export EXE_WRAPPER="valgrind --tool=callgrind --read-inline-info=yes --instr-atstart=yes --collect-atstart=yes --collect-systime=nsec --combine-dumps=yes --separate-threads=no --callgrind-out-file=$callgrindoutfile --log-file=$valgrindlogfile"
+export EXE_WRAPPER="nice -20"
+
+runit() {
+ echo COMMANDLINE $0 $*
+ echo EXE_WRAPPER $EXE_WRAPPER
+ echo logbasename $logbasename
+ echo logfile $logfile
+ echo valgrindlogfile $valgrindlogfile
+ echo callgrindoutfile $callgrindoutfile
+
+ echo $EXE_WRAPPER $build_dir/test/$bname $*
+
+ $EXE_WRAPPER $build_dir/test/$bname $*
+}
+
+runit $* 2>&1 | tee $logfile
+