# Ktrace

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Ktrace
> Markdown URL: https://mediated.wiki/source/Ktrace.md
> Source: https://en.wikipedia.org/wiki/Ktrace
> Source revision: 1302983300
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Software}}
{{Lowercase title}}
{{Infobox software
| name                   = ktrace
| programming language   = [C](/source/C_(programming_language))<ref>{{cite web|url=https://cgit.freebsd.org/src/plain/usr.bin/ktrace/ktrace.c|title=C source of ktrace utility in FreeBSD|website=cgit.freebsd.org|access-date=2024-03-07}}</ref>
| operating system       = [BSD Unix](/source/BSD_Unix) and [Mac OS X](/source/Mac_OS_X)
| language               = [English](/source/English_language)
| genre                  = [Tracing](/source/Tracing_(software))
}}

'''ktrace''' is a [utility](/source/utility) included with certain versions of [BSD Unix](/source/BSD_Unix) and [Mac OS X](/source/Mac_OS_X) that [traces](/source/Tracing_(software)) [kernel](/source/kernel_(operating_system)) interaction with a program and dumps it to disk for the purposes of [debugging](/source/debugging) and analysis.  Traced kernel operations include [system call](/source/system_call)s, name translations, [signal](/source/Unix_signal) processing, and [I/O](/source/I%2FO).<ref>{{cite web |url=http://www.freebsd.org/cgi/man.cgi?ktrace |title=ktrace(1) manpage |website=freebsd.org |date=2012-05-31 |access-date=2014-07-23}}</ref>

Trace files generated by ktrace (named {{mono|ktrace.out}} by default) can be viewed in human-readable form by using the '''kdump''' utility.<ref>{{cite web |url=http://www.freebsd.org/cgi/man.cgi?kdump |title=kdump(1) manpage |website=freebsd.org |date=2014-03-28 |access-date=2014-07-23}}</ref>

Since [Mac OS X Leopard](/source/Mac_OS_X_Leopard), ktrace has been replaced by [DTrace](/source/DTrace).<ref>{{cite web|url=https://discussions.apple.com/thread/1756145|title=What happened to ktrace and kdump|website=discussions.apple.com|date=2008-10-17}}</ref> The identically-named ktrace program in recent macOS versions does not have the same functions as this utility.

== See also ==
* [DTrace](/source/DTrace), Sun Microsystems's trace version, now running on OpenSolaris, FreeBSD, macOS, and Windows
* [kdump (Linux)](/source/kdump_(Linux)), Linux kernel's crash dump mechanism, which internally uses kexec
* [SystemTap](/source/SystemTap)
* [trace](/source/Linux_Trace_Toolkit) on Linux, part of the Linux Trace Toolkit

== References ==
{{Reflist}}

{{Mac-software-stub}}
{{unix-stub}}

Category:Unix programming tools

---
Adapted from the Wikipedia article [Ktrace](https://en.wikipedia.org/wiki/Ktrace) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Ktrace?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
