+void MM_DumpStatistics(void)
+{
+ int i, pg;
+ for( i = 1; i < numAddrClasses; i ++ )
+ {
+ int first = (i == 1 ? 0 : (1UL << (addrClasses[i-1] - 12)));
+ int last = (1UL << (addrClasses[i] - 12)) - 1;
+ int nFree = 0;
+ int nMultiRef = 0;
+ int totalRefs = 0;
+
+ if( last > giPageCount )
+ last = giPageCount;
+
+ int total = last - first + 1;
+
+ for( pg = first; pg < last; pg ++ )
+ {
+ if( !MM_GetPhysAddr(&gaPageReferences[pg]) || gaPageReferences[pg] == 0 ) {
+ nFree ++;
+ continue ;
+ }
+ totalRefs += gaPageReferences[pg];
+ if(gaPageReferences[pg] > 1)
+ nMultiRef ++;
+ }
+
+ int nUsed = (total - nFree);
+ Log_Log("MMPhys", "%ipbit - %i/%i used, %i reused, %i average reference count",
+ addrClasses[i], nUsed, total, nMultiRef,
+ nMultiRef ? (totalRefs-(nUsed - nMultiRef)) / nMultiRef : 0
+ );
+
+ if( last == giPageCount )
+ break;
+ }
+ Log_Log("MMPhys", "%lli/%lli total pages used, 0 - %i possible free range",
+ giPhysAlloc, giTotalMemorySize, giLastPossibleFree);
+}
+