| 1 |
#!/bin/bash |
| 2 |
# perftool-testsuite :: perf_report |
| 3 |
# SPDX-License-Identifier: GPL-2.0 |
| 4 |
|
| 5 |
# |
| 6 |
# setup.sh of perf report test |
| 7 |
# Author: Michael Petlan <[email protected]> |
| 8 |
# |
| 9 |
# Description: |
| 10 |
# |
| 11 |
# We need some sample data for perf-report testing |
| 12 |
# |
| 13 |
# |
| 14 |
|
| 15 |
DIR_PATH="$(dirname $0)" |
| 16 |
|
| 17 |
# include working environment |
| 18 |
. "$DIR_PATH/../common/init.sh" |
| 19 |
|
| 20 |
TEST_RESULT=0 |
| 21 |
|
| 22 |
test -d "$HEADER_TAR_DIR" || mkdir -p "$HEADER_TAR_DIR" |
| 23 |
|
| 24 |
SW_EVENT="cpu-clock" |
| 25 |
|
| 26 |
$CMD_PERF record -asdg -e $SW_EVENT -o $CURRENT_TEST_DIR/perf.data -- $CMD_LONGER_SLEEP 2> $LOGS_DIR/setup.log |
| 27 |
PERF_EXIT_CODE=$? |
| 28 |
|
| 29 |
"$DIR_PATH/../common/check_all_patterns_found.pl" \ |
| 30 |
"$RE_LINE_RECORD1" "$RE_LINE_RECORD2" < $LOGS_DIR/setup.log |
| 31 |
CHECK_EXIT_CODE=$? |
| 32 |
|
| 33 |
print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "prepare the perf.data file" |
| 34 |
(( TEST_RESULT += $? )) |
| 35 |
|
| 36 |
# Some minimal parallel workload. |
| 37 |
$CMD_PERF record --latency -o $CURRENT_TEST_DIR/perf.data.1 bash -c "for i in {1..100} ; do cat /proc/cpuinfo 1> /dev/null & done; sleep 1" 2> $LOGS_DIR/setup-latency.log |
| 38 |
PERF_EXIT_CODE=$? |
| 39 |
|
| 40 |
echo ================== |
| 41 |
cat $LOGS_DIR/setup-latency.log |
| 42 |
echo ================== |
| 43 |
|
| 44 |
"$DIR_PATH/../common/check_all_patterns_found.pl" \ |
| 45 |
"$RE_LINE_RECORD1" "$RE_LINE_RECORD2" < $LOGS_DIR/setup-latency.log |
| 46 |
CHECK_EXIT_CODE=$? |
| 47 |
|
| 48 |
print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "prepare the perf.data.1 file" |
| 49 |
(( TEST_RESULT += $? )) |
| 50 |
|
| 51 |
print_overall_results $TEST_RESULT |
| 52 |
exit $? |