'\" t .\" Title: trace-cmd.dat .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 09/11/2020 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" .TH "TRACE\-CMD\&.DAT" "5" "09/11/2020" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" trace-cmd.dat \- trace\-cmd file format .SH "DESCRIPTION" .sp The trace\-cmd(1) utility produces a "trace\&.dat" file\&. The file may also be named anything depending if the user specifies a different output name, but it must have a certain binary format\&. The file is used by trace\-cmd to save kernel traces into it and be able to extract the trace from it at a later point (see \fBtrace\-cmd\-report(1)\fR)\&. .SH "INITIAL FORMAT" .sp .if n \{\ .RS 4 .\} .nf The first three bytes contain the magic value: .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf 0x17 0x08 0x44 .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 7 bytes contain the characters: .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf "tracing" .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next set of characters contain a null \*(Aq\e0\*(Aq terminated string that contains the version of the file (for example): .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf "6\e0" .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 1 byte contains the flags for the file endianess: .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf 0 = little endian 1 = big endian .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next byte contains the number of bytes per "long" value: .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf 4 \- 32\-bit long values 8 \- 64\-bit long values .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf Note: This is the long size of the target\*(Aqs userspace\&. Not the kernel space size\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf [ Now all numbers are written in file defined endianess\&. ] .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 4 bytes are a 32\-bit word that defines what the traced host machine page size was\&. .fi .if n \{\ .RE .\} .SH "HEADER INFO FORMAT" .sp .if n \{\ .RS 4 .\} .nf Directly after the initial format comes information about the trace headers recorded from the target box\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 12 bytes contain the string: .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf "header_page\e0" .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 8 bytes are a 64\-bit word containing the size of the page header information stored next\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next set of data is of the size read from the previous 8 bytes, and contains the data retrieved from debugfs/tracing/events/header_page\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf Note: The size of the second field \efBcommit\efR contains the target kernel long size\&. For example: .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf field: local_t commit; offset:8; \efBsize:8;\efR signed:1; .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf shows the kernel has a 64\-bit long\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 13 bytes contain the string: .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf "header_event\e0" .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 8 bytes are a 64\-bit word containing the size of the event header information stored next\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next set of data is of the size read from the previous 8 bytes and contains the data retrieved from debugfs/tracing/events/header_event\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf This data allows the trace\-cmd tool to know if the ring buffer format of the kernel made any changes\&. .fi .if n \{\ .RE .\} .SH "FTRACE EVENT FORMATS" .sp .if n \{\ .RS 4 .\} .nf Directly after the header information comes the information about the Ftrace specific events\&. These are the events used by the Ftrace plugins and are not enabled by the event tracing\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 4 bytes contain a 32\-bit word of the number of Ftrace event format files that are stored in the file\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf For the number of times defined by the previous 4 bytes is the following: .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf 8 bytes for the size of the Ftrace event format file\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The Ftrace event format file copied from the target machine: debugfs/tracing/events/ftrace//format .fi .if n \{\ .RE .\} .SH "EVENT FORMATS" .sp .if n \{\ .RS 4 .\} .nf Directly after the Ftrace formats comes the information about the event layout\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 4 bytes are a 32\-bit word containing the number of event systems that are stored in the file\&. These are the directories in debugfs/tracing/events excluding the \efBftrace\efR directory\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf For the number of times defined by the previous 4 bytes is the following: .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf A null\-terminated string containing the system name\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf 4 bytes containing a 32\-bit word containing the number of events within the system\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf For the number of times defined in the previous 4 bytes is the following: .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf 8 bytes for the size of the event format file\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The event format file copied from the target machine: debugfs/tracing/events///format .fi .if n \{\ .RE .\} .SH "KALLSYMS INFORMATION" .sp .if n \{\ .RS 4 .\} .nf Directly after the event formats comes the information of the mapping of function addresses to the function names\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 4 bytes are a 32\-bit word containing the size of the data holding the function mappings\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next set of data is of the size defined by the previous 4 bytes and contains the information from the target machine\*(Aqs file: /proc/kallsyms .fi .if n \{\ .RE .\} .SH "TRACE_PRINTK INFORMATION" .sp .if n \{\ .RS 4 .\} .nf If a developer used trace_printk() within the kernel, it may store the format string outside the ring buffer\&. This information can be found in: debugfs/tracing/printk_formats .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 4 bytes are a 32\-bit word containing the size of the data holding the printk formats\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next set of data is of the size defined by the previous 4 bytes and contains the information from debugfs/tracing/printk_formats\&. .fi .if n \{\ .RE .\} .SH "PROCESS INFORMATION" .sp .if n \{\ .RS 4 .\} .nf Directly after the trace_printk formats comes the information mapping a PID to a process name\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 8 bytes contain a 64\-bit word that holds the size of the data mapping the PID to a process name\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next set of data is of the size defined by the previous 8 bytes and contains the information from debugfs/tracing/saved_cmdlines\&. .fi .if n \{\ .RE .\} .SH "REST OF TRACE\-CMD HEADER" .sp .if n \{\ .RS 4 .\} .nf Directly after the process information comes the last bit of the trace\&.dat file header\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 4 bytes are a 32\-bit word defining the number of CPUs that were discovered on the target machine (and has matching trace data for it)\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 10 bytes are one of the following: .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf "options \e0" .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf "latency \e0" .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf "flyrecord\e0" .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf If it is "options \e0" then: .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 2 bytes are a 16\-bit word defining the current option\&. If the the value is zero then there are no more options\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf Otherwise, the next 4 bytes contain a 32\-bit word containing the option size\&. If the reader does not know how to handle the option it can simply skip it\&. Currently there are no options defined, but this is here to extend the data\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next option will be directly after the previous option, and the options ends with a zero in the option type field\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The next 10 bytes after the options are one of the following: .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf "latency \e0" .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf "flyrecord\e0" .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf which would follow the same as if options were not present\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf If the value is "latency \e0", then the rest of the file is simply ASCII text that was taken from the target\*(Aqs: debugfs/tracing/trace .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf If the value is "flyrecord\e0", the following is present: .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf For the number of CPUs that were read earlier, the following is present: .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf 8 bytes that are a 64\-bit word containing the offset into the file that holds the data for the CPU\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf 8 bytes that are a 64\-bit word containing the size of the CPU data at that offset\&. .fi .if n \{\ .RE .\} .SH "CPU DATA" .sp .if n \{\ .RS 4 .\} .nf The CPU data is located in the part of the file that is specified in the end of the header\&. Padding is placed between the header and the CPU data, placing the CPU data at a page aligned (target page) position in the file\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf This data is copied directly from the Ftrace ring buffer and is of the same format as the ring buffer specified by the event header files loaded in the header format file\&. .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf The trace\-cmd tool will try to \efBmmap(2)\efR the data page by page with the target\*(Aqs page size if possible\&. If it fails to mmap, it will just read the data instead\&. .fi .if n \{\ .RE .\} .SH "SEE ALSO" .sp trace\-cmd(1), trace\-cmd\-record(1), trace\-cmd\-report(1), trace\-cmd\-start(1), trace\-cmd\-stop(1), trace\-cmd\-extract(1), trace\-cmd\-reset(1), trace\-cmd\-split(1), trace\-cmd\-list(1), trace\-cmd\-listen(1), trace\-cmd\&.dat(5) .SH "AUTHOR" .sp Written by Steven Rostedt, <\m[blue]\fBrostedt@goodmis\&.org\fR\m[]\&\s-2\u[1]\d\s+2> .SH "RESOURCES" .sp git://git\&.kernel\&.org/pub/scm/linux/kernel/git/rostedt/trace\-cmd\&.git .SH "COPYING" .sp Copyright (C) 2010 Red Hat, Inc\&. Free use of this software is granted under the terms of the GNU Public License (GPL)\&. .SH "NOTES" .IP " 1." 4 rostedt@goodmis.org .RS 4 \%mailto:rostedt@goodmis.org .RE