File: checkaffinity

package info (click to toggle)
numactl 2.0.19-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,228 kB
  • sloc: ansic: 7,295; sh: 460; makefile: 123; awk: 26
file content (31 lines) | stat: -rwxr-xr-x 858 bytes parent folder | download | duplicates (5)
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
#!/bin/bash
# check if affinity works

testdir=`dirname "$0"`
: ${srcdir:=${testdir}/..}
: ${builddir:=${srcdir}}
export PATH=${builddir}:$PATH

S=`numactl --show | grep nodebind:`
NODES=`echo $S | sed -e "s/nodebind://"`

S=`numactl --show | grep physcpubind:`
CPUS=`echo $S | sed -e "s/physcpubind://"`

for i in $CPUS ; do
    if [ "$(numactl --physcpubind=$i "${testdir}"/printcpu)" != "$i" ] ; then
       echo "--physcpubind for $i doesn't work"
       exit 1
    fi
    if [ "$(numactl --physcpubind=$i numactl --show | awk '/^physcpubind/ { print $2 }' )" != "$i" ] ; then
	echo "--show doesn't agree with physcpubind for cpu $i"
	exit 1
    fi
done

for i in $NODES ; do
    if [ $(numactl --cpunodebind=$i numactl --show | awk '/nodebind/ { print $2 }' ) != $i ] ; then
	echo "--show doesn't agree with cpunodebind for node $i"
	exit 1
    fi
done