Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access to CPU status

Status
Not open for further replies.

Reuel

Programmer
Dec 27, 2004
45
0
0
US
I'm making a status monitor for my laptop. I found code for the battery, but now I need to see the current CPU temperature and clock speed. Help!

 
Mmm ...

I think I'd use WMI's Win32_Processor class top get this info
 
I think WMI's Win32_Processor class has what I need. How do I get it?

Thanks!

 
Code:
[blue]Public Sub Demo()
    Dim CPU As Object
    Dim computer As String
    
    computer = "."
    For Each CPU In GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & computer & "\root\cimv2").InstancesOf("Win32_Processor")
        Debug.Print CPU.deviceid, CPU.Loadpercentage & "%"
    Next
End Sub[/blue]
 
So far, nothing here shows me the clock speed or temperature, but I think I can find the WMI class list, which I'm assuming lists other specs on the CPU. Thanks for pointing me in the right direction!
 
Ok, I just tried it. It gives me 1994 as the clock speed, no matter what, and 22 as the voltage (2.2v) no matter what. I'm guessing that Microsoft isn't asking the BIOS the right questions.
 
For reference, Microsoft's WMI page is
Code samples can be found at
Now, strongm's code will always look at the machine on which the code is running, due to the line [tt]computer = "."[/tt]. If all you're evaluating is one single-processor machine, why are you expecting the clock speed and the voltage to vary? I don't claim to be an expert in processor hardware, but as far as I know, the clock speed is a constant in any given processor.

Bob
 
I am running this on a laptop. At this moment, the processor is running at 798MHz (FID=4). When demand on the processor goes up, it steps up to 1994MHz (FID=10). RightMark CPU Clock Utility shows a graph of the FID and VID. FID is Frequency ID, and VID is Voltage ID.

I tweaked voltages to the point that the CPU doesn't crash, but voltages are lower than advertised, making the CPU run cooler and making the battery last longer.

I went through Microsoft's stuff, and found all I need, but discovered that the correct commands only bring up the maximum CPU speed and a voltage that isn't even listed as being an option for this processor (2.2v).
 
Actually, it is probably the manufacturer who is not bothering to correctly fill in the fields queried by WMI rather than WMI asking the wrong questions
 
Well, that answers my question. :) Sorry, your guesses are as good as mine then.
 
In either case, I'm still hunting. Maybe I'll just find some freeware CPU monitors and ask the programmer how he did it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top