You are not logged in.
Pages: 1

Hi,
I just wanna ensure that I'm being sane here. I've put together the following script
#!/bin/sh
#
# 
# Script to get either process CPU affinity
# or scheduler class
#
while getopts "p:sah" opt; do
        case "$opt" in
                p ) proc="$OPTARG"      ;;
                s ) sched="on"          ;;
                a ) afin="on"           ;;
                h ) echo "Usage: $0 -p [pid] -s -a"
                    echo "-s = get process scheduling class"
                    echo "-a = get process cpu affinity"; echo
                    exit 1
        esac
done
if [ -z "$proc" ] ; then
        echo "No pid entered...exiting"
        exit 1
fi
if [ -n "$sched" ] ; then
        echo
        echo "Getting scheduler for $proc"
        strace -etrace=sched_getscheduler chrt -p $proc
fi
if [ -n "$afin" ] ; then
        echo
        echo "Getting CPU affinity mask for $proc"
        strace -etrace=sched_getaffinity taskset -p $proc
fi
echoThe idea behind it is that I wanna get back the CPU affinity and scheduler class for an existing process. This strace commands seem to work but I still wanna be sure that my reasoning is sound, in other words is strace query the running process?
Thanks for any feedback
Jon
Offline
Pages: 1