Lines Matching +full:pre +full:- +full:boot
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2008-2022 NetApp, Inc.
47 static MALLOC_DEFINE(M_BOOTTRACE, "boottrace", "memory for boot tracing");
55 * Boot-time & shutdown-time event.
72 uint32_t wrap; /* Wrap-around, instead of dropping */
78 /* Boot-time tracing */
81 /* Run-time tracing */
84 /* Shutdown-time tracing */
87 /* Set when system boot is complete, and we've switched to runtime tracing. */
121 "Capture a boot-time trace event");
125 "Capture a run-time trace event");
129 "Capture a shutdown-time trace event");
133 "Reset run-time tracing table");
141 "Boot-time and shutdown-time tracing enabled");
162 "Boot-time tracing table size");
167 * Non-zero delta_threshold selectively prints entries based on delta
174 * 11 1228262715 0 init shutdown pre sync begin
175 * 3 1228265622 2907 init shutdown pre sync complete
185 * For example, above: Pre-Sync is taking 2907ms, and something between swap and unmount
194 sbuf_printf(sbp, fmt, (bte)->cpuid, msecs, delta, \
195 (bte)->tdname, (bte)->name, (bte)->pid, \
196 (bte)->cputime / 1000000, \
197 ((bte)->cputime % 1000000) / 10000, \
198 (bte)->inblock, (bte)->oublock); \
200 printf(fmt, (bte)->cpuid, msecs, delta, \
201 (bte)->tdname, (bte)->name, (bte)->pid, \
202 (bte)->cputime / 1000000, \
203 ((bte)->cputime % 1000000) / 10000, \
204 (bte)->inblock, (bte)->oublock); \
226 const char *fmt = "%3u %10llu %10llu %-24s %-40s %5d %4d.%02d %5u %5u\n"; in boottrace_display()
227 const char *hdr_fmt = "\n\n%3s %10s %10s %-24s %-40s %5s %6s %5s %5s\n"; in boottrace_display()
246 i = curr = btp->curr; in boottrace_display()
249 evtp = &btp->table[i]; in boottrace_display()
250 if (evtp->tsc == 0) in boottrace_display()
253 msecs = cputick2usec(evtp->tick) / 1000; in boottrace_display()
255 msecs - last_msecs : 0; in boottrace_display()
284 i = (i + 1) % btp->size; in boottrace_display()
288 (last_msecs - first_msecs) : 0; in boottrace_display()
328 tdname = (curproc->p_flag & P_SYSTEM) ? in dotrace()
329 curthread->td_name : curproc->p_comm; in dotrace()
333 PCPU_GET(cpuid), curthread->td_proc->p_pid, in dotrace()
335 if (btp->table == NULL) { in dotrace()
336 btp->drops_early++; in dotrace()
343 idx = btp->curr; in dotrace()
344 nxt = (idx + 1) % btp->size; in dotrace()
345 if (nxt == 0 && btp->wrap == 0) { in dotrace()
346 btp->drops_full++; in dotrace()
350 } while (!atomic_cmpset_int(&btp->curr, idx, nxt)); in dotrace()
352 btp->table[idx].cpuid = PCPU_GET(cpuid); in dotrace()
353 btp->table[idx].tsc = get_cyclecount(), in dotrace()
354 btp->table[idx].tick = cpu_ticks(); in dotrace()
355 btp->table[idx].pid = curthread->td_proc->p_pid; in dotrace()
361 if ((curthread->td_proc == &proc0) || (curthread->td_critnest != 0)) { in dotrace()
362 btp->table[idx].cputime = 0; in dotrace()
363 btp->table[idx].inblock = 0; in dotrace()
364 btp->table[idx].oublock = 0; in dotrace()
367 btp->table[idx].cputime = in dotrace()
371 btp->table[idx].inblock = (uint32_t)usage.ru_inblock; in dotrace()
372 btp->table[idx].oublock = (uint32_t)usage.ru_oublock; in dotrace()
374 strlcpy(btp->table[idx].name, eventname, BT_EVENT_NAMELEN); in dotrace()
375 strlcpy(btp->table[idx].tdname, tdname, BT_EVENT_TDNAMELEN); in dotrace()
382 * Log various boot-time events, with the trace message encoded using
383 * printf-like arguments.
409 * Log a run-time event & switch over to run-time tracing mode.
438 *tdname = curproc->p_comm; in boottrace_parse_message()
474 if (!boottrace_enabled || req->newptr != NULL) in sysctl_log()
495 if (req->newptr == NULL) in sysctl_boottrace()
498 /* Trace to rt if we have reached multi-user. */ in sysctl_boottrace()
503 * Log a run-time event and switch over to run-time tracing mode.
513 if (req->newptr == NULL) in sysctl_runtrace()
521 * Log a shutdown-time event and switch over to shutdown tracing mode.
531 if (req->newptr == NULL) in sysctl_shuttrace()
575 if (req->newptr != NULL) in sysctl_boottrace_reset()
601 /* Run-time trace table (may wrap-around). */ in boottrace_init()