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