Created
July 25, 2017 17:21
-
-
Save alexeiz/044179abb6e82843792987cc30f001cd to your computer and use it in GitHub Desktop.
List affinities of process threads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
[[ $# == 0 || $1 == '-h' ]] && { | |
bn=$(basename $0) | |
echo "$bn: list affinities of process threads" | |
echo "usage: $bn [pid|-p name]" | |
exit | |
} | |
pid=$1; shift | |
[[ $pid == '-p' ]] && { | |
pid=$(pgrep $1 | head -n1) | |
} | |
ps --no-headers -Tp $pid | \ | |
perl -alne '$ts=`taskset -cp $F[1]`; $ts=~s/.*list: (.*)/$1/; chomp $ts; print "$_ $ts"' | \ | |
column -t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment