@@ -181,6 +181,7 @@ SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION PhCpuTotals;
181
181
ULONG PhTotalProcesses = 0 ;
182
182
ULONG PhTotalThreads = 0 ;
183
183
ULONG PhTotalHandles = 0 ;
184
+ ULONG PhTotalCpuQueueLength = 0 ;
184
185
185
186
PSYSTEM_PROCESS_INFORMATION PhDpcsProcessInformation = NULL ;
186
187
PSYSTEM_PROCESS_INFORMATION PhInterruptsProcessInformation = NULL ;
@@ -1843,17 +1844,20 @@ VOID PhpGetProcessThreadInformation(
1843
1844
_In_ PSYSTEM_PROCESS_INFORMATION Process ,
1844
1845
_Out_opt_ PBOOLEAN IsSuspended ,
1845
1846
_Out_opt_ PBOOLEAN IsPartiallySuspended ,
1846
- _Out_opt_ PULONG ContextSwitches
1847
+ _Out_opt_ PULONG ContextSwitches ,
1848
+ _Out_opt_ PULONG ReadyThreads
1847
1849
)
1848
1850
{
1849
1851
ULONG i ;
1850
1852
BOOLEAN isSuspended ;
1851
1853
BOOLEAN isPartiallySuspended ;
1852
1854
ULONG contextSwitches ;
1855
+ ULONG threadQueueCount ;
1853
1856
1854
1857
isSuspended = PH_IS_REAL_PROCESS_ID (Process -> UniqueProcessId );
1855
1858
isPartiallySuspended = FALSE;
1856
1859
contextSwitches = 0 ;
1860
+ threadQueueCount = 0 ;
1857
1861
1858
1862
for (i = 0 ; i < Process -> NumberOfThreads ; i ++ )
1859
1863
{
@@ -1867,6 +1871,11 @@ VOID PhpGetProcessThreadInformation(
1867
1871
isPartiallySuspended = TRUE;
1868
1872
}
1869
1873
1874
+ if (Process -> Threads [i ].ThreadState == Ready )
1875
+ {
1876
+ threadQueueCount ++ ;
1877
+ }
1878
+
1870
1879
contextSwitches += Process -> Threads [i ].ContextSwitches ;
1871
1880
}
1872
1881
@@ -1883,6 +1892,8 @@ VOID PhpGetProcessThreadInformation(
1883
1892
* IsPartiallySuspended = isPartiallySuspended ;
1884
1893
if (ContextSwitches )
1885
1894
* ContextSwitches = contextSwitches ;
1895
+ if (ReadyThreads )
1896
+ * ReadyThreads = threadQueueCount ;
1886
1897
}
1887
1898
1888
1899
VOID PhProcessProviderUpdate (
@@ -1953,6 +1964,7 @@ VOID PhProcessProviderUpdate(
1953
1964
PhTotalProcesses = 0 ;
1954
1965
PhTotalThreads = 0 ;
1955
1966
PhTotalHandles = 0 ;
1967
+ PhTotalCpuQueueLength = 0 ;
1956
1968
1957
1969
if (!NT_SUCCESS (PhEnumProcesses (& processes )))
1958
1970
return ;
@@ -2177,6 +2189,7 @@ VOID PhProcessProviderUpdate(
2177
2189
BOOLEAN isSuspended ;
2178
2190
BOOLEAN isPartiallySuspended ;
2179
2191
ULONG contextSwitches ;
2192
+ ULONG readyThreads ;
2180
2193
2181
2194
// Create the process item and fill in basic information.
2182
2195
processItem = PhCreateProcessItem (process -> UniqueProcessId );
@@ -2188,8 +2201,9 @@ VOID PhProcessProviderUpdate(
2188
2201
PhpAddProcessRecord (processRecord );
2189
2202
processItem -> Record = processRecord ;
2190
2203
2191
- PhpGetProcessThreadInformation (process , & isSuspended , & isPartiallySuspended , & contextSwitches );
2204
+ PhpGetProcessThreadInformation (process , & isSuspended , & isPartiallySuspended , & contextSwitches , & readyThreads );
2192
2205
PhpUpdateDynamicInfoProcessItem (processItem , process );
2206
+ PhTotalCpuQueueLength += readyThreads ;
2193
2207
2194
2208
// Initialize the deltas.
2195
2209
PhUpdateDelta (& processItem -> CpuKernelDelta , process -> KernelTime .QuadPart );
@@ -2249,13 +2263,15 @@ VOID PhProcessProviderUpdate(
2249
2263
BOOLEAN isSuspended ;
2250
2264
BOOLEAN isPartiallySuspended ;
2251
2265
ULONG contextSwitches ;
2266
+ ULONG readyThreads ;
2252
2267
FLOAT newCpuUsage ;
2253
2268
FLOAT kernelCpuUsage ;
2254
2269
FLOAT userCpuUsage ;
2255
2270
2256
- PhpGetProcessThreadInformation (process , & isSuspended , & isPartiallySuspended , & contextSwitches );
2271
+ PhpGetProcessThreadInformation (process , & isSuspended , & isPartiallySuspended , & contextSwitches , & readyThreads );
2257
2272
PhpUpdateDynamicInfoProcessItem (processItem , process );
2258
2273
PhpFillProcessItemExtension (processItem , process );
2274
+ PhTotalCpuQueueLength += readyThreads ;
2259
2275
2260
2276
// Update the deltas.
2261
2277
PhUpdateDelta (& processItem -> CpuKernelDelta , process -> KernelTime .QuadPart );
0 commit comments