Changeset 11467 in vbox for trunk/src/VBox/Main
- Timestamp:
- Aug 18, 2008 2:52:12 PM (16 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HostImpl.cpp
r11258 r11467 2739 2739 pm::SubMetric *cpuLoadKernel = new pm::SubMetric ("CPU/Load/Kernel"); 2740 2740 pm::SubMetric *cpuLoadIdle = new pm::SubMetric ("CPU/Load/Idle"); 2741 pm::SubMetric *cpuMhzSM = new pm::SubMetric ("CPU/MHZ"); 2741 2742 pm::SubMetric *ramUsageTotal = new pm::SubMetric ("RAM/Usage/Total"); 2742 2743 pm::SubMetric *ramUsageUsed = new pm::SubMetric ("RAM/Usage/Used"); … … 2750 2751 cpuLoadIdle); 2751 2752 aCollector->registerBaseMetric (cpuLoad); 2753 pm::BaseMetric *cpuMhz = 2754 metricFactory->createHostCpuMHz (objptr, cpuMhzSM); 2755 aCollector->registerBaseMetric (cpuMhz); 2752 2756 pm::BaseMetric *ramUsage = 2753 2757 metricFactory->createHostRamUsage (objptr, ramUsageTotal, ramUsageUsed, … … 2777 2781 new pm::AggregateMin())); 2778 2782 aCollector->registerMetric (new pm::Metric(cpuLoad, cpuLoadIdle, 2783 new pm::AggregateMax())); 2784 2785 aCollector->registerMetric (new pm::Metric(cpuMhz, cpuMhzSM, 0)); 2786 aCollector->registerMetric (new pm::Metric(cpuMhz, cpuMhzSM, 2787 new pm::AggregateAvg())); 2788 aCollector->registerMetric (new pm::Metric(cpuMhz, cpuMhzSM, 2789 new pm::AggregateMin())); 2790 aCollector->registerMetric (new pm::Metric(cpuMhz, cpuMhzSM, 2779 2791 new pm::AggregateMax())); 2780 2792 -
trunk/src/VBox/Main/Makefile.kmk
r11086 r11467 276 276 VBoxSVC_SOURCES.win += win/PerformanceWin.cpp 277 277 VBoxSVC_LDFLAGS.solaris += -lkstat 278 VBoxSVC_LDFLAGS.win += wbemuuid.lib 278 VBoxSVC_LDFLAGS.win += wbemuuid.lib powrprof.lib 279 279 endif 280 280 -
trunk/src/VBox/Main/testcase/Makefile.kmk
r11086 r11467 113 113 tstCollector_INCS = ../include 114 114 tstCollector_LDFLAGS.solaris += -lkstat 115 tstCollector_LDFLAGS.win += wbemuuid.lib 115 tstCollector_LDFLAGS.win += wbemuuid.lib powrprof.lib 116 116 117 117 -
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.