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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Processor cache level 2 missreported...

Status
Not open for further replies.

BogdanMBM

Programmer
Aug 6, 2003
213
RO
Hy guys!
I'm using the following (piece of) code to retrive cache level 2 size of the processor.

Code:
Dim cpuSet As SWbemObjectSet
   Dim cpu As SWbemObject
   Set cpuSet = GetObject("winmgmts:{impersonationLevel=impersonate}"). _
                           InstancesOf("Win32_Processor")

For Each cpu In cpuSet
   txtCPULevel2Cache.Text = cpu.L2CacheSize
Next
This works just great on several AMD machines I've testit but, strangely, doesn't work on Intel...
The problem is that on some systems (Intel P4 2 GHz.) the reported value is 0. How come?
Any ideas?
Thanks!
 
Hi Bogdan,

As far as I know this is how the Level 2 Cache is recorded in the registry:

Level 2 Cache Value Data setting
256 KB ... 0
512 KB ... 200
1024 KB ... 400

So in theory you getting a 256KB Level 2 Cache with the returned value of '0'

Hope this helps

Harleyquinn
 
Thanks for the reply. Hmmm...
But at home I've tested it on AMD machines and it returned the correct (actual) value of tha cache (that is not 0, 200 or 400, but the actual value).
Microsoft (at states that the return value for L2CacheLevel) states (and I quote):
"L2CacheSize
Data type: uint32
Access type: Read-only
Qualifiers: Units(Kilobytes)"

So the problem should reside somwhere else, but I don't know where...
Any ideas?
 
Oh, and I must add that when I tested it on a laptop with Intel P4 at 1.5 GHz, the code returned the exact value for the L2CacheSize, but nothing (and I meen "nothing", not "0") for L2CacheSpeed. That's realy stupid :( I meen, it's one thing to return "0" (can't verify if cache level 2 was disabled from bios, cause I'm not admin on that machine) for L2CacheSize (with obveously none for speed) but another (silly) thing to return 256 K for L2CacheSize and nothing for speed...
 
It's Win XP (I know it works only on Win 2000 pro, NT 4 SP 4 or XP).
OK, I have to mention that back home I have WinXP SP2.
At the office only WinXP SP1. Could this be the issue?...
 
I'm using XP SP1 and it is giving me the '0' L2CacheSize as well.

Trying to find another machine to test out your SP1 and SP2 theory...

Harleyquinn
 
Hmm... Seems that it's not related (only?!?) to SP1/SP2, 'cause on the laptop I also have SP1 and it returns 1024 for cache 2, soo...
 
Have just got similar results...

PC1:

P4 1.9GHz XP SP1 - Returns L2 CacheSize Correctly

PC2:

P4 3.0GHz XP SP2 - Returns L2 CacheSize Correctly.

My machine (as detailed before still shows the '0' value...

Harleyquinn
 
Phah...
So what is going on here? :(
Is this implementation from Microsoft dependent of the position of the Sun? :)
 
That might well be it... :)

Tell you what though, I'll be over the moon if someone can tell us why?/how? this is happening and how to get round it...

Harleyquinn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top