Batch: CPU L2 Cache Detection

  • Thread starter Thread starter Unleaded Petrol
  • Start date Start date
U

Unleaded Petrol

As you probably know WinXP is notorious for detecting the amount of L2 cache
on the processor. Out of necessity, I have created two reg files to boost
the speed of the machines:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\MemoryManagement]
"SecondLevelDataCache"=dword:00000200

for 512K cache e.g. for AMD's barton processor and

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\MemoryManagement]
"SecondLevelDataCache"=dword:00000100

for 256K cache (most other modern CPUs)

How do I create a batch file to not only detect the CPU type, but to execute
the correct .reg file based on the detection. I'm not new to batch files,
but this one has my thinking cap on. Thanks.
 
Unleaded Petrol said:
As you probably know WinXP is notorious for detecting the amount of L2
cache on the processor. Out of necessity, I have created two reg files
to boost the speed of the machines:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\MemoryManagement]
"SecondLevelDataCache"=dword:00000200

for 512K cache e.g. for AMD's barton processor and

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\MemoryManagement]
"SecondLevelDataCache"=dword:00000100

for 256K cache (most other modern CPUs)

How do I create a batch file to not only detect the CPU type, but to
execute the correct .reg file based on the detection. I'm not new to
batch files, but this one has my thinking cap on. Thanks.
Hmmm, since you are posting unchanged from a.m.b, I think my suggestion
didn't work? If it was the german text you already got the tip from
markd to use the switches /c=us?
The Output is then:

C:\>ctcm7 /c=us /vid
PROCESSOR AND CACHE INFO c't 01/00/ Andreas Stiller V1.7a

Processor Timing : PPro,Pent-II
Processor CPUID : GenuineIntel Typ=00 Fam=06 Mod=06 Rev=05 Feat=0183F9FF
Processor Name : Celeron A (PGA)
Cache CPUID: DCache : 16 KByte,4way associative,32 Byte Cacheline
Cache CPUID: ICache : 16 KByte,4way associative,32 Byte Cacheline
Cache CPUID: UCache : 128 KByte,4way associative,32 Byte Cacheline
Actual clock rate : ca. 452.252 MHz
VESA-BIOS-Extension : not supported

virtual Mode :activ
#### Cache and transfer measurements not possible in virtual mode ###

Downloadlink again :<ftp://ftp.heise.de/pub/ct/ctsi/ctcm17a.zip>

It should be no problem with for /F "skip=7" %%A in etc..
to filter the UCache value. At the moment i have no time to wok it out.

hth
Matthias
 
Unleaded Petrol said:
As you probably know WinXP is notorious for detecting the amount of L2
cache on the processor. Out of necessity, I have created two reg files
to boost the speed of the machines: ....
How do I create a batch file to not only detect the CPU type, but to
execute the correct .reg file based on the detection. I'm not new to
batch files, but this one has my thinking cap on. Thanks.
I've got some time, so here is the batch. You may also extract some
other processor related info out of the file ctcm7.txt created by the batch.
If the names for your regfiles include the cachesize you can invoke
them directly with regname%Cache%.reg

hth
Matthias


@echo off & setlocal enableextensions
::batch expects ctcm7.exe to be in root of C: or in the path
::should be possible to put all this in 1 line in your batch
cd /D C:\
ctcm7 /c=us /Vid>ctcm7.txt
:: ********** concatenate the 2 following lines to one **************
for /F "usebackq tokens=4 delims=: " %%A in
(`find "UCache"^<ctcm7.txt`) do set Cache=%%A&&goto :DO%%A
:DO
echo Cache has diff Size (%Cache%)
goto :GoOn
:DO512
echo Whatever you want to do put here.(%Cache%)
goto :GoOn
:DO256
echo Whatever you want to do put here.(%Cache%)
:DO128
goto GoOn
echo Whatever you want to do put here.(%Cache%)
:GoOn
 
Thanks again Matthias, in fact the reason I posted here is because of your
suggestion :) Also, I did try that util but it does not display the amount
of L2 cache in bulk meaning that there is nothing to filter. So, I've
reverted to a manual method - crude but it seems to do the job - I just
thought there might be a more elegant method as it will beome more of an
issue with newer CPUs..

REM cpuz.exe - to show the amount of L2 Cache on the CPU via a GUI
cpuz.exe
ECHO CPU Cache Level Detector
ECHO ------------------------
ECHO 1 = Type 1 if you have 256K Level 2 Cache
ECHO 2 = Type 2 if you have 512K Level 2 Cache

QUERY Press your selection @12

IF ERRORLEVEL 2 GOTO C2
IF ERRORLEVEL 1 GOTO C1

:C1
cls
Regedit /s "system files\System Fixes\Thoroughbred.reg"
goto Main

:C2
cls
Regedit /s "system files\System Fixes\Barton.reg"
goto Main

