I use mpstat a lot and at times want to know if a numa node is busy or at times a specific core. Previously I would post process the mpstat data after comparing the data to the output of lscpu.
A while ago I wrote a perl script to map this out and reworked this script today in python and what we have is as follows.
19:55:39 NODE SOCK CORE CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 19:55:40 all 8.96 0.00 0.17 0.00 0.00 0.00 0.00 0.00 0.00 90.87 19:55:40 0 0 0 0 12.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 87.00 19:55:40 0 0 1 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 0 0 2 2 1.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 98.99 19:55:40 0 0 3 3 0.99 0.00 1.98 0.00 0.00 0.00 0.00 0.00 0.00 97.03 19:55:40 0 0 4 4 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 0 0 5 5 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 1 1 6 6 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 1 1 7 7 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 1 1 8 8 0.99 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 99.01 19:55:40 1 1 9 9 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 1 1 10 10 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 1 1 11 11 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 0 0 0 12 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 0 0 1 13 100.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 19:55:40 0 0 2 14 0.00 0.00 1.01 0.00 0.00 0.00 0.00 0.00 0.00 98.99 19:55:40 0 0 3 15 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 0 0 4 16 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 0 0 5 17 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 1 1 6 18 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 1 1 7 19 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 1 1 8 20 100.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 19:55:40 1 1 9 21 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 1 1 10 22 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 19:55:40 1 1 11 23 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
What we can see is that we now have a NODE , SOCK and CORE which is added to the parsed mpstat data. This also allows me to do other things with this data i.e. group the data in say influx by node or core by post processing this data , we can then generate views which show the difference between nodes.

The repository if you want to try this out is here: