Commit Graph

11 Commits

Author SHA1 Message Date
Jake Burkholder
ef73ae4b0c Use PCPU_GET, PCPU_PTR and PCPU_SET to access all per-cpu variables
other then curproc.
2001-01-10 04:43:51 +00:00
John Baldwin
a0a7328bb0 - Move all of the KTR sysctl's under a new debug.ktr mib.
- Provide TUNABLE_INT() hooks for ktr_cpumask, ktr_mask, and ktr_verbose
  so that they can be set from the loader by their respective sysctl names.
  For example, to turn on KTR_INTR and KTR_PROC in ktr_mask, one could
  stick 'debug.ktr.mask="0x1200"' in /boot/loader.conf.
2001-01-06 06:51:43 +00:00
Greg Lehey
7fcd0cb31a Partially revert revision 1.7: Only use getnanotime instead of
nanotime if we would run into trouble with nanotime (i.e. if we are
tracing KTR_LOCK).

Reviewed by: 	jhb
2000-12-29 06:27:39 +00:00
John Baldwin
de3622188a Add in MI implementations of the KTR trace buffer ddb commands. The
commands have also been slightly updated as follows:
- Use ktr_idx to find the newest entry rather than walking the buffer
  comparing timespecs.  Timespecs are not always unique after the change
  to use getnanotime(9).
- Add a new verbose setting.  When the verbose setting is on, then the
  timestamp is printed with each message.  If KTR_EXTEND is on, then the
  filename and line number are output as well.  By default this option is
  off.  It can be turned on with the 'v' modifier passed to the 'tbuf'
  and 'tall' commands.  For the 'tnext' command, the 'v' modifier toggles
  the verbose mode.
- Only display the cpu number for each message on SMP systems.
- Don't display anything for an empty entry that hasn't been used yet.
2000-12-15 00:01:20 +00:00
John Baldwin
d664747bfa - Don't bother taking a trace message if we have panic'd since doing so
can lead to further panics.
- Call getnanotime() instead of nanotime() for the timestamp.  nanotime()
  is more precise, but it also calls into the timer code, which results
  in mutex operations on the i386 arch.  If KTR_LOCK is turned on, then
  ktr_tracepoint() recurses on itself until it exhausts the kernel stack.
  Eventually this should change to use get_cyclecount() instead, but that
  can't happen if get_cyclecount() is calling nanotime() instead of
  getnanotime().
2000-12-12 00:43:50 +00:00
John Baldwin
0959cc6680 Ahem, fix the disclaimer portion of the copyright so it disclaim's the
voices in my head.  You can sue the voices in Bill Paul's head all you
want.

Noticed by:	jhb
2000-11-21 21:10:15 +00:00
John Baldwin
22f1b34223 Make ktr_verbose a bit more useful:
- On SMP systems display the cpu number with each message
- If ktr_verbose > 1, then include the filename and line number with each
  trace message
2000-11-15 21:51:53 +00:00
John Baldwin
20af769e69 Don't overwrite the filename for KTR_EXTEND with "../../kern/kern_ktr.c". 2000-11-10 22:30:44 +00:00
John Baldwin
bf619f9506 Fix SMP kernel compiles by #include'ing machine/globals.h to get the
cpuid variable.
2000-11-10 21:52:04 +00:00
John Baldwin
d8f03321bd - Remove much of the inlining of the KTR tracepoints into a ktr_tracepoint()
function declared in kern_ktr.c.  The only inline checks left are the
  checks that compare KTR_COMPILE with the supplied mask and thus should
  be optimized away into either nothing or a direct call to ktr_tracepoint().
- Move several KTR-related options to opt_ktr.h now that they are only
  needed by kern_ktr.c and not by ktr.h.
- Add in the ktr_verbose functionality if KTR_EXTEND is turned on.  If the
  global variable 'ktr_verbose' is non-zero, then KTR messages will be
  dumped to the console.  This variable can be set by either kernel code
  or via the 'debug.ktr_verbose' sysctl.  It defaults to off unless the
  KTR_VERBOSE kernel option is specified in which case it defaults to on.
  This can be useful when the machine locks up spinning in a loop with
  interrupts disabled as you might be able to see what it is doing when it
  locks up.

Requested by:	phk
2000-11-07 01:49:48 +00:00
Jason Evans
62ae6c89ad Add KTR, a facility that logs kernel events in order to to facilitate
debugging.

Acquired from:	BSDi (BSD/OS)
Submitted by:	dfr, grog, jake, jhb
2000-09-07 01:29:44 +00:00