1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# vim:ft=gdb:ts=2:sw=2:et:
set $UMF_AUDIT = 1
set $UMF_DEADBEEF = 2
set $UMF_REDZONE = 4
set $UMF_CONTENTS = 8
set $UMF_CHECKSIGNAL = 16
set $UMF_NOMAGAZINE = 32
set $UMF_FIREWALL = 64
set $UMF_LITE = 128
set $UMF_HASH = 256
set $UMF_RANDOMIZE = 512
define umastat_cache
set $cp = $arg0
set $meminuse = ($cp->cache_slab_create - $cp->cache_slab_destroy) * $cp->cache_slabsize
if (($cp->cache_cpu[0].cc_magsize != 0) || ($cp->cache_flags & $UMF_NOMAGAZINE))
set $magsize = $cp->cache_cpu[0].cc_magsize
else
set $magsize = $cp->cache_magtype->mt_magsize
end
set $alloc = $cp->cache_slab_alloc + $cp->cache_full.ml_alloc
set $avail = $cp->cache_full.ml_total * $magsize
set $total = $cp->cache_buftotal
# walk the cpu caches
set $cpu_current = 0
while $cpu_current < umem_max_ncpus
set $cpu = umem_cpus[$cpu_current]
set $cpu_cache = (umem_cpu_cache_t*)((char*)$cp + $cpu->cpu_cache_offset)
if $cpu_cache->cc_rounds > 0
set $avail = $avail + $cpu_cache->cc_rounds
end
if $cpu_cache->cc_prounds > 0
set $avail = $avail + $cpu_cache->cc_prounds
end
set $alloc = $alloc + $cpu_cache->cc_alloc
set $cpu_current = $cpu_current + 1
end
# walk some slabs
set $slab = $cp->cache_nullslab.slab_next
while $slab != &$cp->cache_nullslab
set $avail = $avail + $slab->slab_chunks - $slab->slab_refcnt
set $slab = $slab->slab_next
end
printf "%-25s %6u %6u %6u %9u %9u %5llu\n", $cp->cache_name, $cp->cache_bufsize, $total - $avail, $total, $meminuse, $alloc, $cp->cache_alloc_fail
end
document umastat
umem allocator stats
end
define umastat
printf "cache buf buf buf memory alloc alloc\n"
printf "name size in use total in use succeed fail\n"
printf "---------------------------- ------ ------ ------ --------- --------- -----\n"
set $cp = umem_null_cache->cache_next
while $cp != &umem_null_cache
umastat_cache $cp
set $cp = $cp->cache_next
end
printf "---------------------------- ------ ------ ------ --------- --------- -----\n"
set $vmem = vmem_list
while $vmem != 0
set $meminuse = 0
set $alloc = 0
set $fail = 0
set $cp = umem_null_cache->cache_next
while $cp != &umem_null_cache
if $cp->cache_arena == $vmem
set $meminuse = $meminuse + (($cp->cache_slab_create - $cp->cache_slab_destroy) * $cp->cache_slabsize)
if (($cp->cache_cpu[0].cc_magsize != 0) || ($cp->cache_flags & $UMF_NOMAGAZINE))
set $magsize = $cp->cache_cpu[0].cc_magsize
else
set $magsize = $cp->cache_magtype->mt_magsize
end
set $alloc = $alloc + ($cp->cache_slab_alloc + $cp->cache_full.ml_alloc)
set $avail = $avail + ($cp->cache_full.ml_total * $magsize)
end
set $cp = $cp->cache_next
end
printf "Total %-25s %9u %9u %5u\n", $vmem->vm_name, $meminuse, $alloc, $fail
set $vmem = $vmem->vm_next
end
end
define umem_status
printf "Concurrency:\t%d\n", umem_max_ncpus
printf "Logs\t\t"
if umem_transaction_log != 0
printf "transaction=%d ", umem_transaction_log->lh_chunksize * umem_transaction_log->lh_nchunks
end
if umem_content_log != 0
printf "content=%d ", umem_content_log->lh_chunksize * umem_content_log->lh_nchunks
end
if umem_failure_log != 0
printf "fail=%d ", umem_failure_log->lh_chunksize * umem_failure_log->lh_nchunks
end
if umem_slab_log != 0
printf "slab=%d ", umem_slab_log->lh_chunksize * umem_slab_log->lh_nchunks
end
if umem_logging == 0
printf "(inactive)"
end
printf "\nMessage buffer:\n"
set $msg = &umem_error_buffer + umem_error_begin
printf "%s", $msg
end
|