CPU infos

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
AlfaOmega08
Member
Member
Posts: 226
Joined: Wed Nov 07, 2007 12:15 pm
Location: Italy

CPU infos

Post by AlfaOmega08 »

Can anyone tells me how to read some infos from the cpu such as the usage percentage, or the temperature?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

ACPI. Or whatever special interface the specific CPU family you are thinking of supports...
Every good solution is obvious once you've found it.
User avatar
Wave
Member
Member
Posts: 50
Joined: Sun Jan 20, 2008 5:51 am

Post by Wave »

You can't read usage percentage. You will have to calculate that yourself.
Conway's Law: If you have four groups working on a compiler, you'll get a 4-pass compiler.
Melvin Conway
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

Post by lukem95 »

You can get CPU model by using the CPUID asm command...

Code: Select all

static void newcpuid(unsigned long op, unsigned long v[4])
{
__asm__ ("cpuid": "=a" (v[0]), "=b" (v[1]), "=c" (v[2]), "=d" (v[3]):"a" (op));
}
~ Lukem95 [ Cake ]
Release: 0.08b
Image
Post Reply