[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24879] branches/sculpt25/intern/ guardedalloc/intern/mallocn.c: Sculpt: tweak to memory statistics graph, showing both % and MB.

Brecht Van Lommel brecht at blender.org
Wed Nov 25 12:59:57 CET 2009


Revision: 24879
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24879
Author:   blendix
Date:     2009-11-25 12:59:57 +0100 (Wed, 25 Nov 2009)

Log Message:
-----------
Sculpt: tweak to memory statistics graph, showing both % and MB.

Modified Paths:
--------------
    branches/sculpt25/intern/guardedalloc/intern/mallocn.c

Modified: branches/sculpt25/intern/guardedalloc/intern/mallocn.c
===================================================================
--- branches/sculpt25/intern/guardedalloc/intern/mallocn.c	2009-11-25 11:47:53 UTC (rev 24878)
+++ branches/sculpt25/intern/guardedalloc/intern/mallocn.c	2009-11-25 11:59:57 UTC (rev 24879)
@@ -402,11 +402,13 @@
 	}
 	totpb= b+1;
 
+#define MEM_IN_MB(mem) ((double)mem/(double)(1024*1024))
+
 	/* sort by length and print */
 	qsort(printblock, totpb, sizeof(MemPrintBlock), compare_len);
-	printf("\ntotal memory len: %.3f MB\n", (double)mem_in_use/(double)(1024*1024));
+	printf("\ntotal memory len: %.3f MB\n", MEM_IN_MB(mem_in_use));
 	for(a=0, pb=printblock; a<totpb; a++, pb++)
-		printf("%s items: %d, len: %.3f MB\n", pb->name, pb->items, (double)pb->len/(double)(1024*1024));
+		printf("%s items: %d, len: %.3f MB\n", pb->name, pb->items, MEM_IN_MB(pb->len));
 	
 	{
 		uintptr_t other= mem_in_use;
@@ -419,7 +421,7 @@
 			"memory = [\n");
 
 		for(a=0, pb=printblock; a<totpb; a++, pb++) {
-			printf("[\"%s\", %.3f],\n", pb->name, (double)pb->len/(double)(1024*1024));
+			printf("[\"%s (%.3f MB)\", %.3f],\n", pb->name, MEM_IN_MB(pb->len), MEM_IN_MB(pb->len));
 			other -= pb->len;
 
 			if((double)pb->len/(double)mem_in_use < 0.025)
@@ -437,12 +439,14 @@
 			"pie(fracs, labels=labels, colors=colors, autopct='%%1.1f%%%%')\n"
 			"title(\"Memory Usage: %.3f MB\")\n"
 			"\n"
-			"show()\n", (double)other/(double)(1024*1024), (double)mem_in_use/(double)(1024*1024));
+			"show()\n", MEM_IN_MB(other), MEM_IN_MB(mem_in_use));
 	}
 
 	free(printblock);
 	
 	mem_unlock_thread();
+
+#undef MEM_IN_MB
 }
 
 /* Prints in python syntax for easy */





More information about the Bf-blender-cvs mailing list