1
0
Fork 0
mirror of https://github.com/sbrl/bin.git synced 2018-01-10 21:33:46 +00:00
bin/ctx

15 lines
289 B
Bash
Executable file

#!/bin/bash
if [[ $# -eq 0 ]]
then
echo "Usage:"
echo "$0 <core>"
exit 1
fi
if [[ -z $2 ]]
then
watch -d -n .2 $0 $1 nw
fi
ps -Leo lastcpu:1,tid,comm | grep "^$1 " | awk '{printf $3": ";system("cut -d\" \" -f3 /proc/"$2"/task/"$2"/schedstat 2>/dev/null")}' | sort -k 1 | column -t