----- Original Message -----
From: "Matthias Tacke" <[email protected]>
Newsgroups: microsoft.public.win2000.cmdprompt.admin
Sent: Monday, October 13, 2003 11:35 AM
Subject: Re: Batch: CPU L2 Cache Detection

Unleaded Petrol said:
As you probably know WinXP is notorious for detecting the amount of L2
cache on the processor. Out of necessity, I have created two reg files
to boost the speed of the machines:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\MemoryManagement]
"SecondLevelDataCache"=dword:00000200

for 512K cache e.g. for AMD's barton processor and

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\MemoryManagement]
"SecondLevelDataCache"=dword:00000100

for 256K cache (most other modern CPUs)

How do I create a batch file to not only detect the CPU type, but to
execute the correct .reg file based on the detection. I'm not new to
batch files, but this one has my thinking cap on. Thanks.
Hmmm, since you are posting unchanged from a.m.b, I think my suggestion
didn't work? If it was the german text you already got the tip from
markd to use the switches /c=us?
The Output is then:

C:\>ctcm7 /c=us /vid
PROCESSOR AND CACHE INFO c't 01/00/ Andreas Stiller V1.7a

Processor Timing : PPro,Pent-II
Processor CPUID : GenuineIntel Typ=00 Fam=06 Mod=06 Rev=05 Feat=0183F9FF
Processor Name : Celeron A (PGA)
Cache CPUID: DCache : 16 KByte,4way associative,32 Byte Cacheline
Cache CPUID: ICache : 16 KByte,4way associative,32 Byte Cacheline
Cache CPUID: UCache : 128 KByte,4way associative,32 Byte Cacheline
Actual clock rate : ca. 452.252 MHz
VESA-BIOS-Extension : not supported

virtual Mode :activ
#### Cache and transfer measurements not possible in virtual mode ###

Downloadlink again :<ftp://ftp.heise.de/pub/ct/ctsi/ctcm17a.zip>

It should be no problem with for /F "skip=7" %%A in etc..
to filter the UCache value. At the moment i have no time to wok it out.

hth
Matthias
Matthias Tacke said:
Unleaded Petrol said:
As you probably know WinXP is notorious for detecting the amount of L2
cache on the processor. Out of necessity, I have created two reg files
to boost the speed of the machines:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\MemoryManagement]
"SecondLevelDataCache"=dword:00000200

for 512K cache e.g. for AMD's barton processor and

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\MemoryManagement]
"SecondLevelDataCache"=dword:00000100

for 256K cache (most other modern CPUs)

How do I create a batch file to not only detect the CPU type, but to
execute the correct .reg file based on the detection. I'm not new to
batch files, but this one has my thinking cap on. Thanks.
Hmmm, since you are posting unchanged from a.m.b, I think my suggestion
didn't work? If it was the german text you already got the tip from
markd to use the switches /c=us?
The Output is then:

C:\>ctcm7 /c=us /vid
PROCESSOR AND CACHE INFO c't 01/00/ Andreas Stiller V1.7a

Processor Timing : PPro,Pent-II
Processor CPUID : GenuineIntel Typ=00 Fam=06 Mod=06 Rev=05 Feat=0183F9FF
Processor Name : Celeron A (PGA)
Cache CPUID: DCache : 16 KByte,4way associative,32 Byte Cacheline
Cache CPUID: ICache : 16 KByte,4way associative,32 Byte Cacheline
Cache CPUID: UCache : 128 KByte,4way associative,32 Byte Cacheline
Actual clock rate : ca. 452.252 MHz
VESA-BIOS-Extension : not supported

virtual Mode :activ
#### Cache and transfer measurements not possible in virtual mode ###

Downloadlink again :<ftp://ftp.heise.de/pub/ct/ctsi/ctcm17a.zip>

It should be no problem with for /F "skip=7" %%A in etc..
to filter the UCache value. At the moment i have no time to wok it out.

hth
Matthias
 
Unleaded Petrol said:
Thanks again Matthias, in fact the reason I posted here is because of your
suggestion :) Also, I did try that util but it does not display the amount
of L2 cache in bulk meaning that there is nothing to filter. So, I've
reverted to a manual method - crude but it seems to do the job - I just
thought there might be a more elegant method as it will beome more of an
issue with newer CPUs..
snip
I think the UCache line above _is_ the secondlevel cache.

It's also possible to filter the html file which cpuz generates.
So what line in the Output is relevant to you?

In an other thread I posted a complete batch with ctcm7. Did you test
that one?

hth
Matthias
 
Unleaded Petrol said:
As you probably know WinXP is notorious for detecting the amount of L2 cache
on the processor. Out of necessity, I have created two reg files to boost
the speed of the machines:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\MemoryManagement]
"SecondLevelDataCache"=dword:00000200

for 512K cache e.g. for AMD's barton processor and

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\MemoryManagement]
"SecondLevelDataCache"=dword:00000100

for 256K cache (most other modern CPUs)

