util: also print out memory statistics
authorZack Rusin <zackr@vmware.com>
Sun, 22 Nov 2009 20:21:14 +0000 (15:21 -0500)
committerZack Rusin <zackr@vmware.com>
Wed, 25 Nov 2009 15:20:08 +0000 (10:20 -0500)
src/gallium/auxiliary/util/u_mm.c

index 4b75d4ba1d0155f9129663ab3b557a1cdb2458d2..82f83702d1e4f01213ff7926e7c6824a2ff32dd5 100644 (file)
@@ -39,13 +39,20 @@ u_mmDumpMemInfo(const struct mem_block *heap)
    }
    else {
       const struct mem_block *p;
+      int total_used = 0, total_free = 0;
 
       for (p = heap->next; p != heap; p = p->next) {
         debug_printf("  Offset:%08x, Size:%08x, %c%c\n", p->ofs, p->size,
                       p->free ? 'F':'.',
                       p->reserved ? 'R':'.');
+         if (p->free)
+            total_free += p->size;
+         else
+            total_used += p->size;
       }
 
+      debug_printf("'\nMemory stats: total = %d, used = %d, free = %d\n",
+                   total_used + total_free, total_used, total_free);
       debug_printf("\nFree list:\n");
 
       for (p = heap->next_free; p != heap; p = p->next_free) {