mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 16:00:39 +01:00
Support for more than one thread in a core
This commit is contained in:
24
topology.c
Normal file
24
topology.c
Normal file
@@ -0,0 +1,24 @@
|
||||
void cpuid(unsigned int *eax, unsigned int *ebx,
|
||||
unsigned int *ecx, unsigned int *edx)
|
||||
{
|
||||
asm volatile("cpuid"
|
||||
: "=a" (*eax),
|
||||
"=b" (*ebx),
|
||||
"=c" (*ecx),
|
||||
"=d" (*edx)
|
||||
: "0" (*eax), "2" (*ecx));
|
||||
}
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
unsigned eax, ebx, ecx, edx;
|
||||
|
||||
eax = 0x0000000B;
|
||||
ecx = 0x00000000;
|
||||
cpuid(&eax, &ebx, &ecx, &edx);
|
||||
|
||||
printf("Threads per core=%d\n", ebx & 0xF);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user