Yes, for legacy reasons, many WIN32 APIs only support 32 processors. Newer ex versions exist to allow getting data for additional processors in many cases. As you have discovered, to maintain compatibility, those that don’t work on the current processor group
Sent from Surface Pro
From: xxxxx@gmail.com
Sent: Thursday, April 09, 2015 5:17 PM
To: Windows System Software Devs Interest List
Problem solved and case closed. I am surprised that this question has been asked by so many and no one has answered. Peter just the fact that there is some one to back you you up helps. Thanks! Here is the full solution. Please include powrprof.lib. I used VS2010 Ultimate for the compile and tested on a Windows Server 2012 R2 72 and 144 proc systems
*******************************************************
#include <windows.h>
#include <stdio.h>
#include <winioctl.h>
#include <intrin.h>
#include <powrprof.h>
typedef struct _PROCESSOR_POWER_INFORMATION {
ULONG Number;
ULONG MaxMhz;
ULONG CurrentMhz;
ULONG MhzLimit;
ULONG MaxIdleState;
ULONG CurrentIdleState;
} PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION;
int GetCurrentFreqPercentVista(HANDLE hThread, int noOfLogicalCores)
{
int RetVal;
PROCESSOR_POWER_INFORMATION ProcessorPowerInformation[36];
int FreqPercent = 0;
GROUP_AFFINITY ga;
memset(ProcessorPowerInformation, 0xFF, sizeof(ProcessorPowerInformation));
GetThreadGroupAffinity(hThread, &ga); // Confirmning the thread did get afdfinitized to the correct group
printf(“Getting power info of processors in Group %d\n”, ga.Group);
RetVal = CallNtPowerInformation(ProcessorInformation,
NULL,
0,
&ProcessorPowerInformation,
sizeof(PROCESSOR_POWER_INFORMATION) * noOfLogicalCores);
return RetVal;
}
void
main()
{
int grp;
HANDLE hThread;
GROUP_AFFINITY ga, pga;
int grCount = 4;
int procCount = 36;
ZeroMemory(&ga, sizeof(GROUP_AFFINITY));
ga.Mask = 0xFFFFFFFF;
hThread = GetCurrentThread();
for (grp = 0; grp < grCount; grp++) {
ga.Group = grp;
if (!SetThreadGroupAffinity(hThread, &ga, &pga)) {
printf(“SetThreadGroupAffinity failed!!\n”);
ExitProcess(1);
}
GetCurrentFreqPercentVista(hThread, procCount);
}
}
*******************************************
—
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</powrprof.h></intrin.h></winioctl.h></stdio.h></windows.h>