MiComputeAgeDistribution
UINT16 __stdcall MiComputeAgeDistribution(_MI_PARTITION *Partition, UINT64 Recompute){
int v2;
_QWORD *WorkingSetControl;
_BYTE *v5;
_QWORD *i;
_QWORD *v7;
__int64 v8;
unsigned __int64 v9;
unsigned int v10;
int v11;
unsigned __int64 v12;
unsigned __int64 v13;
_KLOCK_QUEUE_HANDLE LockHandle;
UINT64 ClaimDistribution[8];
v2 = Recompute;
memset(&LockHandle, 0, sizeof(LockHandle));
memset(ClaimDistribution, 0i64, sizeof(ClaimDistribution));
WorkingSetControl = Partition->WorkingSetControl;
if( v2 == 1 )
{
KeAcquireInStackQueuedSpinLock((PKSPIN_LOCK)&stru_140C4DB30 + 522, &LockHandle);
v5 = Partition->gap1AC8;
for( i = *(_QWORD **)v5; i != (_QWORD *)v5; i = (_QWORD *)*i )
MiUpdateClaimDistribution((_MMSUPPORT_INSTANCE *)(i - 3), ClaimDistribution);
memmove(WorkingSetControl + 302, ClaimDistribution, 0x40u);
v7 = WorkingSetControl + 308;
v8 = 2i64;
v9 = 0i64;
do
{
v9 += *v7++;
--v8;
}
while( v8 );
WorkingSetControl[301] = v9;
KeReleaseInStackQueuedSpinLockFromDpcLevel(&LockHandle);
__writecr8(LockHandle.OldIrql);
}
else
{
v9 = WorkingSetControl[301];
}
v10 = 5;
v11 = 0;
while( v9 < 4i64 * WorkingSetControl[298] )
{
++v11;
v9 += WorkingSetControl[v10 + 302];
if( v10 == 1 )
break;
--v10;
}
v12 = WorkingSetControl[294];
if( v12 )
{
v13 = (unsigned int)(1000 * v11) / v12;
if( (unsigned __int16)v13 > 0x3E8u )
LOWORD(v13) = 1000;
return v13;
}
else if( v11 )
{
return 1000;
}
else
{
return 0;
}
}Referenced by:
MiComputeSystemTrimCriteria
MiOrderTrimList