ktrace can configure the system to trace events, or record them to a file, and print a human-readable representation of the events.