aboutsummaryrefslogtreecommitdiff
path: root/test/performance/odp_sched_perf_run.sh
blob: d4c8ebf6e0a914d1266b86c7e8be049bc5dfcba9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
#
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2021-2024 Nokia
#

TEST_DIR="${TEST_DIR:-$(dirname $0)}"

run()
{
	# Maximum number of workers may be less than the number of available processors. One worker
	# should be always available.
	MAX_WORKERS=$(($(nproc) - 2))
	if [ $MAX_WORKERS -lt 1 ]; then
		MAX_WORKERS=1
	fi

	if [ $MAX_WORKERS -lt $1 ]; then
		echo "Not enough CPU cores (requested $1, available $MAX_WORKERS). Skipping test."
	else
		echo odp_sched_perf -p 0 -c $1
		echo ===============================================
		$TEST_DIR/odp_sched_perf${EXEEXT} -p 0 -c $1
		RET_VAL=$?
		if [ $RET_VAL -ne 0 ]; then
			echo odp_sched_perf FAILED
			exit $RET_VAL
		fi

		echo odp_sched_perf -p 1 -c $1
		echo ===============================================
		$TEST_DIR/odp_sched_perf${EXEEXT} -p 1 -c $1
		RET_VAL=$?
		if [ $RET_VAL -ne 0 ]; then
			echo odp_sched_perf FAILED
			exit $RET_VAL
		fi
	fi
}

run 1
run 2
run 6

exit 0