You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2012/06/22 16:55:08 UTC

svn commit: r1352909 - /httpd/httpd/trunk/.gdbinit

Author: sf
Date: Fri Jun 22 14:55:07 2012
New Revision: 1352909

URL: http://svn.apache.org/viewvc?rev=1352909&view=rev
Log:
improve dump_allocator, add dump_one_pool

- dump_one_pool dumps the size of a pool not including child pools
- dump_allocator now dumps the size of the memnodes and not the last used
  free size. Also dump the total size.

Modified:
    httpd/httpd/trunk/.gdbinit

Modified: httpd/httpd/trunk/.gdbinit
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/.gdbinit?rev=1352909&r1=1352908&r2=1352909&view=diff
==============================================================================
--- httpd/httpd/trunk/.gdbinit (original)
+++ httpd/httpd/trunk/.gdbinit Fri Jun 22 14:55:07 2012
@@ -349,23 +349,45 @@ define dump_allocator
     printf "Allocator free list:\n"
     set $i = 0
     set $max =(sizeof $arg0->free)/(sizeof $arg0->free[0])
+    set $kb = 0
     while $i < $max
         set $node = $arg0->free[$i]
         if $node != 0
             printf " #%2d: ", $i
             while $node != 0
-                printf "%d, ", $node->endp - $node->first_avail
+                printf "%d, ", 4096 << $node->index
+                set $kb = $kb + (4 << $node->index)
                 set $node = $node->next
             end
             printf "ends.\n"
         end
         set $i = $i + 1
     end
+    printf "Sum of free blocks: %dkiB\n", $kb
 end
 document dump_allocator
     Print status of an allocator and its freelists.
 end
 
+define dump_one_pool
+    set $p = $arg0
+    set $size = 0
+    set $free = 0
+    set $nodes = 0
+    set $node = $arg0->active
+    set $done = 0
+    while $done == 0
+        set $size = $size + (4096 << $node->index)
+        set $free = $free + ($node->endp - $node->first_avail)
+        set $nodes = $nodes + 1
+        set $node = $node->next
+        if $node == $arg0->active
+            set $done = 1
+        end
+    end
+    printf "Pool '%s' [%p]: %d/%d free (%d blocks)\n", $p->tag, $p, $free, $size, $nodes
+end
+
 # Set sane defaults for common signals:
 handle SIGPIPE noprint pass nostop
 handle SIGUSR1 print pass nostop