+
+ totalvis = 0;
+ totalvis2 = 0;
+ minvis = -1;
+ maxvis = -1;
+ for(i = 0; i < MAX_MAP_LEAFS; ++i)
+ if(clustersizehistogram[i])
+ {
+ if(debugCluster)
+ Sys_FPrintf(SYS_VRB, "%4i clusters have exactly %4i visible clusters\n", clustersizehistogram[i], i);
+ /* cast is to prevent integer overflow */
+ totalvis += ((double) i) * ((double) clustersizehistogram[i]);
+ totalvis2 += ((double) i) * ((double) i) * ((double) clustersizehistogram[i]);
+
+ if(minvis < 0)
+ minvis = i;
+ maxvis = i;
+ }
+
+ mu = totalvis / portalclusters;
+ sigma = sqrt(totalvis2 / portalclusters - mu * mu);
+
+ Sys_Printf( "Total clusters: %i\n", portalclusters );
+ Sys_Printf( "Total visible clusters: %.0f\n", totalvis );
+ Sys_Printf( "Average clusters visible: %.2f (%.3f%%/total)\n", mu, mu / portalclusters * 100.0);
+ Sys_Printf( " Standard deviation: %.2f (%.3f%%/total, %.3f%%/avg)\n", sigma, sigma / portalclusters * 100.0, sigma / mu * 100.0);
+ Sys_Printf( " Minimum: %i (%.3f%%/total, %.3f%%/avg)\n", minvis, minvis / (double) portalclusters * 100.0, minvis / mu * 100.0);
+ Sys_Printf( " Maximum: %i (%.3f%%/total, %.3f%%/avg)\n", maxvis, maxvis / (double) portalclusters * 100.0, maxvis / mu * 100.0);