Changeset 56457 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Jun 16, 2015 4:03:13 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceStats.cpp
r56390 r56457 214 214 215 215 /* Unfortunately GetSystemTimes is XP SP1 and up only, so we need to use the semi-undocumented NtQuerySystemInformation */ 216 bool fCpuInfoAvail = false; 216 217 NTSTATUS rc = gCtx.pfnNtQuerySystemInformation(SystemProcessorPerformanceInformation, pProcInfo, cbStruct, &cbReturned); 217 218 if ( !rc 218 219 && cbReturned == cbStruct) 219 220 { 220 for (uint32_t i = 0; i < systemInfo.dwNumberOfProcessors && i < VMM_MAX_CPU_COUNT; i++) 221 { 221 for (uint32_t i = 0; i < systemInfo.dwNumberOfProcessors; i++) 222 { 223 if (i >= VMM_MAX_CPU_COUNT) 224 { 225 VBoxServiceVerbose(3, "VBoxStatsReportStatistics: skipping information for CPU%u\n", i); 226 continue; 227 } 228 222 229 if (gCtx.au64LastCpuLoad_Kernel[i] == 0) 223 230 { … … 246 253 247 254 req.guestStats.u32StatCaps |= VBOX_GUEST_STAT_CPU_LOAD_IDLE | VBOX_GUEST_STAT_CPU_LOAD_KERNEL | VBOX_GUEST_STAT_CPU_LOAD_USER; 248 249 gCtx.au64LastCpuLoad_Idle[i] = pProcInfo[i].IdleTime.QuadPart;250 gCtx.au64LastCpuLoad_Kernel[i] = pProcInfo[i].KernelTime.QuadPart;251 gCtx.au64LastCpuLoad_User[i] = pProcInfo[i].UserTime.QuadPart;252 }253 }254 RTMemFree(pProcInfo);255 256 for (uint32_t i = 0; i < systemInfo.dwNumberOfProcessors; i++)257 {258 if (i < VMM_MAX_CPU_COUNT)259 {260 255 req.guestStats.u32CpuId = i; 261 256 rc = VbglR3StatReport(&req); … … 264 259 else 265 260 VBoxServiceVerbose(3, "VBoxStatsReportStatistics: DeviceIoControl (stats report) failed with %d\n", GetLastError()); 266 } 267 else 268 VBoxServiceVerbose(3, "VBoxStatsReportStatistics: skipping information for CPU%u\n", i); 261 262 gCtx.au64LastCpuLoad_Idle[i] = pProcInfo[i].IdleTime.QuadPart; 263 gCtx.au64LastCpuLoad_Kernel[i] = pProcInfo[i].KernelTime.QuadPart; 264 gCtx.au64LastCpuLoad_User[i] = pProcInfo[i].UserTime.QuadPart; 265 } 266 } 267 RTMemFree(pProcInfo); 268 269 if (!fCpuInfoAvail) 270 { 271 VBoxServiceVerbose(3, "VBoxStatsReportStatistics: CPU info not available!\n"); 272 rc = VbglR3StatReport(&req); 269 273 } 270 274
Note:
See TracChangeset
for help on using the changeset viewer.