The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/gdbscripts/bdump

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #       $NetBSD: bdump,v 1.2 1997/02/12 23:35:06 gwr Exp $
    2 
    3 # Count the number of buffers in the buffer cache for which
    4 # bp->b_flags & $bufcount_match is non-0.
    5 #
    6 #       @(#)bdump       8.1 (Berkeley) 6/10/93
    7 
    8 set $bufcount_match=0x020000
    9 define bufcount
   10 
   11         set $i = 0
   12         set $num = 0
   13 
   14         while ($i < 512)
   15 
   16                 set $bp = bufhash[$i].b_forw
   17                 while ($bp != bufhash[$i].b_back)
   18                         if ($bp->b_flags & $bufcount_match)
   19                                 set $num++
   20                         end
   21                         set $bp = $bp->b_forw
   22                 end
   23                 # printf "bucket: %d cumulative %d\n", $i, $num
   24                 set $i++
   25         end
   26         printf "Number of buffers with flags & %x in hash table: %d\n", $bufcount_match, $num
   27 end
   28 
   29 # Dump the entire buffer cache.
   30 
   31 define bufdump
   32 
   33         set $i = 0
   34         set $num = 0
   35 
   36         while ($i < 512)
   37 
   38                 set $bp = bufhash[$i].b_forw
   39                 while ($bp != bufhash[$i].b_back)
   40                         printf "bp=0x%x flags=0x%x vp=0x%x lblkno=0x%x blkno=0x%x\n", $bp, $bp->b_flags, $bp->b_vp, $bp->b_lblkno, $bp->b_blkno
   41                         set $num++
   42                         set $bp = $bp->b_forw
   43                 end
   44                 set $i++
   45         end
   46         printf "Number of buffers in hash table: %d\n", $num
   47 end
   48 
   49 # Dump the buffers in a particular hashbucket.
   50 # usage: dumpbucket bucketnumber
   51 define dumpbucket
   52 
   53         set $num = 0
   54         set $bp = bufhash[$arg0].b_forw
   55         while ($bp != bufhash[$arg0].b_back)
   56                 printf "bp=0x%x flags=0x%x vp=0x%x lblkno=0x%x blkno=0x%x\n", $bp, $bp->b_flags, $bp->b_vp, $bp->b_lblkno, $bp->b_blkno
   57                 set $num++
   58                 set $bp = $bp->b_forw
   59         end
   60         printf "Number of buffers in bucket %d: %d\n", $arg0, $num
   61 end
   62 
   63 # Dump the buffers on the empty and age queues
   64 
   65 define bdumpnew
   66 
   67         set $i = 0
   68         set $num = 0
   69 
   70         while ($i < 4)
   71 
   72                 printf "Queue %d\n", $i
   73                 set $bp = (struct buf *)bufqueues[$i].qe_next
   74                 while ($bp)
   75                         printf "bp=0x%x flags=0x%x vp=0x%x lbn=%d size=0x%x\n", $bp, $bp->b_flags, $bp->b_vp, $bp->b_lblkno, $bp->b_bufsize
   76                         set $num++
   77                         set $bp = (struct buf *)$bp->b_freelist.qe_next
   78                 end
   79                 set $i++
   80         end
   81         printf "Number of buffers in free lists: %d\n", $num
   82 end
   83 
   84 define dumpchain
   85 
   86         set $bp = (struct buf *)$arg0
   87         while ($bp)
   88                 printf "bp=0x%x flags=0x%x bn=0x%x lbn=%d count=%d size=%d\n", $bp, $bp->b_flags, $bp->b_blkno, $bp->b_lblkno, $bp->b_bcount, $bp->b_bufsize
   89                 set $bp = (struct buf *)$bp->b_vnbufs.qe_next
   90         end
   91 end
   92 
   93 define dumpq
   94 
   95         set $num = 0
   96 
   97         printf "Queue %d\n", $arg0
   98         set $bp = (struct buf *)bufqueues[$arg0].qe_next
   99         while ($bp)
  100                 printf "bp=0x%x flags=0x%x vp=0x%x lbn=%d size=0x%x\n", $bp, $bp->b_flags, $bp->b_vp, $bp->b_lblkno, $bp->b_bufsize
  101                 set $num++
  102                 set $bp = (struct buf *)$bp->b_freelist.qe_next
  103         end
  104         printf "Number of buffers on queue %d: %d\n", $arg0, $num
  105 end

Cache object: 52d30c26a19dcd3638907c157216c004


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.