Hi again.

I’m trying to use hwloc 1.8 on Windows, Linux and Mac to get the CPU model 
string (e.g., “Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz”). Since hwloc on 
different platforms seem to stash this in different objects, I’m using code 
like this:

String name;
hwloc_obj_type_t objs[] = { 
    HWLOC_OBJ_MACHINE, 
    HWLOC_OBJ_SOCKET, 
    HWLOC_OBJ_CORE, 
    HWLOC_OBJ_PU, };
for( size_t index = 0; index < (sizeof( objs ) / sizeof( hwloc_obj_type_t )) && 
name.Empty(); ++index )
{
    hwloc_obj_t obj = hwloc_get_obj_by_type( topology, objs[ index ], 0 );
    if( !obj ) continue;
    const char *str = hwloc_obj_get_info_by_name( obj, "CPUModel" );
    if( str ) name = String( str ).Trim();
}

On Mac, it works (found string at HWLOC_OBJ_MACHINE), and on Linux it works 
(found string at HWLOC_OBJ_SOCKET), but on Windows x64, none of these find the 
string. They all return a NULL pointer.

Am I missing something? I tried a few other of the object types, but didn’t 
find it with them either (I actually tried looping through all integer values 
between 0 and HWLOC_OBJ_TYPE_MAX and it didn’t appear in any of them).

Thank you for any help you can provide.
-robin

Robin Scher
ro...@uberware.net
+1 (213) 448-0443



Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to