Anyone with a cpu...

Pages: 12
Could anyone with any CPU (preferably non-IA64 because that's what I have), particularly AMD, test this code for me please? It should work on any OS that has a standard C compiler and an x86 or x64 CPU (works on my IA64 to a degree; I don't know which cpuid specification to follow -- Intel's or AMDs? AMD's makes more sense...).

Could you run the code and then post the output?
I compiled with
gcc -O3 -Os -fexpensive-optimizations -o cpuid cpuid.c docpuid.c

which produced an 8.6KiB executable file. On windows add .exe to the end of "-o cpuid".

Weirdly enough, without -Os (optimize size) the executable is 8.5KiB instead...

Thanks.
Last edited on
--old code--
Last edited on
--old code--
Last edited on
Almost works for me, just had to change #ifndef _Win32 to #ifndef _WIN32
It ran on Windows XP with Mingw.
output :
General information:
	Manufacturer:  Intel
	Vendor string: GenuineIntel
	Brand string:  Intel(R) Core(TM)2 Duo CPU     E7300  @ 2.66GHz
Model information:
	Stepping: 8398
	Model:    524
	Family:   32
CPU information:
	Cache: L1: 0 KiB	L2: 3072 KiB	L3: 0 KiB
Hm. Your stepping, model and family, are the same as mine.

Here's the output for me:
General information:
	Manufacturer:  Intel
	Vendor string: GenuineIntel
	Brand string:  Intel(R) Core(TM)2 Quad  CPU   Q8200  @ 2.33GHz
Model information:
	Stepping: 8398
	Model:    524
	Family:   32
CPU information:
	Cache: L1: 0 KiB	L2: 0 KiB	L3: 0 KiB


I need someone with a different manufacturer... I want to see what's causing the stepping, model and family. I don't think they're right.

For some reason I don't get any L2 cache :( obviously the cache stuff is wrong.


Thank you for helping :)
Last edited on
closed account (z05DSL3A)
General information:
	Manufacturer:  Intel
	Vendor string: GenuineIntel
	Brand string:  Intel(R) Core(TM)2 Duo CPU     T9900  @ 3.06GHz
Model information:
	Stepping: 8399
	Model:    524
	Family:   32
CPU information:
	Cache: L1: 0 KiB	L2: 6144 KiB	L3: 0 KiB

This is really weird.
All in all I think it's sort of working in places. The manufacturer, vendor string and brand string are working fine; but the rest of the stuff is wrong.

Thanks :)

And how come everyone gets L2 cache but me?
General information:
        Manufacturer:  Intel
        Vendor string: GenuineIntel
        Brand string:  Intel(R) Core(TM)2 Duo CPU     T8300  @ 2.40GHz
Model information:
        Stepping: 8398
        Model:    524
        Family:   32
CPU information:
        Cache: L1: 0 KiB        L2: 3072 KiB    L3: 0 KiB
Why have so many people got Core 2 Duos?

Thanks
closed account (z05DSL3A)
Maybe this will help: (not with the Core 2 question :0) )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <stdio.h>

struct cpuid_type {
    unsigned int eax;
    unsigned int ebx;
    unsigned int ecx;
    unsigned int edx;
};
typedef struct cpuid_type cpuid_t;

cpuid_t cpuid(unsigned int number) 
{
    cpuid_t result; 
    
    asm("movl %4, %%eax; cpuid; movl %%eax, %0; movl %%ebx, %1; movl %%ecx, %2; movl %%edx, %3;"
        : "=m" (result.eax),
          "=m" (result.ebx),
          "=m" (result.ecx),
          "=m" (result.edx)               /* output */
        : "r"  (number)                   /* input */
        : "eax", "ebx", "ecx", "edx"      /* no changed registers except output registers */
        );

    return result;
}    

int main (int argc, const char * argv[]) 
{
    cpuid_t cpuid_registers;
    unsigned int cpu_family, cpu_model, cpu_stepping;
    
    cpuid_registers = cpuid(1);
    
    cpu_family   = 0xf & (cpuid_registers.eax>>8);
    cpu_model    = 0xf & (cpuid_registers.eax>>4);
    cpu_stepping = 0xf & cpuid_registers.eax;
    
    printf("CPUID (1): CPU is a %u86, Model %u, Stepping %u\n",
	       cpu_family, cpu_model, cpu_stepping);
    
    
    return 0;
}

CPUID (1): CPU is a 686, Model 7, Stepping 10
Last edited on
Lol, thanks. That is helpful; thanks.
Cool!
1
2
3
4
5
6
7
8
9
10
General information:
        Manufacturer:  Intel
        Vendor string: GenuineIntel
        Brand string:                Intel(R) Pentium(R) 4 CPU 3.00GHz
Model information:
        Stepping: 488
        Model:    30
        Family:   1
CPU information:
        Cache: L1: 0 KiB        L2: 2048 KiB    L3: 0 KiB


[quote]CPUID (1): CPU is a 1586, Model 4, Stepping 3
Last edited on
I've played around with it a bit; took Grey Wolf's advice on the stepping, model and family; and figured out how to get the clock frequency (messing around with rdtsc. My internet connection was down (I'm on a laptop using wi-fi, so that's natural) so I had to figure it out myself. It's actually more accurate than I thought it would be -- the laptop has a 1.73 GHz Celeron M; I get values from about 1.69 to 1.82 GHz).

Anyway; I have uploaded the program here: http://www.mediafire.com/?wm4zknu5mvz

At the moment there's a pre-compiled windows executable only as I can't install Linux on this laptop.
Last edited on
General information:
        Manufacturer:  AMD
        Vendor string: AuthenticAMD
        Brand string:   AMD Phenom <tm> 9650 Quad-Core Processor
Model information:
        Stepping: 3
        Model:    3
        Family:   1586
CPU information:
        Cache: L1: 0 KiB        L2: 0 KiB    L3: 2048 KiB
        Frequency: 2310MHz
Ahhh... thanks. I was hoping someone with an AMD processor would arrive :)

Phenom, eh? I'm hoping to get a Phenom II; the 965 socket AM3 one. I'm gonna wait though; because I don't think DDR3 RAM is worth it yet.

For some reason; on my precompiled Linux executable the Frequency is 0. But if I run the Windows one in Wine I get a value. Looks like I have a fairly large amount of bugs to fix.
Last edited on
The non-conformist! Ha no to be honest I was after an Intel but this was how it fell but it's still a great computer!

Also, what the hell is stepping lol?
I prefer AMD myself. Swap?

Stepping?
Stepping is a designation used by Intel and AMD (or any semiconductor manufacturer[citation needed]) to identify how much the design of a microprocessor has advanced from the original design. The stepping is identified by a combination of a letter and a number.


(1386)

Well that's ironic.
Last edited on
After some Intels, now is time for some AMDs
I've tested your program on another computer:
General information:
	Manufacturer:  AMD
	Vendor string: AuthenticAMD
	Brand string:  AMD Athlon(tm) XP 2400+
Model information:
	Stepping: 1
	Model:    8
	Family:   686
CPU information:
	Cache: L1: 0 KiB	L2: 0 KiB	L3: 0 KiB
	Frequency: 2024 MHz

Thanks :)
Damn that is old school!
Pages: 12