@@ -2074,6 +2074,19 @@ VOID PhpEstimateIdleCyclesForARM(
2074
2074
)
2075
2075
{
2076
2076
// EXPERIMENTAL (jxy-s)
2077
+ //
2078
+ // Update (9/29/2024) - 24H2 is now estimating the cycle counts for idle threads in the kernel
2079
+ // making this routine obsolete. However, this means that the idle thread cycle counts returned
2080
+ // from the kernel is not a reflection of the actual CPU effort of the idle threads. In other
2081
+ // words the idle threads now represent the percentage of the CPU *not* being used by other
2082
+ // processes, as it does on other architectures. The kernel has also broadly changed the cycle
2083
+ // accounting across the entire system to no longer use PMCCNTR_EL0 and instead it uses
2084
+ // KeQueryPerformanceCounter. This means it is currently impossible to represent the cycle
2085
+ // accounting in a way best suited for the ARM architecture. The kernel appears to have opted
2086
+ // for more consistency between architectures instead of accuracy for ARM.
2087
+ //
2088
+ assert (WindowsVersion < WINDOWS_11_24H2 );
2089
+
2077
2090
//
2078
2091
// The kernel uses PMCCNTR_EL0 for CycleTime in threads and the processor control blocks.
2079
2092
// Here is a snippet from ntoskrnl!KiIdleLoop:
@@ -2279,7 +2292,7 @@ VOID PhProcessProviderUpdate(
2279
2292
pidBuckets [bucketIndex ] = process ;
2280
2293
2281
2294
#ifdef _ARM64_ // see: PhpEstimateIdleCyclesForARM (jxy-s)
2282
- if (PhEnableCycleCpuUsage && process -> UniqueProcessId != SYSTEM_IDLE_PROCESS_ID )
2295
+ if (PhEnableCycleCpuUsage && ( WindowsVersion >= WINDOWS_11_24H2 || process -> UniqueProcessId != SYSTEM_IDLE_PROCESS_ID ) )
2283
2296
#else
2284
2297
if (PhEnableCycleCpuUsage )
2285
2298
#endif
@@ -2434,7 +2447,7 @@ VOID PhProcessProviderUpdate(
2434
2447
}
2435
2448
2436
2449
#ifdef _ARM64_
2437
- if (PhEnableCycleCpuUsage )
2450
+ if (PhEnableCycleCpuUsage && WindowsVersion < WINDOWS_11_24H2 )
2438
2451
PhpEstimateIdleCyclesForARM (& sysTotalCycleTime , & sysIdleCycleTime );
2439
2452
#endif
2440
2453
0 commit comments