1TRACE-CMD.DAT(5) TRACE-CMD.DAT(5)
2
3
4
6 trace-cmd.dat - trace-cmd file format
7
9 The trace-cmd(1) utility produces a "trace.dat" file. The file may also
10 be named anything depending if the user specifies a different output
11 name, but it must have a certain binary format. The file is used by
12 trace-cmd to save kernel traces into it and be able to extract the
13 trace from it at a later point (see trace-cmd-report(1)).
14
16 The first three bytes contain the magic value:
17
18 0x17 0x08 0x44
19
20 The next 7 bytes contain the characters:
21
22 "tracing"
23
24 The next set of characters contain a null '\0' terminated string
25 that contains the version of the file (for example):
26
27 "6\0"
28
29 The next 1 byte contains the flags for the file endianess:
30
31 0 = little endian
32 1 = big endian
33
34 The next byte contains the number of bytes per "long" value:
35
36 4 - 32-bit long values
37 8 - 64-bit long values
38
39 Note: This is the long size of the target's userspace. Not the
40 kernel space size.
41
42 [ Now all numbers are written in file defined endianess. ]
43
44 The next 4 bytes are a 32-bit word that defines what the traced
45 host machine page size was.
46
48 Directly after the initial format comes information about the
49 trace headers recorded from the target box.
50
51 The next 12 bytes contain the string:
52
53 "header_page\0"
54
55 The next 8 bytes are a 64-bit word containing the size of the
56 page header information stored next.
57
58 The next set of data is of the size read from the previous 8 bytes,
59 and contains the data retrieved from debugfs/tracing/events/header_page.
60
61 Note: The size of the second field \fBcommit\fR contains the target
62 kernel long size. For example:
63
64 field: local_t commit; offset:8; \fBsize:8;\fR signed:1;
65
66 shows the kernel has a 64-bit long.
67
68 The next 13 bytes contain the string:
69
70 "header_event\0"
71
72 The next 8 bytes are a 64-bit word containing the size of the
73 event header information stored next.
74
75 The next set of data is of the size read from the previous 8 bytes
76 and contains the data retrieved from debugfs/tracing/events/header_event.
77
78 This data allows the trace-cmd tool to know if the ring buffer format
79 of the kernel made any changes.
80
82 Directly after the header information comes the information about
83 the Ftrace specific events. These are the events used by the Ftrace plugins
84 and are not enabled by the event tracing.
85
86 The next 4 bytes contain a 32-bit word of the number of Ftrace event
87 format files that are stored in the file.
88
89 For the number of times defined by the previous 4 bytes is the
90 following:
91
92 8 bytes for the size of the Ftrace event format file.
93
94 The Ftrace event format file copied from the target machine:
95 debugfs/tracing/events/ftrace/<event>/format
96
98 Directly after the Ftrace formats comes the information about
99 the event layout.
100
101 The next 4 bytes are a 32-bit word containing the number of
102 event systems that are stored in the file. These are the
103 directories in debugfs/tracing/events excluding the \fBftrace\fR
104 directory.
105
106 For the number of times defined by the previous 4 bytes is the
107 following:
108
109 A null-terminated string containing the system name.
110
111 4 bytes containing a 32-bit word containing the number
112 of events within the system.
113
114 For the number of times defined in the previous 4 bytes is the
115 following:
116
117 8 bytes for the size of the event format file.
118
119 The event format file copied from the target machine:
120 debugfs/tracing/events/<system>/<event>/format
121
123 Directly after the event formats comes the information of the mapping
124 of function addresses to the function names.
125
126 The next 4 bytes are a 32-bit word containing the size of the
127 data holding the function mappings.
128
129 The next set of data is of the size defined by the previous 4 bytes
130 and contains the information from the target machine's file:
131 /proc/kallsyms
132
134 If a developer used trace_printk() within the kernel, it may
135 store the format string outside the ring buffer.
136 This information can be found in:
137 debugfs/tracing/printk_formats
138
139 The next 4 bytes are a 32-bit word containing the size of the
140 data holding the printk formats.
141
142 The next set of data is of the size defined by the previous 4 bytes
143 and contains the information from debugfs/tracing/printk_formats.
144
146 Directly after the trace_printk formats comes the information mapping
147 a PID to a process name.
148
149 The next 8 bytes contain a 64-bit word that holds the size of the
150 data mapping the PID to a process name.
151
152 The next set of data is of the size defined by the previous 8 bytes
153 and contains the information from debugfs/tracing/saved_cmdlines.
154
156 Directly after the process information comes the last bit of the
157 trace.dat file header.
158
159 The next 4 bytes are a 32-bit word defining the number of CPUs that
160 were discovered on the target machine (and has matching trace data
161 for it).
162
163 The next 10 bytes are one of the following:
164
165 "options \0"
166
167 "latency \0"
168
169 "flyrecord\0"
170
171 If it is "options \0" then:
172
173 The next 2 bytes are a 16-bit word defining the current option.
174 If the the value is zero then there are no more options.
175
176 Otherwise, the next 4 bytes contain a 32-bit word containing the
177 option size. If the reader does not know how to handle the option
178 it can simply skip it. Currently there are no options defined,
179 but this is here to extend the data.
180
181 The next option will be directly after the previous option, and
182 the options ends with a zero in the option type field.
183
184 The next 10 bytes after the options are one of the following:
185
186 "latency \0"
187
188 "flyrecord\0"
189
190 which would follow the same as if options were not present.
191
192 If the value is "latency \0", then the rest of the file is
193 simply ASCII text that was taken from the target's:
194 debugfs/tracing/trace
195
196 If the value is "flyrecord\0", the following is present:
197
198 For the number of CPUs that were read earlier, the
199 following is present:
200
201 8 bytes that are a 64-bit word containing the offset into the file
202 that holds the data for the CPU.
203
204 8 bytes that are a 64-bit word containing the size of the CPU
205 data at that offset.
206
208 The CPU data is located in the part of the file that is specified
209 in the end of the header. Padding is placed between the header and
210 the CPU data, placing the CPU data at a page aligned (target page) position
211 in the file.
212
213 This data is copied directly from the Ftrace ring buffer and is of the
214 same format as the ring buffer specified by the event header files
215 loaded in the header format file.
216
217 The trace-cmd tool will try to \fBmmap(2)\fR the data page by page with the
218 target's page size if possible. If it fails to mmap, it will just read the
219 data instead.
220
222 trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1),
223 trace-cmd-start(1), trace-cmd-stop(1), trace-cmd-extract(1),
224 trace-cmd-reset(1), trace-cmd-split(1), trace-cmd-list(1),
225 trace-cmd-listen(1), trace-cmd.dat(5)
226
228 Written by Steven Rostedt, <rostedt@goodmis.org[1]>
229
231 git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
232
234 Copyright (C) 2010 Red Hat, Inc. Free use of this software is granted
235 under the terms of the GNU Public License (GPL).
236
238 1. rostedt@goodmis.org
239 mailto:rostedt@goodmis.org
240
241
242
243 12/02/2020 TRACE-CMD.DAT(5)