Skip to content

Instantly share code, notes, and snippets.

View munsingh's full-sized avatar

Manish Singh munsingh

  • Advanced Micro Devices
  • Bangalore
View GitHub Profile
@stedolan
stedolan / coreinfo
Created July 18, 2011 16:09
Prints number of cores, CPU topology and cache topology/size on Linux machines
#!/bin/bash
unshared () {
grep '^[0-9]\+$' "$1" > /dev/null
}
for cpu in $(ls -d /sys/devices/system/cpu/cpu[0-9]* | sort -t u -k 3 -n); do
echo "${cpu##*/}: [Package #$(cat $cpu/topology/physical_package_id), Core #$(cat $cpu/topology/core_id)]"
if ! unshared $cpu/topology/core_siblings_list; then
echo " same package as $(cat $cpu/topology/core_siblings_list)"