8000 Add a col for thread CPU affinity mask as well · yurembo/Linux-Kernel-Programming@c5d1fa9 · GitHub
[go: up one dir, main page]

Skip to content

Commit c5d1fa9

Browse files
committed
Add a col for thread CPU affinity mask as well
1 parent ab2977f commit c5d1fa9

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

ch10/query_task_sched.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#
2020
# For details, pl refer to the book Ch 10.
2121
i=1
22-
printf " PID TID Name Sched Policy Prio *RT\n"
22+
printf " PID TID Name Sched Policy Prio *RT CPU-affinity-mask\n"
2323
prev_pid=1
2424

2525
IFS=$'\n'
@@ -54,13 +54,25 @@ do
5454

5555
# 'Highlight', with 1 star, any real-time thread, and with 3 stars, those
5656
# that have an rtprio of 99 !
57+
rt3=0 ; rt1=0
5758
if [ "${policy}" = " SCHED_RR" -o "${policy}" = " SCHED_FIFO" ] ; then
5859
if [ ${prio} -eq 99 ] ; then
59-
printf " ***"
60-
else
61-
printf " *"
62-
fi
60+
printf " ***"
61+
rt3=1
62+
else
63+
printf " *"
64+
rt1=1
65+
fi
6366
fi
67+
68+
# CPU affinity
69+
cpuaffinity=$(taskset -p ${pid} 2>/dev/null |cut -d':' -f2)
70+
if [ ${rt3} -eq 1 -o ${rt1} -eq 1 ]; then
71+
printf " ${cpuaffinity}"
72+
else
73+
printf " ${cpuaffinity}"
74+
fi
75+
#[ ${rt1} -eq 1 ] && printf " ${cpuaffinity}"
6476
}
6577
printf "\n"
6678
prev_pid=${pid}

0 commit comments

Comments
 (0)
0