|
Carlos Rodriguez-Fernandez |
5305f8 |
#!/bin/bash
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
# Author: Carlos Rodriguez-Fernandez <carlosrodrifernandez@gmail.com>
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
t_Log "Running $0 - perf tests"
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
tests_in_order=(
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
"perf version"
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
"perf record -F 49 -a -g -- sleep 1"
|
|
Carlos R.F |
892688 |
"perf report --stats"
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
)
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
|
|
Carlos R.F |
892688 |
output_file=$(mktemp)
|
|
Carlos R.F |
892688 |
trap "rm -f ${output_file}" EXIT
|
|
Carlos R.F |
892688 |
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
for cmd in "${tests_in_order[@]}"; do
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
t_Log "Running $0 - perf test: ${cmd}"
|
|
Carlos R.F |
892688 |
if ! eval "${cmd}" > ${output_file} 2>&1; then
|
|
Carlos R.F |
892688 |
t_Log "FAIL: $0: ${cmd}"
|
|
Carlos R.F |
892688 |
cat ${output_file}
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
exit 1
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
else
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
t_Log "PASS: $0: perf test: ${cmd}"
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
fi
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
done
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
t_Log "Cleaning up $0 - perf tests data"
|
|
Carlos Rodriguez-Fernandez |
5305f8 |
rm -f perf.data
|