diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2010-03-26 15:11:23 -0400 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2010-03-26 15:11:23 -0400 |
| commit | aa77b2d95d404e9e0e1e9687f69a5fd70db6bc11 (patch) | |
| tree | 6780671de9fd8ee4055407db5160e11f586f4567 /Documentation | |
| parent | 46b673123d4dc4a03b4273ff1734772c6a618624 (diff) | |
Documentation: Added trace-cmd.dat.5.txt
Added a documentation man page on the format of the trace.dat file.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'Documentation')
| -rw-r--r-- | Documentation/Makefile | 28 | ||||
| -rw-r--r-- | Documentation/trace-cmd.1.txt | 3 | ||||
| -rw-r--r-- | Documentation/trace-cmd.dat.5.txt | 267 |
3 files changed, 292 insertions, 6 deletions
diff --git a/Documentation/Makefile b/Documentation/Makefile index 72c9bad..f7f777f 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile | |||
| @@ -35,6 +35,14 @@ do_xsltproc_build = \ | |||
| 35 | xsltproc --nonet -o $@ ${MANPAGE_DOCBOOK_XSL} $< $(hide_xsltproc_output)) | 35 | xsltproc --nonet -o $@ ${MANPAGE_DOCBOOK_XSL} $< $(hide_xsltproc_output)) |
| 36 | 36 | ||
| 37 | # | 37 | # |
| 38 | # asciidoc requires a synopsis, but file format man pages (5) do | ||
| 39 | # not require them. This removes it from the file in the final step. | ||
| 40 | define remove_synopsis | ||
| 41 | (sed -e '/^\.SH "SYNOPSIS"/,/^\.sp/d' $1 > $1.tmp;\ | ||
| 42 | mv $1.tmp $1) | ||
| 43 | endef | ||
| 44 | |||
| 45 | # | ||
| 38 | # Most likely a docbook.xsl is already installed on the users system | 46 | # Most likely a docbook.xsl is already installed on the users system |
| 39 | # instead of creating a new wheel, lets reuse what's already there. | 47 | # instead of creating a new wheel, lets reuse what's already there. |
| 40 | # | 48 | # |
| @@ -49,10 +57,17 @@ $(obj)/%.1: $(obj)/%.1.xsl | |||
| 49 | @$(call manpage.xsl) | 57 | @$(call manpage.xsl) |
| 50 | $(Q)$(do_xsltproc_build) | 58 | $(Q)$(do_xsltproc_build) |
| 51 | 59 | ||
| 60 | $(obj)/%.5: $(obj)/%.5.xsl | ||
| 61 | @$(call manpage.xsl) | ||
| 62 | $(Q)$(do_xsltproc_build) | ||
| 63 | $(Q)$(call remove_synopsis, $@) | ||
| 64 | |||
| 52 | TEXT1 = $(wildcard *.1.txt) | 65 | TEXT1 = $(wildcard *.1.txt) |
| 53 | MAN1 = $(patsubst %.1.txt,$(obj)/%.1, ${TEXT1}) | 66 | MAN1 = $(patsubst %.1.txt,$(obj)/%.1, ${TEXT1}) |
| 67 | TEXT5 = $(wildcard *.5.txt) | ||
| 68 | MAN5 = $(patsubst %.5.txt,$(obj)/%.5, ${TEXT5}) | ||
| 54 | 69 | ||
| 55 | all: $(MAN1) | 70 | all: $(MAN1) $(MAN5) |
| 56 | 71 | ||
| 57 | define do_install | 72 | define do_install |
| 58 | $(print_install) \ | 73 | $(print_install) \ |
| @@ -62,16 +77,19 @@ define do_install | |||
| 62 | $(INSTALL) $1 $2; | 77 | $(INSTALL) $1 $2; |
| 63 | endef | 78 | endef |
| 64 | 79 | ||
| 65 | MAN1_INSTALL = $(subst .1,.install,$(MAN1)) | 80 | MAN1_INSTALL = $(subst .1,.1.install,$(MAN1)) |
| 81 | MAN5_INSTALL = $(subst .5,.5.install,$(MAN5)) | ||
| 66 | 82 | ||
| 67 | $(MAN1_INSTALL): %.install : %.1 force | 83 | $(MAN1_INSTALL): %.1.install : %.1 force |
| 68 | $(Q)$(call do_install, $<, '$(man_dir_SQ)/man1') | 84 | $(Q)$(call do_install, $<, '$(man_dir_SQ)/man1') |
| 85 | $(MAN5_INSTALL): %.5.install : %.5 force | ||
| 86 | $(Q)$(call do_install, $<, '$(man_dir_SQ)/man5') | ||
| 69 | 87 | ||
| 70 | install: $(MAN1_INSTALL) | 88 | install: $(MAN1_INSTALL) $(MAN5_INSTALL) |
| 71 | 89 | ||
| 72 | clean: | 90 | clean: |
| 73 | (cd $(obj); \ | 91 | (cd $(obj); \ |
| 74 | $(RM) *.xml *.xsl *.1) | 92 | $(RM) *.xml *.xsl *.1 *.5) |
| 75 | 93 | ||
| 76 | .PHONE: force | 94 | .PHONE: force |
| 77 | force: \ No newline at end of file | 95 | force: \ No newline at end of file |
diff --git a/Documentation/trace-cmd.1.txt b/Documentation/trace-cmd.1.txt index 9bd97c5..fb4cadd 100644 --- a/Documentation/trace-cmd.1.txt +++ b/Documentation/trace-cmd.1.txt | |||
| @@ -56,7 +56,8 @@ SEE ALSO | |||
| 56 | -------- | 56 | -------- |
| 57 | trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1), | 57 | trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1), |
| 58 | trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1), | 58 | trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1), |
| 59 | trace-cmd-split(1), trace-cmd-list(1), trace-cmd-listen(1) | 59 | trace-cmd-split(1), trace-cmd-list(1), trace-cmd-listen(1), |
| 60 | trace-cmd.dat(5) | ||
| 60 | 61 | ||
| 61 | AUTHOR | 62 | AUTHOR |
| 62 | ------ | 63 | ------ |
diff --git a/Documentation/trace-cmd.dat.5.txt b/Documentation/trace-cmd.dat.5.txt new file mode 100644 index 0000000..b393d3d --- /dev/null +++ b/Documentation/trace-cmd.dat.5.txt | |||
| @@ -0,0 +1,267 @@ | |||
| 1 | TRACE-CMD.DAT(5) | ||
| 2 | =============== | ||
| 3 | |||
| 4 | NAME | ||
| 5 | ---- | ||
| 6 | trace-cmd.dat - trace-cmd file format | ||
| 7 | |||
| 8 | SYNOPSIS | ||
| 9 | -------- | ||
| 10 | *trace-cmd.dat* ignore | ||
| 11 | |||
| 12 | DESCRIPTION | ||
| 13 | ----------- | ||
| 14 | The trace-cmd(1) utility produces a "trace.dat" file. The file may also | ||
| 15 | be named anything depending if the user specifies a different output name, | ||
| 16 | but it must have a certain binary format. The file is used | ||
| 17 | by trace-cmd to save kernel traces into it and be able to extract | ||
| 18 | the trace from it at a later point (see *trace-cmd-report(1)*). | ||
| 19 | |||
| 20 | |||
| 21 | INITIAL FORMAT | ||
| 22 | -------------- | ||
| 23 | |||
| 24 | The first three bytes contain the magic value: | ||
| 25 | |||
| 26 | 0x17 0x08 0x44 | ||
| 27 | |||
| 28 | The next 7 bytes contain the characters: | ||
| 29 | |||
| 30 | "tracing" | ||
| 31 | |||
| 32 | The next set of characters contain a null '\0' terminated string, | ||
| 33 | that contains the version of the file (for example): | ||
| 34 | |||
| 35 | "6\0" | ||
| 36 | |||
| 37 | The next 1 byte contains the flags for the file endianess: | ||
| 38 | |||
| 39 | 0 = little endian | ||
| 40 | 1 = big endian | ||
| 41 | |||
| 42 | The next byte contains the number of bytes per "long" value: | ||
| 43 | |||
| 44 | 4 - 32 bit long values | ||
| 45 | 8 - 64 bit long values | ||
| 46 | |||
| 47 | Note: This is the long size of the target's userspace. Not the | ||
| 48 | kernel space size. | ||
| 49 | |||
| 50 | [ Now all numbers are written in file defined endianess ] | ||
| 51 | |||
| 52 | The next 4 bytes is a 32 bit word that defines what the traced | ||
| 53 | host machine page size was. | ||
| 54 | |||
| 55 | HEADER INFO FORMAT | ||
| 56 | ------------------ | ||
| 57 | |||
| 58 | Directly after the initial format comes information about the | ||
| 59 | trace headers recorded from the target box. | ||
| 60 | |||
| 61 | The next 12 bytes contain the string: | ||
| 62 | |||
| 63 | "header_page\0" | ||
| 64 | |||
| 65 | The next 8 bytes is a 64 bit word containing the size of the | ||
| 66 | page header information stored next. | ||
| 67 | |||
| 68 | The next set of data is of the size read from the previous 8 bytes, | ||
| 69 | and contains the data retrieved from debugfs/tracing/events/header_page | ||
| 70 | |||
| 71 | Note: The size of the second field \fBcommit\fR contains the target | ||
| 72 | kernel long size. For example: | ||
| 73 | |||
| 74 | field: local_t commit; offset:8; \fBsize:8;\fR signed:1; | ||
| 75 | |||
| 76 | Shows the kernel has a 64 bit long. | ||
| 77 | |||
| 78 | The next 13 bytes contain the string: | ||
| 79 | |||
| 80 | "header_event\0" | ||
| 81 | |||
| 82 | The next 8 bytes is a 64 bit word containing the size of the | ||
| 83 | event header information stored next. | ||
| 84 | |||
| 85 | The next set of data is of the size read from the previous 8 bytes | ||
| 86 | and contains the data retrieved from debugfs/tracing/events/header_event | ||
| 87 | |||
| 88 | This data allows the trace-cmd tool to know if the ring buffer format | ||
| 89 | of the kernel made any changes. | ||
| 90 | |||
| 91 | FTRACE EVENT FORMATS | ||
| 92 | -------------------- | ||
| 93 | |||
| 94 | Directly after the header information comes the information about | ||
| 95 | the Ftrace specific events. These are the events used by the Ftrace plugins | ||
| 96 | and are not enabled by the event tracing. | ||
| 97 | |||
| 98 | The next 4 bytes contains a 32 bit word of the number of Ftrace event | ||
| 99 | format files that are stored in the file. | ||
| 100 | |||
| 101 | For the number of times defined by the previous 4 bytes is the | ||
| 102 | following: | ||
| 103 | |||
| 104 | 8 bytes for the size of the Ftrace event format file. | ||
| 105 | |||
| 106 | The Ftrace event format file copied from the target machine: | ||
| 107 | debugfs/tracing/events/ftrace/<event>/format | ||
| 108 | |||
| 109 | EVENT FORMATS | ||
| 110 | ------------- | ||
| 111 | |||
| 112 | Directly after the Ftrace formats comes the information about | ||
| 113 | the event layout. | ||
| 114 | |||
| 115 | The next 4 bytes is a 32 bit word containing the number of | ||
| 116 | event systems that are stored in the file. These are the | ||
| 117 | directories in debugfs/tracing/events excluding the \fBftrace\fR | ||
| 118 | directory. | ||
| 119 | |||
| 120 | For the number of times defined by the previous 4 bytes is the | ||
| 121 | following: | ||
| 122 | |||
| 123 | A null terminated string containing the system name. | ||
| 124 | |||
| 125 | 4 bytes containing a 32 bit word containing the number | ||
| 126 | of events within the system. | ||
| 127 | |||
| 128 | For the number of times defined in the previous 4 bytes is the | ||
| 129 | following: | ||
| 130 | |||
| 131 | 8 bytes for the size of the event format file. | ||
| 132 | |||
| 133 | The event format file copied from the target machine: | ||
| 134 | debugfs/tracing/events/<system>/<event>/format | ||
| 135 | |||
| 136 | KALLSYMS INFORMATION | ||
| 137 | -------------------- | ||
| 138 | |||
| 139 | Directly after the event formats comes the information of the mapping | ||
| 140 | of function addresses to the function names. | ||
| 141 | |||
| 142 | The next 4 bytes is a 32 bit word containing the size of the | ||
| 143 | data holding the function mappings. | ||
| 144 | |||
| 145 | The next set of data is of the size defined by the previous 4 bytes | ||
| 146 | and contains the information from the target machine's file: | ||
| 147 | /proc/kallsyms | ||
| 148 | |||
| 149 | |||
| 150 | TRACE_PRINTK INFORMATION | ||
| 151 | ------------------------ | ||
| 152 | |||
| 153 | If a developer used trace_printk() within the kernel, it may | ||
| 154 | store the format string outside the ring buffer. | ||
| 155 | This information can be found in: | ||
| 156 | debugfs/tracing/printk_formats | ||
| 157 | |||
| 158 | The next 4 bytes is a 32 bit word containing the size of the | ||
| 159 | data holding the printk formats | ||
| 160 | |||
| 161 | The next set of data is of the size defined by the previous 4 bytes | ||
| 162 | and contains the information from debugfs/tracing/printk_formats. | ||
| 163 | |||
| 164 | |||
| 165 | PROCESS INFORMATION | ||
| 166 | ------------------- | ||
| 167 | |||
| 168 | Directly after the trace_printk formats comes the information mapping | ||
| 169 | a PID to a process name. | ||
| 170 | |||
| 171 | The next 8 bytes contains a 64 bit word that holds the size of the | ||
| 172 | data mapping the PID to a process name. | ||
| 173 | |||
| 174 | The next set of data is of the size defined by the previous 8 bytes | ||
| 175 | and contains the information from debugfs/tracing/saved_cmdlines | ||
| 176 | |||
| 177 | |||
| 178 | REST OF TRACE-CMD HEADER | ||
| 179 | ------------------------ | ||
| 180 | |||
| 181 | Directly after the process information comes the last bit of the | ||
| 182 | trace.dat file header. | ||
| 183 | |||
| 184 | The next 4 bytes is a 32 bit word defining the number of CPUs that | ||
| 185 | was discovered on the target machine (and has matching trace data | ||
| 186 | for it). | ||
| 187 | |||
| 188 | The next 10 bytes is one of the following: | ||
| 189 | |||
| 190 | "options \0" | ||
| 191 | |||
| 192 | "latency \0" | ||
| 193 | |||
| 194 | "flyrecord\0" | ||
| 195 | |||
| 196 | If it is "options \0" then: | ||
| 197 | |||
| 198 | The next 2 bytes is a 16 bit word defining the current option. | ||
| 199 | If the the value is zero then there are no more options. | ||
| 200 | |||
| 201 | Otherwise, the next 4 bytes contains a 32 bit word containing the | ||
| 202 | option size. If the reader does not know how to handle the option | ||
| 203 | it can simply skip it. Currently there are no options defined, | ||
| 204 | but this is here to extend the data. | ||
| 205 | |||
| 206 | The next option will be directly after the previous option, and | ||
| 207 | the options ends with a zero in the option type field. | ||
| 208 | |||
| 209 | The next 10 bytes after the options is one of the following: | ||
| 210 | |||
| 211 | "latency \0" | ||
| 212 | |||
| 213 | "flyrecord\0" | ||
| 214 | |||
| 215 | Which would follow the same as if options were not present. | ||
| 216 | |||
| 217 | If the value is "latency \0", then the rest of the file is | ||
| 218 | simply ASCII text that was taken from the targets: | ||
| 219 | debugfs/tracing/trace | ||
| 220 | |||
| 221 | If the value is "flyrecord\0", the following is present: | ||
| 222 | |||
| 223 | For the number of CPUs that were read earlier, the | ||
| 224 | following is present: | ||
| 225 | |||
| 226 | 8 bytes that is a 64 bit word containing the offset into the file | ||
| 227 | that holds the data for the CPU. | ||
| 228 | |||
| 229 | 8 bytes that is a 64 bit word containing the size of the CPU | ||
| 230 | data at that offset. | ||
| 231 | |||
| 232 | CPU DATA | ||
| 233 | -------- | ||
| 234 | |||
| 235 | The CPU data is located in the part of the file that is specified | ||
| 236 | in the end of the header. Padding is placed between the header and | ||
| 237 | the CPU data, placing the CPU data at a page aligned (target page) position | ||
| 238 | in the file. | ||
| 239 | |||
| 240 | This data is copied directly from the Ftrace ring buffer and is of the | ||
| 241 | same format as the ring buffer specified by the event header files | ||
| 242 | loaded in the header format file. | ||
| 243 | |||
| 244 | The trace-cmd tool will try to \fBmmap(2)\fR the data page by page with the | ||
| 245 | target's page size if possible. If it fails to mmap, it will just read the | ||
| 246 | data instead. | ||
| 247 | |||
| 248 | SEE ALSO | ||
| 249 | -------- | ||
| 250 | trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1), | ||
| 251 | trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1), | ||
| 252 | trace-cmd-split(1), trace-cmd-list(1), trace-cmd-listen(1), | ||
| 253 | trace-cmd.dat(5) | ||
| 254 | |||
| 255 | AUTHOR | ||
| 256 | ------ | ||
| 257 | Written by Steven Rostedt, <rostedt@goodmis.org> | ||
| 258 | |||
| 259 | RESOURCES | ||
| 260 | --------- | ||
| 261 | git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git | ||
| 262 | |||
| 263 | COPYING | ||
| 264 | ------- | ||
| 265 | Copyright \(C) 2010 Red Hat, Inc. Free use of this software is granted under | ||
| 266 | the terms of the GNU Public License (GPL). | ||
| 267 | |||
