about summary refs log tree commit diff
path: root/Src/mem.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-03-15 14:30:18 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-03-15 14:30:18 +0000
commite0e7f200809abacdab96ecbf73eea29efbcd06ba (patch)
tree48804e5b4599922f6238602df4f00e3e983f46e2 /Src/mem.c
parent1296dfbff0b5fd3e39eed3fbc67327ce4609f591 (diff)
downloadzsh-e0e7f200809abacdab96ecbf73eea29efbcd06ba.tar.gz
zsh-e0e7f200809abacdab96ecbf73eea29efbcd06ba.tar.xz
zsh-e0e7f200809abacdab96ecbf73eea29efbcd06ba.zip
zsh-workers/10148
Diffstat (limited to 'Src/mem.c')
-rw-r--r--Src/mem.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/Src/mem.c b/Src/mem.c
index 29bd213f4..47e9da7d5 100644
--- a/Src/mem.c
+++ b/Src/mem.c
@@ -1219,7 +1219,7 @@ bin_mem(char *name, char **argv, char *ops, int func)
     int i, ii, fi, ui, j;
     struct m_hdr *m, *mf, *ms;
     char *b, *c, buf[40];
-    long u = 0, f = 0;
+    long u = 0, f = 0, to, cu;
 
     if (ops['v']) {
 	printf("The lower and the upper addresses of the heap. Diff gives\n");
@@ -1242,13 +1242,15 @@ bin_mem(char *name, char **argv, char *ops, int func)
 	printf("values, i.e. the number of blocks of that size that is\n");
 	printf("currently allocated. Total is the product of size and diff,\n");
 	printf("i.e. the number of bytes that are allocated for blocks of\n");
-	printf("this size.\n");
+	printf("this size. The last field gives the accumulated number of\n");
+	printf("bytes for all sizes.\n");
     }
-    printf("\nsize\tmalloc\tfree\tdiff\ttotal\n");
-    for (i = 0; i < 1024; i++)
+    printf("\nsize\tmalloc\tfree\tdiff\ttotal\tcum\n");
+    for (i = 0, cu = 0; i < 1024; i++)
 	if (m_m[i] || m_f[i])
-	    printf("%ld\t%d\t%d\t%d\t%ld\n", (long)i * M_ISIZE, m_m[i], m_f[i],
-		   m_m[i] - m_f[i], (long)i * M_ISIZE * (m_m[i] - m_f[i]));
+	    printf("%ld\t%d\t%d\t%d\t%ld\t%ld\n",
+		   (long)i * M_ISIZE, m_m[i], m_f[i], m_m[i] - m_f[i],
+		   (to = (long) i * M_ISIZE * (m_m[i] - m_f[i])), (cu += to));
 
     if (m_m[i] || m_f[i])
 	printf("big\t%d\t%d\t%d\n", m_m[i], m_f[i], m_m[i] - m_f[i]);