aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/gpg_keys/moneromooo.asc73
-rw-r--r--utils/health/README.md38
-rwxr-xr-xutils/health/build-scripts/clang-build-time-analyzer-clone-build.sh54
-rwxr-xr-xutils/health/clang-build-time-analyzer-run.sh75
-rwxr-xr-xutils/health/clang-include-what-you-use-run.sh75
-rwxr-xr-xutils/health/clang-tidy-run.sh65
-rwxr-xr-xutils/health/valgrind-tests.sh161
7 files changed, 505 insertions, 36 deletions
diff --git a/utils/gpg_keys/moneromooo.asc b/utils/gpg_keys/moneromooo.asc
index 4275b6c0e..959148e41 100644
--- a/utils/gpg_keys/moneromooo.asc
+++ b/utils/gpg_keys/moneromooo.asc
@@ -12,40 +12,41 @@ XCGtzeiNJSRoklNSTpUo+qQ+bLjETjfogUvq8HpYU+oGi4qaHf+Hkmp4c5Mv3Gfh
p7gDvxXOGxzq0sqfPTWTBdCj1OPfunHbbeH8ypwBlNpwVG40fJdya+Dqjwu25qX6
Xh5vxLzeJTBmlawa97MCliPvzzJgW9qHRVCa9lLloGVYLiUOS0N+dZ/r/QARAQAB
tD5tb25lcm9tb29vLW1vbmVybyA8bW9uZXJvbW9vby1tb25lcm9AdXNlcnMubm9y
-ZXBseS5naXRodWIuY29tPokCPwQTAQIAKQIbAwcLCQgHAwIBBhUIAgkKCwQWAgMB
-Ah4BAheABQJcEB4SBQkLn+mRAAoJEGhvB0VNbO/DzSIQALXk6ST5Uoxh5+NLBJgI
-GR2NOCFwsU+97VOkZWZnzpk+JdUrq/I9JmWWTegGKu3it5YvM8xY1zD1l+RXlnmY
-Bg7oT6N63lL8hBhxGm9Hk2A1VJlEjtgtvjbg5yLSdvjxJL1vrmchWGwFWoHT9uIh
-oefemb3TQ1U+ADVsW42jXca650/rqvsUMpmQbDfHxUBIfpbxgTWz8sHuMfhFB3R0
-nzSuZ1E1Pbg5jWYxd6sXpb1VFZ7TaQNVGB+4wMe8AH8/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DqmfY/AVeIrFdY2ZQ==
+=BfKA
-----END PGP PUBLIC KEY BLOCK-----
diff --git a/utils/health/README.md b/utils/health/README.md
new file mode 100644
index 000000000..8fadd3908
--- /dev/null
+++ b/utils/health/README.md
@@ -0,0 +1,38 @@
+#Intro
+This directory contains tools, which can be used for checking the health of the project, like build/run time analyzers, lints, etc.
+
+#Usage
+Unless it's stated differently, these scripts should be called from a given source directory, where you want the checks to be performed, for instance:
+
+`og@ghetto:~/dev/monero$ utils/health/clang-build-time-analyzer-run.sh`
+
+##ClangBuildAnalyzer
+`utils/health/clang-build-time-analyzer-run.sh`
+The CBA helps in finding culprints of slow compilation.
+On the first run, the script will complain about the missing ClangBuildAnalyzer binary and will point you to another script, which is able to clone and build the required binary.
+
+##clang-tidy
+`utils/health/clang-tidy-run.sh`
+Performs Lint checks on the source code and stores the result in the build directory. More information on the [home page](https://clang.llvm.org/extra/clang-tidy/).
+
+##include-what-you-use
+`utils/health/clang-include-what-you-use-run.sh`
+Analyses the header file hierarchy and delivers hints on how to reduce their complexity. More information on the [home page](https://include-what-you-use.org/).
+
+
+##Valgrind checks
+`utils/health/valgrind-tests.sh`
+This script is able to run valgrind's callgrind, cachegrind and memcheck for a given set of executables.
+It expects ONE PARAMETER, which points to a file with paths to executables and their arguments, written line by line. For example:
+
+```
+ls -l -h
+build/tests/unit_tests/unit_tests
+```
+
+The `*.out` results can be interpreted with the `kcachegrind` tool.
+The memcheck output is just a readable text file with a summary at the end.
+
+#Footer
+Responsible: mj-xmr
+
diff --git a/utils/health/build-scripts/clang-build-time-analyzer-clone-build.sh b/utils/health/build-scripts/clang-build-time-analyzer-clone-build.sh
new file mode 100755
index 000000000..de5f35a38
--- /dev/null
+++ b/utils/health/build-scripts/clang-build-time-analyzer-clone-build.sh
@@ -0,0 +1,54 @@
+#!/bin/bash -e
+
+# Copyright (c) 2014-2020, The Monero Project
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this list of
+# conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice, this list
+# of conditions and the following disclaimer in the documentation and/or other
+# materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors may be
+# used to endorse or promote products derived from this software without specific
+# prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# This script checkouts and builds ClangBuildAnalyzer.
+# The result is put into bin directory
+
+DIR_THIS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+
+TAG="v1.2.0"
+PROG="ClangBuildAnalyzer"
+DIR_OUT="$DIR_THIS/../bin"
+DIR_BUILD="build"
+
+mkdir -p "$DIR_BUILD" && cd "$DIR_BUILD"
+if [ ! -d "$PROG" ]; then
+ git clone https://github.com/aras-p/$PROG.git
+fi
+cd "$PROG"
+git checkout "$TAG"
+mkdir -p build && cd build
+cmake ..
+make -j`nproc`
+
+mkdir -p "$DIR_OUT"
+cp -v "$PROG" "$DIR_OUT"
+make clean # Clean the used space
+
diff --git a/utils/health/clang-build-time-analyzer-run.sh b/utils/health/clang-build-time-analyzer-run.sh
new file mode 100755
index 000000000..fb7eeaced
--- /dev/null
+++ b/utils/health/clang-build-time-analyzer-run.sh
@@ -0,0 +1,75 @@
+#!/bin/bash -e
+
+# Copyright (c) 2014-2020, The Monero Project
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this list of
+# conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice, this list
+# of conditions and the following disclaimer in the documentation and/or other
+# materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors may be
+# used to endorse or promote products derived from this software without specific
+# prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# ClangBuildAnalyzer is able to analyze the aggregate build time of particular headers.
+
+DIR_THIS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+
+# Build variables
+PROG="ClangBuildAnalyzer"
+PROG_PATH="$DIR_THIS/bin/$PROG"
+DIR_BUILD="build/clang-build-analyser"
+
+# ClangBuildAnalyzer variables
+DIR_MONITORED="."
+RESULT="cba-result.txt"
+TRACE="cba-trace.txt"
+
+if [ -f "$PROG_PATH" ]; then
+ echo "Found: $PROG_PATH"
+else
+ echo "Couldn't find: $PROG_PATH"
+ echo "Please run the below script to clone and build $PROG:"
+ echo "$DIR_THIS/build-scripts/clang-build-time-analyzer-clone-build.sh"
+ exit 1
+fi
+
+mkdir -p "$DIR_BUILD" && cd "$DIR_BUILD"
+
+cmake ../.. \
+-DCMAKE_C_COMPILER=clang \
+-DCMAKE_CXX_COMPILER=clang++ \
+-DUSE_CCACHE=OFF \
+-DUSE_COMPILATION_TIME_PROFILER=ON \
+-DBUILD_SHARED_LIBS=ON \
+-DBUILD_TESTS=ON
+
+make clean # Clean up, so that the trace can be regenerated from scratch
+$PROG_PATH --start $DIR_MONITORED # Start monitoring
+time make # Build
+#time make easylogging # Quick testing: build a single target
+$PROG_PATH --stop $DIR_MONITORED $TRACE # Stop and output to trace file
+$PROG_PATH --analyze $TRACE | tee $RESULT # Analyze the trace, and store it in a readable format
+gzip -f $TRACE # Zip the trace, because it's huge. -f overwrites the previously generated trace
+
+echo ""
+echo "Readable result stored in: $DIR_BUILD/$RESULT"
+echo "The trace (analyser's input data) in: $DIR_BUILD/$TRACE.gz"
+
diff --git a/utils/health/clang-include-what-you-use-run.sh b/utils/health/clang-include-what-you-use-run.sh
new file mode 100755
index 000000000..655a188bd
--- /dev/null
+++ b/utils/health/clang-include-what-you-use-run.sh
@@ -0,0 +1,75 @@
+#!/bin/bash -e
+
+# Copyright (c) 2014-2020, The Monero Project
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this list of
+# conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice, this list
+# of conditions and the following disclaimer in the documentation and/or other
+# materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors may be
+# used to endorse or promote products derived from this software without specific
+# prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Include What You Use analyses the complexity of your header hierarchy and proposes optimisations.
+# User documentation:
+# https://github.com/include-what-you-use/include-what-you-use/blob/master/README.md
+
+# Build variables
+PROG="include-what-you-use"
+PROG_SHORT="iwyu"
+DIR_BUILD="build/clang-$PROG_SHORT"
+
+RESULT="$PROG_SHORT-result.txt"
+
+if hash "$PROG"; then
+ echo "Found: $PROG"
+else
+ echo "Couldn't find: $PROG"
+ echo "Please run the below command to install $PROG:"
+ echo "sudo apt install $PROG_SHORT"
+ exit 1
+fi
+
+mkdir -p "$DIR_BUILD" && cd "$DIR_BUILD"
+rm `find . -name "CMakeCache.txt"` || true
+
+UWYU_COMMAND="$PROG;-Xiwyu;any;-Xiwyu;iwyu;-Xiwyu;args" # Copy-pasted from the user docs.
+
+cmake ../.. \
+-DCMAKE_C_COMPILER=clang \
+-DCMAKE_CXX_COMPILER=clang++ \
+-DUSE_CCACHE=ON \
+-DCMAKE_C_INCLUDE_WHAT_YOU_USE="$UWYU_COMMAND" \
+-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="$UWYU_COMMAND" \
+-DBUILD_SHARED_LIBS=ON \
+-DBUILD_TESTS=ON
+
+make clean # Clean up to generate the full report
+time make -k 2>&1 | tee "$RESULT" # Run the scan. -k means: ignore errors
+#time make -k easylogging 2>&1 | tee $RESULT # Quick testing: build a single target
+KPI=$(cat "$RESULT" | wc -l)
+tar -cJvf "$RESULT.txz" "$RESULT" # Zip the result, because it's huge.
+rm -v "$RESULT"
+
+echo ""
+echo "Readable result stored in: $DIR_BUILD/$RESULT.gz"
+
+echo "$KPI" > "kpis.txt"
diff --git a/utils/health/clang-tidy-run.sh b/utils/health/clang-tidy-run.sh
new file mode 100755
index 000000000..6b34f6a3b
--- /dev/null
+++ b/utils/health/clang-tidy-run.sh
@@ -0,0 +1,65 @@
+#!/bin/bash -e
+
+# Copyright (c) 2014-2020, The Monero Project
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this list of
+# conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice, this list
+# of conditions and the following disclaimer in the documentation and/or other
+# materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors may be
+# used to endorse or promote products derived from this software without specific
+# prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# clang-tidy runs lint checks on C & C++ sources and headers.
+# Run this script from the source directory.
+
+DIR_BUILD_BASE="build/clang-tidy"
+RESULT_BASE="clang-tidy-result"
+
+function tidy_for_language() {
+ LANG="${1}"
+ DIR_BUILD="${DIR_BUILD_BASE}-${LANG}"
+ RESULT="${RESULT_BASE}-${LANG}.txt"
+
+ mkdir -p "$DIR_BUILD" && pushd "$DIR_BUILD"
+
+ cmake ../.. \
+ -DCMAKE_C_COMPILER=clang \
+ -DCMAKE_CXX_COMPILER=clang++ \
+ -DUSE_CCACHE=ON \
+ -DUSE_CLANG_TIDY_${LANG}=ON \
+ -DBUILD_SHARED_LIBS=ON \
+ -DBUILD_TESTS=ON
+
+ make clean # Clean up, so that the result can be regenerated from scratch
+ time make -k 2>&1 | tee "$RESULT" # Build and store the result. -k means: ignore errors
+ #time make -k easylogging 2>&1 | tee "$RESULT" # Quick testing: build a single target
+ gzip -f "$RESULT" # Zip the result, because it's huge. -f overwrites the previously generated result
+
+ echo ""
+ echo "Readable result stored in: $DIR_BUILD/$RESULT.gz"
+
+ popd
+}
+
+tidy_for_language "C"
+tidy_for_language "CXX"
+
diff --git a/utils/health/valgrind-tests.sh b/utils/health/valgrind-tests.sh
new file mode 100755
index 000000000..9f5e7e7c0
--- /dev/null
+++ b/utils/health/valgrind-tests.sh
@@ -0,0 +1,161 @@
+#!/bin/bash -e
+
+# Copyright (c) 2014-2020, The Monero Project
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this list of
+# conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice, this list
+# of conditions and the following disclaimer in the documentation and/or other
+# materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors may be
+# used to endorse or promote products derived from this software without specific
+# prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# This script is able to run valgrind's callgrind, cachegrind and memcheck for a given set of executables.
+# It expects ONE PARAMETER, which points to a file with paths to executables and their arguments, written line by line.
+
+if [ "$#" -ne 1 ]; then
+ echo "Please provide an argument, which points to a file with paths to executables and their arguments, written line by line. For example:"
+ echo ""
+ echo "ls -l -h"
+ echo "build/tests/unit_tests/unit_tests"
+ exit 1
+fi
+
+FILE_IN="$1"
+DIR_OUT="build/valgrind-output" # Using build as the base output directory, as it's ignored in .gitignore
+
+function is_file_or_exit {
+ FILE="${1}"
+ if [ -f $FILE ]; then
+ echo "The input file $FILE exists. Can proceed."
+ else
+ echo "The input file $FILE doesn't exist."
+ exit 1
+ fi
+ return 0
+}
+
+function is_tool_or_exit {
+ TOOL="${1}"
+ if $(hash ${TOOL}); then
+ echo "${TOOL} is installed. Can proceed."
+ else
+ echo "Please install ${TOOL} to continue."
+ exit 1
+ fi
+ return 0
+}
+
+function get_tool_out_file_base {
+ EXE="${1}"
+ TOOL="${2}"
+
+ EXE_NAME=$(basename $EXE)
+ local retval="${DIR_OUT}/${EXE_NAME}-${TOOL}"
+ echo "$retval"
+}
+
+function get_tool_out_file {
+ EXE="${1}"
+ TOOL="${2}"
+
+ FILE_OUT_BASE=$(get_tool_out_file_base ${EXE} ${TOOL})
+ local retval="--${TOOL}-out-file=${FILE_OUT_BASE}.out"
+ echo "$retval"
+}
+
+function run_valgrind_4_executable {
+ EXE="${1}"
+ ARGS="${2}"
+ TOOL="${3}"
+ EXTRA_OPTS="${4}"
+ FILE_OUT_TOOL="${5}"
+ FILE_OUT_BASE=$(get_tool_out_file_base ${EXE} ${TOOL})
+
+ echo "Runnig '${TOOL}' for '${EXE}' with args '${ARGS}'"
+ echo "EXTRA_OPTS = ${EXTRA_OPTS}"
+ echo "FILE_OUT_TOOL = ${FILE_OUT_TOOL}"
+ if ! valgrind --tool=${TOOL} ${FILE_OUT_TOOL} --log-file="${FILE_OUT_BASE}.log" ${EXTRA_OPTS} ${EXE} ${ARGS}; then
+ echo "FAILED in runnig ${TOOL} for ${EXE} !"
+ fi
+}
+
+function run_valgrind_4_executable_callgrind {
+ EXE="${1}"
+ ARGS="${2}"
+ TOOL="callgrind"
+ EXTRA_OPTS="--dump-instr=yes --simulate-cache=yes --collect-jumps=yes"
+ FILE_OUT_TOOL=$(get_tool_out_file ${EXE} ${TOOL})
+
+ run_valgrind_4_executable ${EXE} "${ARGS}" ${TOOL} "${EXTRA_OPTS}" ${FILE_OUT_TOOL}
+}
+
+function run_valgrind_4_executable_cachegrind {
+ EXE="${1}"
+ ARGS="${2}"
+ TOOL="cachegrind"
+ EXTRA_OPTS=""
+ FILE_OUT_TOOL=$(get_tool_out_file ${EXE} ${TOOL})
+
+ run_valgrind_4_executable ${EXE} "${ARGS}" ${TOOL} "${EXTRA_OPTS}" ${FILE_OUT_TOOL}
+}
+
+function run_valgrind_4_executable_memcheck {
+ EXE="${1}"
+ ARGS="${2}"
+ TOOL="memcheck"
+ #EXTRA_OPTS="--leak-check=yes" # Minimalistic
+ EXTRA_OPTS="--leak-check=full --show-leak-kinds=all --track-origins=yes"
+ FILE_OUT_TOOL="" # memcheck has no special out file, only the log
+
+ run_valgrind_4_executable ${EXE} "${ARGS}" ${TOOL} "${EXTRA_OPTS}" ${FILE_OUT_TOOL}
+}
+
+function run_valgrind_4_executable_all {
+ EXE_ARGS_ARR=(${1})
+ EXE=${EXE_ARGS_ARR[0]} # First element of the array
+ ARGS=${EXE_ARGS_ARR[@]:1} # Every next element
+
+ #EXE="ls" # A quick check of the happy path
+ #EXE="nothere" # A quick check of error handling - no such executable
+ #EXE=/bin/false # A quick check of error handling - executable returned != 0
+
+ run_valgrind_4_executable_memcheck ${EXE} "${ARGS}"
+ run_valgrind_4_executable_cachegrind ${EXE} "${ARGS}"
+ run_valgrind_4_executable_callgrind ${EXE} "${ARGS}"
+}
+
+is_tool_or_exit valgrind
+is_file_or_exit "$FILE_IN"
+echo "All OK."
+echo "Will perform checks for the following executables and their arguments:"
+while IFS= read -r line; do
+ echo "$line"
+done < "$FILE_IN"
+
+mkdir -p "$DIR_OUT"
+while IFS= read -r line; do
+ echo "$line"
+ run_valgrind_4_executable_all "$line"
+done < "$FILE_IN"
+
+echo "Done. All data saved in ${DIR_OUT}"
+