This web mail archive is frozen.
This page is part of a frozen web archive of this mailing list.
You can still navigate around this archive, but know that no new mails
have been added to it since July of 2016.
Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.
On OS-X, you can get this string from the sysctlbyname() call:
const char *name = "machdep.cpu.brand_string";
char buffer[ 64 ];
size_t size = 64;
if( !sysctlbyname( name, buffer, &size, NULL, 0 ) )
memcpy( cpu_model, buffer, 12 * sizeof( int ) );
if That doesn't work, you can get it from calling system_profiler and
parsing the output.
On Widows (32 bit), the only way I've found is to actually use the cpuid
int ints[ 12 ];
// Use assembly to detect CPUID information...
; we must push/pop the registers <<CPUID>> writes to, as the
; optimiser doesn't know about <<CPUID>>, and so doesn't expect
; these registers to change.
; eax = 0x80000002 --> eax, ebx, ecx, edx: get processor name
string (part 1)
mov ints[ 0 * TYPE int ], eax
mov ints[ 1 * TYPE int ], ebx
mov ints[ 2 * TYPE int ], ecx
mov ints[ 3 * TYPE int ], edx
; eax = 0x80000003 --> eax, ebx, ecx, edx: get processor name
string (part 2)
mov ints[ 4 * TYPE int ], eax
mov ints[ 5 * TYPE int ], ebx
mov ints[ 6 * TYPE int ], ecx
mov ints[ 7 * TYPE int ], edx
; eax = 0x80000004 --> eax, ebx, ecx, edx: get processor name
string (part 3)
mov ints[ 8 * TYPE int ], eax
mov ints[ 9 * TYPE int ], ebx
mov ints[ 10 * TYPE int ], ecx
mov ints[ 11 * TYPE int ], edx
::memcpy( cpu_model, ints, 12 * sizeof( int ) );
I don't know if that would work on Win64, though. Do you think those
could be added to hwloc?
On 10/25/2012 2:42 PM, Brice Goglin wrote:
> Assuming you found the socket hwloc object whose name you want, do
> hwloc_obj_get_info_by_name(obj, "CPUModel");
> you'll get const char * pointing to what you want.
> However, this info is only available on Linux and Solaris for now. If
> you have any idea of to discover such info on other OS, please let us
> Le 25/10/2012 23:39, Robin Scher a écrit :
>> Is there a way to get this string (e.g. "Intel(R) Core(TM) i7 CPU M
>> 620 @ 2.67GHz") consistently on Windows, Linux, OS-X and Solaris?
>> *Robin Scher* Uberware
>> +1 (213) 448-0443
>> hwloc-users mailing list
> hwloc-users mailing list
*Robin Scher* Uberware
+1 (213) 448-0443