Last active
September 27, 2016 21:07
-
-
Save dcode/0473897bc1fec98b84f05191a4d3433b to your computer and use it in GitHub Desktop.
Get top-level physical processor numbers grouped by socket and core id's
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
egrep -e "processor" -e "core id" -e ^physical /proc/cpuinfo | \ | |
xargs -l3 echo | \ | |
awk -vOFS='\t' '{ print "{\"socket\": "$7", \"core\": " $11 ", \"proc\":" $3 "}" }' | \ | |
jq -sc ' | |
[.[] | {sock_core:"\(.socket)-\(.core)", proc, core, socket } ] | |
| group_by(.sock_core) | .[] | .[0] ' | \ | |
sort -V |
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
/*example output*/ | |
{"sock_core":"0-0","proc":0,"core":0,"socket":0} | |
{"sock_core":"0-1","proc":4,"core":1,"socket":0} | |
{"sock_core":"0-2","proc":8,"core":2,"socket":0} | |
{"sock_core":"0-3","proc":12,"core":3,"socket":0} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment