This source file includes following definitions.
- uvmhist_dump
- uvmhist_dump_histories
- uvm_hist
- uvmcnt_dump
- uvmexp_print
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 #include <sys/param.h>
43 #include <sys/systm.h>
44
45 #include <uvm/uvm.h>
46 #include <uvm/uvm_ddb.h>
47
48
49
50
51
52 struct uvm_cnt *uvm_cnt_head = NULL;
53
54 #ifdef UVMHIST
55 struct uvm_history_head uvm_histories;
56 #endif
57
58 #ifdef UVMHIST_PRINT
59 int uvmhist_print_enabled = 1;
60 #endif
61
62 #ifdef DDB
63
64
65
66
67
68 #ifdef UVMHIST
69 void uvmhist_dump(struct uvm_history *);
70 void uvm_hist(u_int32_t);
71 static void uvmhist_dump_histories(struct uvm_history *[]);
72 #endif
73 void uvmcnt_dump(void);
74
75
76 #ifdef UVMHIST
77
78 void
79 uvmhist_dump(l)
80 struct uvm_history *l;
81 {
82 int lcv, s;
83
84 s = splhigh();
85 lcv = l->f;
86 do {
87 if (l->e[lcv].fmt)
88 uvmhist_print(&l->e[lcv]);
89 lcv = (lcv + 1) % l->n;
90 } while (lcv != l->f);
91 splx(s);
92 }
93
94
95
96
97 static void
98 uvmhist_dump_histories(hists)
99 struct uvm_history *hists[];
100 {
101 struct timeval tv;
102 int cur[MAXHISTS];
103 int s, lcv, hi;
104
105
106 s = splhigh();
107
108
109 for (lcv = 0; hists[lcv]; lcv++)
110 cur[lcv] = hists[lcv]->f;
111
112
113
114
115
116
117
118 for (;;) {
119 hi = -1;
120 tv.tv_sec = tv.tv_usec = 0;
121
122
123 for (lcv = 0; hists[lcv]; lcv++) {
124 restart:
125 if (cur[lcv] == -1)
126 continue;
127
128
129
130
131
132 if (hists[lcv]->e[cur[lcv]].fmt == NULL) {
133 cur[lcv] = (cur[lcv] + 1) % (hists[lcv]->n);
134 if (cur[lcv] == hists[lcv]->f)
135 cur[lcv] = -1;
136 goto restart;
137 }
138
139
140
141
142
143
144 if (tv.tv_sec == 0 ||
145 timercmp(&hists[lcv]->e[cur[lcv]].tv, &tv, <)) {
146 tv = hists[lcv]->e[cur[lcv]].tv;
147 hi = lcv;
148 }
149 }
150
151
152 if (hi == -1)
153 break;
154
155
156 uvmhist_print(&hists[hi]->e[cur[hi]]);
157 cur[hi] = (cur[hi] + 1) % (hists[hi]->n);
158 if (cur[hi] == hists[hi]->f)
159 cur[hi] = -1;
160 }
161
162
163 splx(s);
164 }
165
166
167
168
169
170 void
171 uvm_hist(bitmask)
172 u_int32_t bitmask;
173 {
174 struct uvm_history *hists[MAXHISTS + 1];
175 int i = 0;
176
177 if ((bitmask & UVMHIST_MAPHIST) || bitmask == 0)
178 hists[i++] = &maphist;
179
180 if ((bitmask & UVMHIST_PDHIST) || bitmask == 0)
181 hists[i++] = &pdhist;
182
183 hists[i] = NULL;
184
185 uvmhist_dump_histories(hists);
186 }
187 #endif
188
189 void
190 uvmcnt_dump()
191 {
192 struct uvm_cnt *uvc = uvm_cnt_head;
193
194 while (uvc) {
195 if ((uvc->t & UVMCNT_MASK) != UVMCNT_CNT)
196 continue;
197 printf("%s = %d\n", uvc->name, uvc->c);
198 uvc = uvc->next;
199 }
200 }
201
202
203
204
205 void
206 uvmexp_print(int (*pr)(const char *, ...))
207 {
208
209 (*pr)("Current UVM status:\n");
210 (*pr)(" pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d\n",
211 uvmexp.pagesize, uvmexp.pagesize, uvmexp.pagemask,
212 uvmexp.pageshift);
213 (*pr)(" %d VM pages: %d active, %d inactive, %d wired, %d free\n",
214 uvmexp.npages, uvmexp.active, uvmexp.inactive, uvmexp.wired,
215 uvmexp.free);
216 (*pr)(" min %d%% (%d) anon, %d%% (%d) vnode, %d%% (%d) vtext\n",
217 uvmexp.anonminpct, uvmexp.anonmin, uvmexp.vnodeminpct,
218 uvmexp.vnodemin, uvmexp.vtextminpct, uvmexp.vtextmin);
219 (*pr)(" pages %d anon, %d vnode, %d vtext\n",
220 uvmexp.anonpages, uvmexp.vnodepages, uvmexp.vtextpages);
221 (*pr)(" freemin=%d, free-target=%d, inactive-target=%d, "
222 "wired-max=%d\n", uvmexp.freemin, uvmexp.freetarg, uvmexp.inactarg,
223 uvmexp.wiredmax);
224 (*pr)(" faults=%d, traps=%d, intrs=%d, ctxswitch=%d fpuswitch=%d\n",
225 uvmexp.faults, uvmexp.traps, uvmexp.intrs, uvmexp.swtch,
226 uvmexp.fpswtch);
227 (*pr)(" softint=%d, syscalls=%d, swapins=%d, swapouts=%d, "
228 "kmapent=%d\n", uvmexp.softs, uvmexp.syscalls, uvmexp.swapins,
229 uvmexp.swapouts, uvmexp.kmapent);
230
231 (*pr)(" fault counts:\n");
232 (*pr)(" noram=%d, noanon=%d, pgwait=%d, pgrele=%d\n",
233 uvmexp.fltnoram, uvmexp.fltnoanon, uvmexp.fltpgwait,
234 uvmexp.fltpgrele);
235 (*pr)(" ok relocks(total)=%d(%d), anget(retries)=%d(%d), "
236 "amapcopy=%d\n", uvmexp.fltrelckok, uvmexp.fltrelck,
237 uvmexp.fltanget, uvmexp.fltanretry, uvmexp.fltamcopy);
238 (*pr)(" neighbor anon/obj pg=%d/%d, gets(lock/unlock)=%d/%d\n",
239 uvmexp.fltnamap, uvmexp.fltnomap, uvmexp.fltlget, uvmexp.fltget);
240 (*pr)(" cases: anon=%d, anoncow=%d, obj=%d, prcopy=%d, przero=%d\n",
241 uvmexp.flt_anon, uvmexp.flt_acow, uvmexp.flt_obj, uvmexp.flt_prcopy,
242 uvmexp.flt_przero);
243
244 (*pr)(" daemon and swap counts:\n");
245 (*pr)(" woke=%d, revs=%d, scans=%d, obscans=%d, anscans=%d\n",
246 uvmexp.pdwoke, uvmexp.pdrevs, uvmexp.pdscans, uvmexp.pdobscan,
247 uvmexp.pdanscan);
248 (*pr)(" busy=%d, freed=%d, reactivate=%d, deactivate=%d\n",
249 uvmexp.pdbusy, uvmexp.pdfreed, uvmexp.pdreact, uvmexp.pddeact);
250 (*pr)(" pageouts=%d, pending=%d, nswget=%d\n", uvmexp.pdpageouts,
251 uvmexp.pdpending, uvmexp.nswget);
252 (*pr)(" nswapdev=%d, nanon=%d, nanonneeded=%d nfreeanon=%d\n",
253 uvmexp.nswapdev, uvmexp.nanon, uvmexp.nanonneeded,
254 uvmexp.nfreeanon);
255 (*pr)(" swpages=%d, swpginuse=%d, swpgonly=%d paging=%d\n",
256 uvmexp.swpages, uvmexp.swpginuse, uvmexp.swpgonly, uvmexp.paging);
257
258 (*pr)(" kernel pointers:\n");
259 (*pr)(" objs(kern)=%p\n", uvm.kernel_object);
260 }
261 #endif