I spent this morning trying to find out how to determine which processor id is the hyper-threaded core, but without luck.
I wish to find out this information and use set_affinity() to bind a process to hyper-threaded thread or non-hyper-threaded thread to profile its performance.
I discovered the simply trick to do what I need.
If the first number is equal to the CPU number (0 in this example) then it’s a real core, if not it is a hyperthreading core.
Real core example:
Hyperthreading core example
The output of the second example is exactly the same as the first one. However we are checking
cpu13, and the first number is1, so CPU 13 this is an hyperthreading core.