Page MenuHomeFreeBSD

tracing.7: Add a single reference point for tracing facilities in FreeBSD
ClosedPublic

Authored by 0mp on Sat, Jun 14, 5:42 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jun 25, 12:00 AM
Unknown Object (File)
Wed, Jun 25, 12:00 AM
Unknown Object (File)
Wed, Jun 25, 12:00 AM
Unknown Object (File)
Wed, Jun 25, 12:00 AM
Unknown Object (File)
Wed, Jun 25, 12:00 AM
Unknown Object (File)
Mon, Jun 23, 7:46 PM
Unknown Object (File)
Mon, Jun 23, 7:45 PM
Unknown Object (File)
Mon, Jun 23, 7:31 PM
Subscribers

Details

Summary

FreeBSD has a fair number of tracing facilities. The new tracing(7)
manual page aims to provide a starting point for users to learn about
what is available.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

0mp requested review of this revision.Sat, Jun 14, 5:42 PM

LGTM with some minor nitpicks.

share/man/man7/tracing.7
5

Changed surname? :-D

17

Some of it can be part of the line above.

21

Ditto.

51

Ditto.

58

Ditto.

This revision is now accepted and ready to land.Sat, Jun 14, 5:47 PM
share/man/man7/tracing.7
47

Despite the similar names, ktr(4) and ktrace(1) are completely unrelated.

KTR just a facility for logging strings in the kernel. It's very primitive, there's just a global ring buffer in the kernel that can be dumped with ktrdump(8) or via ddb. It's not compiled into the kernel by default, so not very convenient to use. It's still handy for some niche purposes, but it's really aimed at kernel developers.

share/man/man7/tracing.7
24
28

I would maybe drop the "drivers" part since they are a subset of the kernelspace things you can trace.

christos added inline comments.
share/man/man7/tracing.7
33

Should we make mention to the dtrace provider man pages, except SDT?

50
This revision now requires changes to proceed.Sat, Jun 14, 5:53 PM
0mp marked 5 inline comments as done.Sat, Jun 14, 5:55 PM
0mp added inline comments.
share/man/man7/tracing.7
17

I have to break this line somewhere and I think this is a good place to do it. Thanks for the heads-up.

21

Hitting 80 characters there hence the break.

0mp marked 2 inline comments as done.

Address feedback from Christos.

share/man/man7/tracing.7
21

If you combine the whole line it gets to 79 characters.

0mp marked an inline comment as done.Sat, Jun 14, 5:57 PM
0mp added inline comments.
share/man/man7/tracing.7
33

I considered that, but decided against that for now because dtrace(1) mentions those now and I'd like to avoid bit rot in this manual page by having an outdated list in the future.

0mp marked 5 inline comments as done.
  • Add dwatch
  • Add subsections
  • Start paragraphs with an Xr
  • Fix descriptions of KTR and ktrace
  • Typos?
0mp marked an inline comment as done.Sat, Jun 14, 6:34 PM
0mp added inline comments.
share/man/man7/tracing.7
21

Hmm, old news then. Thanks for noticing!

47

Thanks! I did not know. I addressed that.

share/man/man7/Makefile
33
share/man/man7/tracing.7
2

This dash was for a parser Warner abandoned

60–61
0mp marked 4 inline comments as done.
  • Address freeback from ziaee
This revision is now accepted and ready to land.Sat, Jun 14, 6:45 PM
share/man/man7/tracing.7
19

I might add a hedge, like "and potentially on production systems"--some of these features have high overhead.

35
43

It's a bit odd to describe truss as an alternative to dtrace when dtrace is in the "kernel tracing" section while here we're in "userland tracing".

I would just explain directly what it does: it traces system calls and pretty-prints arguments. It uses sysdecode(3) for the latter purpose, which would be nice to reference here.

ktrace also belongs here, it's mostly for debugging user programs. Like truss, it mainly traces system calls, but 1) it doesn't use ptrace(2), it asynchronously logs entries to a file (typically ktrace.out), configured with ktrace(2) 2) it can log other types of events, e.g., page faults, name lookups, etc. (see the documentation for -t in the ktrace(1) docs).

46

I would argue that "one of the classic interfaces" is a bit unclear here: what are the other classic interfaces? What does "classic" mean here? I think this can be phrased more simply.

49

I think this is supposed to be, "The domain of kernel tracing does not belong solely to dtrace"? I'm not sure this sentence is very useful.

53

Let's maybe be more specific? "It lets kernel programmers log events to a global ring buffer, which can later be dumped using ktrdump(8)."

0mp planned changes to this revision.Tue, Jun 17, 2:15 PM

Thanks, Mark! I'll work on that and update the revision soon

0mp marked 3 inline comments as done.
  • Address some of Mark's feedback
  • There is still some larger bits to address

I've addressed some items. I'm still working on other bits raised by Mark.

0mp planned changes to this revision.Wed, Jun 18, 5:34 PM
0mp marked 2 inline comments as done.
  • Drop unnecessary mentions of DTrace from Kernel Tracing
  • Move ktrace out of Kernel Tracing
  • Do a better job of explaining what truss is and how it works
share/man/man7/tracing.7
43

Thanks a lot, Mark. It clarifies a lot. I've incorporated your notes into the manual.

49

Good point. I'll just drop that. I wanted to note here that DTrace can be used for kernel tracing but considering that this manual page is just a short intro to available tracers, there is no need to create those little notes for users. If someone ends up reading tracing(7), they will surely not miss the DTrace section that says DTrace is useful for both kernel and userland tracing.

0mp marked an inline comment as done.Wed, Jun 18, 6:02 PM
markj added inline comments.
share/man/man7/tracing.7
59
64

It might also be worth mentioning utrace(2) here: it's a system call which lets programs log to a ktrace stream.

This revision is now accepted and ready to land.Wed, Jun 18, 7:32 PM
0mp marked an inline comment as done.Wed, Jun 18, 10:16 PM