2 ##########################################################################
6 # This file is part of rootpwa
8 # rootpwa is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # rootpwa is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with rootpwa. If not, see <http://www.gnu.org/licenses/>.
21 ##########################################################################
22 #-------------------------------------------------------------------------
23 # File and Version Information:
24 # $Rev:: $: revision of last commit
25 # $Author:: $: author of last commit
26 # $Date:: $: date of last commit
29 # runs a program with various valgrind tools
33 # Boris Grube TUM (original author)
36 #-------------------------------------------------------------------------
39 echo ">>> info: called ${0} ${*}"
42 #VALGRIND_TOOL="memcheck"
43 VALGRIND_TOOL=
"callgrind"
45 PROGRAM=
"../../build/bin/calcAmplitudes"
46 PROGRAM_OPT=
"-n 200000 -k 1-4++1+f21270_32_pi-.key -p ./particleDataTable.txt -o 1-4++1+f21270_32_pi-.amp /dev/shm/allBins.ps.noTarget.root"
47 #PROGRAM="../debugBuild/bin/testLibppFunctions"
50 LOG_FILE=
"./"$(basename ${PROGRAM})
"_${VALGRIND_TOOL}.log"
51 OUT_FILE=
"./"$(basename ${PROGRAM})
"_${VALGRIND_TOOL}.out"
54 echo ">>> info: ${0} started on $(date)"
55 echo ">>> info: running valgrind tool ${VALGRIND_TOOL} on '${PROGRAM}'"
58 # prepare command line
59 case ${VALGRIND_TOOL} in
60 "memcheck") # run memcheck tool
61 VALGRIND_OPT=
"--leak-check=full --suppressions=${ROOTSYS}/etc/valgrind-root.supp --show-reachable=yes --track-origins=yes --freelist-vol=100000000 --verbose"
63 "callgrind") # run callgrind tool
64 #!!! callgrind segfaults when demangling Boost symbols
65 #!!! workaround by disabling demangling and running c++filt as an afterburner
67 VALGRIND_OPT=
"--tool=callgrind --simulate-cache=yes --cacheuse=yes --demangle=no --callgrind-out-file=${OUT_FILE} --verbose"
70 echo "!!! error: unknown valgrind tool ${VALGRIND_TOOL}. exiting."
76 CMD=
"valgrind ${VALGRIND_OPT} ${PROGRAM} ${PROGRAM_OPT} &> ${LOG_FILE}"
81 # demangle symbols in callgrind output
82 if [[ ${VALGRIND_TOOL} =
"callgrind" && -f
"${OUT_FILE}" ]]
84 c++filt < ${OUT_FILE} > ${OUT_FILE}.demangled
87 echo ">>> info: ${0} finished on $(date)"