Lines Matching +full:n +full:-

58  * user-land, it's not invalid to release a sychonization primitive that
59 * another thread acquired; rwlocks require a thread-local associative array
65 "plockstat$target:::rw-acquire\n"
66 "{\n"
67 " self->rwhold[arg0] = timestamp;\n"
68 "}\n"
69 "plockstat$target:::mutex-acquire\n"
70 "/arg1 == 0/\n"
71 "{\n"
72 " mtxhold[arg0] = timestamp;\n"
73 "}\n";
76 "plockstat$target:::rw-release\n"
77 "/self->rwhold[arg0] && arg1 == 1/\n"
78 "{\n"
79 " @rw_w_hold[arg0, ustack()] =\n"
80 " quantize(timestamp - self->rwhold[arg0]);\n"
81 " self->rwhold[arg0] = 0;\n"
82 " rw_w_hold_found = 1;\n"
83 "}\n"
84 "plockstat$target:::rw-release\n"
85 "/self->rwhold[arg0]/\n"
86 "{\n"
87 " @rw_r_hold[arg0, ustack()] =\n"
88 " quantize(timestamp - self->rwhold[arg0]);\n"
89 " self->rwhold[arg0] = 0;\n"
90 " rw_r_hold_found = 1;\n"
91 "}\n"
92 "plockstat$target:::mutex-release\n"
93 "/mtxhold[arg0] && arg1 == 0/\n"
94 "{\n"
95 " @mtx_hold[arg0, ustack()] = quantize(timestamp - mtxhold[arg0]);\n"
96 " mtxhold[arg0] = 0;\n"
97 " mtx_hold_found = 1;\n"
98 "}\n"
99 "\n"
100 "END\n"
101 "/mtx_hold_found/\n"
102 "{\n"
103 " trace(\"Mutex hold\");\n"
104 " printa(@mtx_hold);\n"
105 "}\n"
106 "END\n"
107 "/rw_r_hold_found/\n"
108 "{\n"
109 " trace(\"R/W reader hold\");\n"
110 " printa(@rw_r_hold);\n"
111 "}\n"
112 "END\n"
113 "/rw_w_hold_found/\n"
114 "{\n"
115 " trace(\"R/W writer hold\");\n"
116 " printa(@rw_w_hold);\n"
117 "}\n";
120 "plockstat$target:::rw-release\n"
121 "/self->rwhold[arg0] && arg1 == 1/\n"
122 "{\n"
123 " @rw_w_hold[arg0, ustack(5)] = sum(timestamp - self->rwhold[arg0]);\n"
124 " @rw_w_hold_count[arg0, ustack(5)] = count();\n"
125 " self->rwhold[arg0] = 0;\n"
126 " rw_w_hold_found = 1;\n"
127 "}\n"
128 "plockstat$target:::rw-release\n"
129 "/self->rwhold[arg0]/\n"
130 "{\n"
131 " @rw_r_hold[arg0, ustack(5)] = sum(timestamp - self->rwhold[arg0]);\n"
132 " @rw_r_hold_count[arg0, ustack(5)] = count();\n"
133 " self->rwhold[arg0] = 0;\n"
134 " rw_r_hold_found = 1;\n"
135 "}\n"
136 "plockstat$target:::mutex-release\n"
137 "/mtxhold[arg0] && arg1 == 0/\n"
138 "{\n"
139 " @mtx_hold[arg0, ustack(5)] = sum(timestamp - mtxhold[arg0]);\n"
140 " @mtx_hold_count[arg0, ustack(5)] = count();\n"
141 " mtxhold[arg0] = 0;\n"
142 " mtx_hold_found = 1;\n"
143 "}\n"
144 "\n"
145 "END\n"
146 "/mtx_hold_found/\n"
147 "{\n"
148 " trace(\"Mutex hold\");\n"
149 " printa(@mtx_hold, @mtx_hold_count);\n"
150 "}\n"
151 "END\n"
152 "/rw_r_hold_found/\n"
153 "{\n"
154 " trace(\"R/W reader hold\");\n"
155 " printa(@rw_r_hold, @rw_r_hold_count);\n"
156 "}\n"
157 "END\n"
158 "/rw_w_hold_found/\n"
159 "{\n"
160 " trace(\"R/W writer hold\");\n"
161 " printa(@rw_w_hold, @rw_w_hold_count);\n"
162 "}\n";
166 * For contention, we use thread-local associative arrays since we're tracing
171 "plockstat$target:::rw-block\n"
172 "{\n"
173 " self->rwblock[arg0] = timestamp;\n"
174 "}\n"
175 "plockstat$target:::mutex-block\n"
176 "{\n"
177 " self->mtxblock[arg0] = timestamp;\n"
178 "}\n"
179 "plockstat$target:::mutex-spin\n"
180 "{\n"
181 " self->mtxspin[arg0] = timestamp;\n"
182 "}\n";
185 "plockstat$target:::rw-blocked\n"
186 "/self->rwblock[arg0] && arg1 == 1 && arg2 != 0/\n"
187 "{\n"
188 " @rw_w_block[arg0, ustack()] =\n"
189 " quantize(timestamp - self->rwblock[arg0]);\n"
190 " self->rwblock[arg0] = 0;\n"
191 " rw_w_block_found = 1;\n"
192 "}\n"
193 "plockstat$target:::rw-blocked\n"
194 "/self->rwblock[arg0] && arg2 != 0/\n"
195 "{\n"
196 " @rw_r_block[arg0, ustack()] =\n"
197 " quantize(timestamp - self->rwblock[arg0]);\n"
198 " self->rwblock[arg0] = 0;\n"
199 " rw_r_block_found = 1;\n"
200 "}\n"
201 "plockstat$target:::rw-blocked\n"
202 "/self->rwblock[arg0]/\n"
203 "{\n"
204 " self->rwblock[arg0] = 0;\n"
205 "}\n"
206 "plockstat$target:::mutex-spun\n"
207 "/self->mtxspin[arg0] && arg1 != 0/\n"
208 "{\n"
209 " @mtx_spin[arg0, ustack()] =\n"
210 " quantize(timestamp - self->mtxspin[arg0]);\n"
211 " self->mtxspin[arg0] = 0;\n"
212 " mtx_spin_found = 1;\n"
213 "}\n"
214 "plockstat$target:::mutex-spun\n"
215 "/self->mtxspin[arg0]/\n"
216 "{\n"
217 " @mtx_vain_spin[arg0, ustack()] =\n"
218 " quantize(timestamp - self->mtxspin[arg0]);\n"
219 " self->mtxspin[arg0] = 0;\n"
220 " mtx_vain_spin_found = 1;\n"
221 "}\n"
222 "plockstat$target:::mutex-blocked\n"
223 "/self->mtxblock[arg0] && arg1 != 0/\n"
224 "{\n"
225 " @mtx_block[arg0, ustack()] =\n"
226 " quantize(timestamp - self->mtxblock[arg0]);\n"
227 " self->mtxblock[arg0] = 0;\n"
228 " mtx_block_found = 1;\n"
229 "}\n"
230 "plockstat$target:::mutex-blocked\n"
231 "/self->mtxblock[arg0]/\n"
232 "{\n"
233 " self->mtxblock[arg0] = 0;\n"
234 "}\n"
235 "\n"
236 "END\n"
237 "/mtx_block_found/\n"
238 "{\n"
239 " trace(\"Mutex block\");\n"
240 " printa(@mtx_block);\n"
241 "}\n"
242 "END\n"
243 "/mtx_spin_found/\n"
244 "{\n"
245 " trace(\"Mutex spin\");\n"
246 " printa(@mtx_spin);\n"
247 "}\n"
248 "END\n"
249 "/mtx_vain_spin_found/\n"
250 "{\n"
251 " trace(\"Mutex unsuccessful spin\");\n"
252 " printa(@mtx_vain_spin);\n"
253 "}\n"
254 "END\n"
255 "/rw_r_block_found/\n"
256 "{\n"
257 " trace(\"R/W reader block\");\n"
258 " printa(@rw_r_block);\n"
259 "}\n"
260 "END\n"
261 "/rw_w_block_found/\n"
262 "{\n"
263 " trace(\"R/W writer block\");\n"
264 " printa(@rw_w_block);\n"
265 "}\n";
269 "plockstat$target:::rw-blocked\n"
270 "/self->rwblock[arg0] && arg1 == 1 && arg2 != 0/\n"
271 "{\n"
272 " @rw_w_block[arg0, ustack(5)] =\n"
273 " sum(timestamp - self->rwblock[arg0]);\n"
274 " @rw_w_block_count[arg0, ustack(5)] = count();\n"
275 " self->rwblock[arg0] = 0;\n"
276 " rw_w_block_found = 1;\n"
277 "}\n"
278 "plockstat$target:::rw-blocked\n"
279 "/self->rwblock[arg0] && arg2 != 0/\n"
280 "{\n"
281 " @rw_r_block[arg0, ustack(5)] =\n"
282 " sum(timestamp - self->rwblock[arg0]);\n"
283 " @rw_r_block_count[arg0, ustack(5)] = count();\n"
284 " self->rwblock[arg0] = 0;\n"
285 " rw_r_block_found = 1;\n"
286 "}\n"
287 "plockstat$target:::rw-blocked\n"
288 "/self->rwblock[arg0]/\n"
289 "{\n"
290 " self->rwblock[arg0] = 0;\n"
291 "}\n"
292 "plockstat$target:::mutex-spun\n"
293 "/self->mtxspin[arg0] && arg1 != 0/\n"
294 "{\n"
295 " @mtx_spin[arg0, ustack(5)] =\n"
296 " sum(timestamp - self->mtxspin[arg0]);\n"
297 " @mtx_spin_count[arg0, ustack(5)] = count();\n"
298 " self->mtxspin[arg0] = 0;\n"
299 " mtx_spin_found = 1;\n"
300 "}\n"
301 "plockstat$target:::mutex-spun\n"
302 "/self->mtxspin[arg0]/\n"
303 "{\n"
304 " @mtx_vain_spin[arg0, ustack(5)] =\n"
305 " sum(timestamp - self->mtxspin[arg0]);\n"
306 " @mtx_vain_spin_count[arg0, ustack(5)] = count();\n"
307 " self->mtxspin[arg0] = 0;\n"
308 " mtx_vain_spin_found = 1;\n"
309 "}\n"
310 "plockstat$target:::mutex-blocked\n"
311 "/self->mtxblock[arg0] && arg1 != 0/\n"
312 "{\n"
313 " @mtx_block[arg0, ustack(5)] =\n"
314 " sum(timestamp - self->mtxblock[arg0]);\n"
315 " @mtx_block_count[arg0, ustack(5)] = count();\n"
316 " self->mtxblock[arg0] = 0;\n"
317 " mtx_block_found = 1;\n"
318 "}\n"
319 "plockstat$target:::mutex-blocked\n"
320 "/self->mtxblock[arg0]/\n"
321 "{\n"
322 " self->mtxblock[arg0] = 0;\n"
323 "}\n"
324 "\n"
325 "END\n"
326 "/mtx_block_found/\n"
327 "{\n"
328 " trace(\"Mutex block\");\n"
329 " printa(@mtx_block, @mtx_block_count);\n"
330 "}\n"
331 "END\n"
332 "/mtx_spin_found/\n"
333 "{\n"
334 " trace(\"Mutex spin\");\n"
335 " printa(@mtx_spin, @mtx_spin_count);\n"
336 "}\n"
337 "END\n"
338 "/mtx_vain_spin_found/\n"
339 "{\n"
340 " trace(\"Mutex unsuccessful spin\");\n"
341 " printa(@mtx_vain_spin, @mtx_vain_spin_count);\n"
342 "}\n"
343 "END\n"
344 "/rw_r_block_found/\n"
345 "{\n"
346 " trace(\"R/W reader block\");\n"
347 " printa(@rw_r_block, @rw_r_block_count);\n"
348 "}\n"
349 "END\n"
350 "/rw_w_block_found/\n"
351 "{\n"
352 " trace(\"R/W writer block\");\n"
353 " printa(@rw_w_block, @rw_w_block_count);\n"
354 "}\n";
364 #define PLOCKSTAT_OPTSTR "n:ps:e:vx:ACHV"
369 (void) fprintf(stderr, "Usage:\n" in usage()
370 "\t%s [-vACHV] [-n count] [-s depth] [-e secs] [-x opt[=val]]\n" in usage()
371 "\t command [arg...]\n" in usage()
372 "\t%s [-vACHV] [-n count] [-s depth] [-e secs] [-x opt[=val]]\n" in usage()
373 "\t -p pid\n", g_pname, g_pname); in usage()
386 if (fmt[strlen(fmt) - 1] != '\n') in verror()
387 (void) fprintf(stderr, ": %s\n", strerror(error)); in verror()
420 if (fmt != NULL && fmt[strlen(fmt) - 1] != '\n') { in dfatal()
421 (void) fprintf(stderr, ": %s\n", in dfatal()
424 (void) fprintf(stderr, "%s\n", in dfatal()
463 (void) fprintf(stderr, "%s: vvvv D program vvvv\n", g_pname); in dprog_compile()
465 (void) fprintf(stderr, "%s: ^^^^ D program ^^^^\n", g_pname); in dprog_compile()
472 if (dtrace_program_exec(g_dtp, prog, &info) == -1) in dprog_compile()
479 (void) printf("%5s %8s %-28s %s\n", "Count", "nsec", "Lock", "Caller"); in print_legend()
485 (void) printf("---------------------------------------" in print_bar()
486 "----------------------------------------\n"); in print_bar()
492 (void) printf("\n%10s ---- Time Distribution --- %5s %s\n", in print_histogram_header()
498 * is set, we return an error code if this symbol appears to be a mutex- or
499 * rwlock-related symbol in libc so the caller has a chance to find a more
528 size -= len; in getsym()
534 len = snprintf(buf, size, "%s`%s", map->pr_mapname, name); in getsym()
537 size -= len; in getsym()
540 len = snprintf(buf, size, "+%#lx", (unsigned long)(addr - sym.st_value)); in getsym()
542 if (nolocks && strcmp("libc.so.1", map->pr_mapname) == 0 && in getsym()
545 return (-1); in getsym()
567 rec = aggsdata[0]->dtada_desc->dtagd_rec; in process_aggregate()
568 data = aggsdata[0]->dtada_data; in process_aggregate()
570 /*LINTED - alignment*/ in process_aggregate()
572 /*LINTED - alignment*/ in process_aggregate()
576 /*LINTED - alignment*/ in process_aggregate()
577 sum = *(uint64_t *)(aggsdata[1]->dtada_data + in process_aggregate()
578 aggsdata[1]->dtada_desc->dtagd_rec[3].dtrd_offset); in process_aggregate()
579 /*LINTED - alignment*/ in process_aggregate()
580 count = *(uint64_t *)(aggsdata[2]->dtada_data + in process_aggregate()
581 aggsdata[2]->dtada_desc->dtagd_rec[3].dtrd_offset); in process_aggregate()
585 /*LINTED - alignment*/ in process_aggregate()
586 a = (uint64_t *)(aggsdata[1]->dtada_data + in process_aggregate()
587 aggsdata[1]->dtada_desc->dtagd_rec[3].dtrd_offset); in process_aggregate()
595 sum += a[i] << (j - 64); in process_aggregate()
606 (void) printf("%-28s ", buf); in process_aggregate()
612 (void) printf("%s\n", buf); in process_aggregate()
620 /*LINTED - alignment*/ in process_aggregate()
621 a = (uint64_t *)(aggsdata[1]->dtada_data + in process_aggregate()
622 aggsdata[1]->dtada_desc->dtagd_rec[3].dtrd_offset); in process_aggregate()
630 a[last_bin] == 0; last_bin--) in process_aggregate()
644 (void) printf("%10llu |%-24.*s| %5llu %s\n", in process_aggregate()
646 (first_bin - DTRACE_QUANTIZE_ZEROBUCKET), in process_aggregate()
651 (void) printf("%43s %s\n", "", buf); in process_aggregate()
673 int pid = Pstatus(P)->pr_pid; in prochandler()
681 notice("pid %d: %s\n", pid, msg); in prochandler()
696 notice("pid %d terminated by %s\n", pid, in prochandler()
700 notice("pid %d exited with status %d\n", in prochandler()
703 notice("pid %d has exited\n", pid); in prochandler()
709 notice("pid %d exec'd a set-id or unobservable program\n", pid); in prochandler()
719 dtrace_eprobedesc_t *epd = data->dtpda_edesc; in chewrec()
730 buf = data->dtpda_data - rec->dtrd_offset; in chewrec()
732 switch (rec->dtrd_action) { in chewrec()
734 (void) printf("\n%s\n\n", (char *)buf + rec->dtrd_offset); in chewrec()
742 for (nagv = 0, i = 0; i < epd->dtepd_nrecs - 1; i++) { in chewrec()
745 if (nrec->dtrd_uarg != rec->dtrd_uarg) in chewrec()
748 /*LINTED - alignment*/ in chewrec()
750 nrec->dtrd_offset); in chewrec()
796 fatal("dtrace_proc privilege required\n"); in main()
805 case 'n': in main()
810 "'%s'\n", g_pname, optarg); in main()
855 fatal("failed to initialize dtrace: %s\n", in main()
859 * The longest string we trace is 23 bytes long -- so 32 is plenty. in main()
861 if (dtrace_setopt(g_dtp, "strsize", "32") == -1) in main()
867 if (dtrace_setopt(g_dtp, "bufsize", "1k") == -1) in main()
873 if (dtrace_setopt(g_dtp, "aggsortrev", NULL) == -1) in main()
879 if (dtrace_setopt(g_dtp, "aggsize", "256k") == -1) in main()
881 if (dtrace_setopt(g_dtp, "aggrate", "1sec") == -1) in main()
893 if (dtrace_setopt(g_dtp, "ustackframes", optarg) == -1) in main()
902 dfatal("failed to set -x %s", optarg); in main()
908 if (*optarg == '-' || *end != '\0' || errno != 0) { in main()
910 "'%s'\n", g_pname, optarg); in main()
918 dprog_add("BEGIN\n{\n\tend = timestamp + "); in main()
920 dprog_add(" * 1000000000;\n}\n"); in main()
921 dprog_add("tick-10hz\n/timestamp >= end/\n"); in main()
922 dprog_add("{\n\texit(0);\n}\n"); in main()
927 argc -= optind; in main()
950 (void) fprintf(stderr, "%s: only one pid is allowed\n", in main()
958 (void) fprintf(stderr, "%s: invalid pid '%s'\n", in main()
972 if (dtrace_handle_proc(g_dtp, &prochandler, NULL) == -1) in main()
990 (void) printf("%s: tracing enabled for pid %d\n", g_pname, in main()
992 (int)Pstatus(g_pr)->pr_pid); in main()
1003 if (dtrace_stop(g_dtp) == -1) in main()