about summary refs log tree commit diff
path: root/malloc/memusage.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-05-03 03:49:29 +0000
committerUlrich Drepper <drepper@redhat.com>2002-05-03 03:49:29 +0000
commit3dbbe24e84fe0f5f87e274ffdba56d6bfd552244 (patch)
treebf127ec84c0b2d1387472562f7e68ad32b6f45d6 /malloc/memusage.c
parent519756318ce73e0a01e3031499b4483b3f618f2e (diff)
downloadglibc-3dbbe24e84fe0f5f87e274ffdba56d6bfd552244.tar.gz
glibc-3dbbe24e84fe0f5f87e274ffdba56d6bfd552244.tar.xz
glibc-3dbbe24e84fe0f5f87e274ffdba56d6bfd552244.zip
Distinguish anonymous mmap.
Diffstat (limited to 'malloc/memusage.c')
-rw-r--r--malloc/memusage.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/malloc/memusage.c b/malloc/memusage.c
index 2afe4d289c..d5b73f5921 100644
--- a/malloc/memusage.c
+++ b/malloc/memusage.c
@@ -53,6 +53,7 @@ enum
   idx_free,
   idx_mmap_r,
   idx_mmap_w,
+  idx_mmap_a,
   idx_mremap,
   idx_munmap,
   idx_last
@@ -542,7 +543,8 @@ mmap (void *start, size_t len, int prot, int flags, int fd, off_t offset)
 
   if (!not_me && trace_mmap)
     {
-      int idx = prot & PROT_WRITE ? idx_mmap_w : idx_mmap_r;
+      int idx = (flags & MAP_ANON
+		 ? idx_mmap_a : prot & PROT_WRITE ? idx_mmap_w : idx_mmap_r);
 
       /* Keep track of number of calls.  */
       ++calls[idx];
@@ -593,7 +595,8 @@ mmap64 (void *start, size_t len, int prot, int flags, int fd, off64_t offset)
 
   if (!not_me && trace_mmap)
     {
-      int idx = prot & PROT_WRITE ? idx_mmap_w : idx_mmap_r;
+      int idx = (flags & MAP_ANON
+		 ? idx_mmap_a : prot & PROT_WRITE ? idx_mmap_w : idx_mmap_r);
 
       /* Keep track of number of calls.  */
       ++calls[idx];
@@ -784,12 +787,15 @@ dest (void)
     fprintf (stderr, "\
 \e[00;34mmmap(r)|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n\
 \e[00;34mmmap(w)|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n\
+\e[00;34mmmap(a)|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n\
 \e[00;34m mremap|\e[0m %10lu   %12llu   %s%12lu\e[00;00m   (in place: %ld, dec: %ld)\n\
 \e[00;34m munmap|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n",
 	     calls[idx_mmap_r], total[idx_mmap_r],
 	     failed[idx_mmap_r] ? "\e[01;41m" : "", failed[idx_mmap_r],
 	     calls[idx_mmap_w], total[idx_mmap_w],
 	     failed[idx_mmap_w] ? "\e[01;41m" : "", failed[idx_mmap_w],
+	     calls[idx_mmap_a], total[idx_mmap_a],
+	     failed[idx_mmap_a] ? "\e[01;41m" : "", failed[idx_mmap_a],
 	     calls[idx_mremap], total[idx_mremap],
 	     failed[idx_mremap] ? "\e[01;41m" : "", failed[idx_mremap],
 	     inplace_mremap, decreasing_mremap,