Changeset 11467 in vbox for trunk/src/VBox/Main/win
- Timestamp:
- Aug 18, 2008 2:52:12 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 34921
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/win/PerformanceWin.cpp
r11180 r11467 23 23 24 24 #include <Wbemidl.h> 25 extern "C" { 26 #include <powrprof.h> 27 } 25 28 #include <iprt/err.h> 29 #include <iprt/mp.h> 26 30 27 31 #include "Logging.h" … … 334 338 } 335 339 340 typedef struct _PROCESSOR_POWER_INFORMATION { 341 ULONG Number; 342 ULONG MaxMhz; 343 ULONG CurrentMhz; 344 ULONG MhzLimit; 345 ULONG MaxIdleState; 346 ULONG CurrentIdleState; 347 } PROCESSOR_POWER_INFORMATION , *PPROCESSOR_POWER_INFORMATION; 348 336 349 int CollectorWin::getHostCpuMHz(ULONG *mhz) 337 350 { 338 return VERR_NOT_IMPLEMENTED; 351 uint64_t uTotalMhz = 0; 352 RTCPUID nProcessors = RTMpGetCount(); 353 PPROCESSOR_POWER_INFORMATION ppi = new PROCESSOR_POWER_INFORMATION[nProcessors]; 354 LONG ns = CallNtPowerInformation(ProcessorInformation, NULL, 0, ppi, 355 nProcessors * sizeof(PROCESSOR_POWER_INFORMATION)); 356 if (ns) 357 { 358 Log(("CallNtPowerInformation() -> %x\n", ns)); 359 return VERR_INTERNAL_ERROR; 360 } 361 362 /* Compute an average over all CPUs */ 363 for (unsigned i = 0; i < nProcessors; i++) 364 uTotalMhz += ppi[i].CurrentMhz; 365 *mhz = (ULONG)(uTotalMhz / nProcessors); 366 367 LogFlowThisFunc(("mhz=%u\n", *mhz)); 368 LogFlowThisFuncLeave(); 369 370 return VINF_SUCCESS; 339 371 } 340 372
Note:
See TracChangeset
for help on using the changeset viewer.