Lines Matching defs:gCtx

81 static VBOXSTATSCONTEXT gCtx = {0};
95 gCtx.cMsStatInterval = 0; /* default; update disabled */
96 RT_ZERO(gCtx.au64LastCpuLoad_Idle);
97 RT_ZERO(gCtx.au64LastCpuLoad_Kernel);
98 RT_ZERO(gCtx.au64LastCpuLoad_User);
99 RT_ZERO(gCtx.au64LastCpuLoad_Nice);
101 rc = VbglR3StatQueryInterval(&gCtx.cMsStatInterval);
103 VBoxServiceVerbose(3, "VBoxStatsInit: New statistics interval %u seconds\n", gCtx.cMsStatInterval);
110 *(void **)&gCtx.pfnNtQuerySystemInformation = RTLdrGetSystemSymbol("ntdll.dll", "NtQuerySystemInformation");
111 if (gCtx.pfnNtQuerySystemInformation)
112 VBoxServiceVerbose(3, "VBoxStatsInit: gCtx.pfnNtQuerySystemInformation = %x\n", gCtx.pfnNtQuerySystemInformation);
120 *(void **)&gCtx.pfnGlobalMemoryStatusEx = RTLdrGetSystemSymbol("kernel32.dll", "GlobalMemoryStatusEx");
121 if (gCtx.pfnGlobalMemoryStatusEx)
122 VBoxServiceVerbose(3, "VBoxStatsInit: gCtx.GlobalMemoryStatusEx = %x\n", gCtx.pfnGlobalMemoryStatusEx);
131 *(void **)&gCtx.pfnGetPerformanceInfo = RTLdrGetSystemSymbol("psapi.dll", "GetPerformanceInfo");
132 if (gCtx.pfnGetPerformanceInfo)
133 VBoxServiceVerbose(3, "VBoxStatsInit: gCtx.pfnGetPerformanceInfo= %x\n", gCtx.pfnGetPerformanceInfo);
152 Assert(gCtx.pfnGlobalMemoryStatusEx && gCtx.pfnNtQuerySystemInformation);
153 if ( !gCtx.pfnGlobalMemoryStatusEx
154 || !gCtx.pfnNtQuerySystemInformation)
166 gCtx.pfnGlobalMemoryStatusEx(&memStatus);
186 if (gCtx.pfnGetPerformanceInfo)
190 if (gCtx.pfnGetPerformanceInfo(&perfInfo, sizeof(perfInfo)))
216 NTSTATUS rc = gCtx.pfnNtQuerySystemInformation(SystemProcessorPerformanceInformation, pProcInfo, cbStruct, &cbReturned);
220 if (gCtx.au64LastCpuLoad_Kernel == 0)
223 gCtx.au64LastCpuLoad_Idle[0] = pProcInfo->IdleTime.QuadPart;
224 gCtx.au64LastCpuLoad_Kernel[0] = pProcInfo->KernelTime.QuadPart;
225 gCtx.au64LastCpuLoad_User[0] = pProcInfo->UserTime.QuadPart;
229 rc = gCtx.pfnNtQuerySystemInformation(SystemProcessorPerformanceInformation, pProcInfo, cbStruct, &cbReturned);
233 uint64_t deltaIdle = (pProcInfo->IdleTime.QuadPart - gCtx.au64LastCpuLoad_Idle[0]);
234 uint64_t deltaKernel = (pProcInfo->KernelTime.QuadPart - gCtx.au64LastCpuLoad_Kernel[0]);
235 uint64_t deltaUser = (pProcInfo->UserTime.QuadPart - gCtx.au64LastCpuLoad_User[0]);
247 gCtx.au64LastCpuLoad_Idle[0] = pProcInfo->IdleTime.QuadPart;
248 gCtx.au64LastCpuLoad_Kernel[0] = pProcInfo->KernelTime.QuadPart;
249 gCtx.au64LastCpuLoad_User[0] = pProcInfo->UserTime.QuadPart;
378 uint64_t u64DeltaIdle = u64Idle - gCtx.au64LastCpuLoad_Idle[u32CpuId];
379 uint64_t u64DeltaSystem = u64System - gCtx.au64LastCpuLoad_Kernel[u32CpuId];
380 uint64_t u64DeltaUser = u64User - gCtx.au64LastCpuLoad_User[u32CpuId];
381 uint64_t u64DeltaNice = u64Nice - gCtx.au64LastCpuLoad_Nice[u32CpuId];
390 gCtx.au64LastCpuLoad_Idle[u32CpuId] = u64Idle;
391 gCtx.au64LastCpuLoad_Kernel[u32CpuId] = u64System;
392 gCtx.au64LastCpuLoad_User[u32CpuId] = u64User;
393 gCtx.au64LastCpuLoad_Nice[u32CpuId] = u64Nice;
536 uint64_t u64DeltaIdle = u64Idle - gCtx.au64LastCpuLoad_Idle[cCPUs];
537 uint64_t u64DeltaSystem = u64System - gCtx.au64LastCpuLoad_Kernel[cCPUs];
538 uint64_t u64DeltaUser = u64User - gCtx.au64LastCpuLoad_User[cCPUs];
544 gCtx.au64LastCpuLoad_Idle[cCPUs] = u64Idle;
545 gCtx.au64LastCpuLoad_Kernel[cCPUs] = u64System;
546 gCtx.au64LastCpuLoad_User[cCPUs] = u64User;
621 VbglR3StatQueryInterval(&gCtx.cMsStatInterval);
624 if (gCtx.cMsStatInterval)
627 cWaitMillies = gCtx.cMsStatInterval;