gallium/util: Fix deviation calculation in u_cache.
authorVinson Lee <vlee@vmware.com>
Thu, 22 Apr 2010 01:45:44 +0000 (18:45 -0700)
committerVinson Lee <vlee@vmware.com>
Thu, 22 Apr 2010 01:45:44 +0000 (18:45 -0700)
The approximate deviation calculation was using the entire cache's total
instead of each cache entry's total.

src/gallium/auxiliary/util/u_cache.c

index 47c16b1c927f5f70fbd6d1dddeeaea8e0df11e3a..15f4a8831f21fad0ce0e647a698077bad4980203 100644 (file)
@@ -202,7 +202,7 @@ util_cache_destroy(struct util_cache *cache)
       double stddev = sqrt(mean);
       unsigned i;
       for(i = 0; i < cache->size; ++i) {
-         double z = fabs(cache->count - mean)/stddev;
+         double z = fabs(cache->entries[i].count - mean)/stddev;
          /* This assert should not fail 99.9999998027% of the times, unless 
           * the hash function is a poor one */
          assert(z <= 6.0);