How do I create a batch file to not only detect the CPU type, but to execute
the correct .reg file based on the detection. I'm not new to batch files,
but this one has my thinking cap on. Thanks.

May be you could read the CPU type from this reg value:-

HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0
ProcessorNameString

either by using regedit to export the key, or use REG.EXE (included
with XP). The output from either is easily parsed. If you have any
problems post again.
 
Richie,

That's a very good suggestion, but it would be difficult to associate clock
speed to L2 cache size. I must admit though, that's a facinating key for
fact finding without using a 3rd party util.

Unleaded Petrol

ps. Sincere apologies if my posts seem 'one post' out of date (slow ISP news
server).

Ritchie said:
As you probably know WinXP is notorious for detecting the amount of L2 cache
on the processor. Out of necessity, I have created two reg files to boost
the speed of the machines:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\MemoryManagement]
"SecondLevelDataCache"=dword:00000200

for 512K cache e.g. for AMD's barton processor and

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\MemoryManagement]
"SecondLevelDataCache"=dword:00000100

for 256K cache (most other modern CPUs)

How do I create a batch file to not only detect the CPU type, but to execute
the correct .reg file based on the detection. I'm not new to batch files,
but this one has my thinking cap on. Thanks.

May be you could read the CPU type from this reg value:-

HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0
ProcessorNameString

either by using regedit to export the key, or use REG.EXE (included
with XP). The output from either is easily parsed. If you have any
problems post again.
 
Cache CPUID: UCache : 128 KByte,4way associative,32 Byte Cacheline
I think the UCache line above _is_ the secondlevel cache.

Alas, every 3rd party util I have lists as 512K - the problem is that it may
in fact be too accurate for it's own good..
It's also possible to filter the html file which cpuz generates.
So what line in the Output is relevant to you?

CPU-Z Report

--------------------------------------------------------------------------

CPU-Z version 1.19a.


CPU(s)
Number of CPUs 1

Code Name Barton
Specification AMD Athlon(tm) XP 2600+
Family / Model / Stepping 6 A 0
Extended Family / Model 7 A
Core Stepping
Technology 0.13 µ
Supported Instructions Sets MMX, Extended MMX, 3DNow!, Extended
3DNow!, SSE
CPU Clock Speed 1921.3 MHz
Clock multiplier x 11.5
Front Side Bus Frequency 167.1 MHz
Bus Speed 334.1 MHz
L1 Data Cache 64 KBytes, 2-way set associative, 64 Bytes line
size
L1 Instruction Cache 64 KBytes, 2-way set associative, 64 Bytes
line size
L2 Cache 512 KBytes, 16-way set associative, 64 Bytes line size
L2 Speed 1921.3 MHz (Full)
L2 Location On Chip
L2 Data Prefetch Logic yes
L2 Bus Width 64 bits


The one marked 'L2 cache' - only problem with CPUZ is that to get the HTML
output, you have to navigate through the menus which sorta defeats the
object of an autodetection mechanism :)
In an other thread I posted a complete batch with ctcm7. Did you test
that one?

Surely did, as I mentioned in the previous post (which I'm sure is yet to
arrive - slow news server). I thought it a fantastic piece of code, the only
problem is that CTCM does not run in XP's command line - error 'cache and
transfer measurements not possible in virtual mode', but for pure DOS the
thing rocks!!
 
Unleaded Petrol said:
Alas, every 3rd party util I have lists as 512K - the problem is that it may
in fact be too accurate for it's own good..
CPU-Z Report

--------------------------------------------------------------------------

CPU-Z version 1.19a.


CPU(s)
Number of CPUs 1
(snip)
L2 Cache 512 KBytes, 16-way set associative, 64 Bytes line size
L2 Speed 1921.3 MHz (Full)
L2 Location On Chip
L2 Data Prefetch Logic yes
L2 Bus Width 64 bits


The one marked 'L2 cache' - only problem with CPUZ is that to get the HTML
output, you have to navigate through the menus which sorta defeats the
object of an autodetection mechanism :)

No, there is a commandline switch you have to use. Please read
the file cpuz-readme.txt!
=citation out of this file:
= -file=filename : Launch CPU-Z in ghost mode : no interface appears,
= the html file report (filename.htm) is created in the same directory
= as the exe file.
From the commandline enter
cpuz -file=cpuz.txt
The filtering of the correct line in that file which is messed up with
html tags is another task. Please check first if the Output from
ctcm7 is correct.
Surely did, as I mentioned in the previous post (which I'm sure is yet to
arrive - slow news server). I thought it a fantastic piece of code, the only
problem is that CTCM does not run in XP's command line - error 'cache and
transfer measurements not possible in virtual mode', but for pure DOS the
thing rocks!!
But the error message is only for the testing which isn't necessary for
the detection - simply ignore the line. The Output of the Cachesize
should remain the same!

As I see it, both ways are still possible. If the Cache-sizes which
are output don't fit with reality I have no solution as I can't
see the mistake.

hth
Matthias
 
Back
Top