[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24318] branches/sculpt25/intern/ guardedalloc/intern/mallocn.c: Sculpt: memory statistics now also print out a small python script to
Brecht Van Lommel
brecht at blender.org
Wed Nov 4 21:11:57 CET 2009
Revision: 24318
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24318
Author: blendix
Date: 2009-11-04 21:11:57 +0100 (Wed, 04 Nov 2009)
Log Message:
-----------
Sculpt: memory statistics now also print out a small python script to
plot memory usage, requires matplotlib.
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-04 18:35:32 UTC (rev 24317)
+++ branches/sculpt25/intern/guardedalloc/intern/mallocn.c 2009-11-04 20:11:57 UTC (rev 24318)
@@ -407,7 +407,39 @@
printf("\ntotal memory len: %.3f MB\n", (double)mem_in_use/(double)(1024*1024));
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));
+
+ {
+ uintptr_t other= mem_in_use;
+ printf(
+ "from pylab import *\n"
+ "\n"
+ "figure(1, figsize=(10,10))\n"
+ "\n"
+ "memory = [\n");
+
+ for(a=0, pb=printblock; a<totpb; a++, pb++) {
+ printf("[\"%s\", %.3f],\n", pb->name, (double)pb->len/(double)(1024*1024));
+ other -= pb->len;
+
+ if((double)pb->len/(double)mem_in_use < 0.025)
+ break;
+ }
+
+ printf(
+ "[\"other\", %.3f]]\n"
+ "\n"
+ "labels = [m[0] for m in memory]\n"
+ "fracs = [m[1] for m in memory]\n"
+ "map = cm.get_cmap(\"Paired\")\n"
+ "colors = [map(float(i)/len(fracs)) for i in range(0, len(fracs))]\n"
+ "\n"
+ "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));
+ }
+
free(printblock);
mem_unlock_thread();
More information about the Bf-blender-cvs
mailing list