Using processor_info
Using processor_info
- Subject: Using processor_info
- From: Brad Post <email@hidden>
- Date: Fri, 15 Aug 2003 06:31:02 -0700
I'm trying to get some information on the processor using the mach
interfaces, and getting some weird results and wondering if anyone knows
why?
The function I am using is as follows:
kern_return_t get_host_processors(void)
{
kern_return_t result;
processor_array_t procArray;
mach_msg_type_number_t procCount;
processor_basic_info_data_t procInfo;
mach_msg_type_number_t infoSize;
host_t thisHost;
host_priv_t thisPrivHost;
unsigned long index;
thisHost = (host_t) host_self();
thisPrivHost = (host_priv_t) host_priv_self();
/*
* Host Processors
*/
result = host_processors(thisPrivHost, &procArray, &procCount);
printf("\nhost_processors result = x\n", result);
if (result == KERN_SUCCESS)
{
printf("size of procArray = x\n", procCount);
for (index = 0; index < procCount; index++)
{
infoSize = PROCESSOR_BASIC_INFO_COUNT;
result = processor_info( procArray[index],
PROCESSOR_BASIC_INFO,
&thisHost,
(processor_info_t) &procInfo,
&infoSize);
printf("\n processor_info result = x\n", result);
if (result == KERN_SUCCESS)
{
printf("procArray[ %ld ] = x\n", index,
(int)(procArray[index]));
printf("size of procInfo = x\n", infoSize);
printf("procInfo.slot_num = x\n", procInfo.slot_num);
printf("procInfo.is_master = x\n", procInfo.is_master);
}
}
}
return (result);
}
For some reason the call to processor info always returns 0, and a valid
infoSize, but all the data is always nil.
Thanks.
Brad
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.