Revision 7b92e5bc docs/tracing.txt
b/docs/tracing.txt | ||
---|---|---|
26 | 26 |
|
27 | 27 |
== Trace events == |
28 | 28 |
|
29 |
There is a set of static trace events declared in the trace-events source
|
|
29 |
There is a set of static trace events declared in the "trace-events" source
|
|
30 | 30 |
file. Each trace event declaration names the event, its arguments, and the |
31 | 31 |
format string which can be used for pretty-printing: |
32 | 32 |
|
33 | 33 |
qemu_malloc(size_t size, void *ptr) "size %zu ptr %p" |
34 | 34 |
qemu_free(void *ptr) "ptr %p" |
35 | 35 |
|
36 |
The trace-events file is processed by the tracetool script during build to
|
|
36 |
The "trace-events" file is processed by the "tracetool" script during build to
|
|
37 | 37 |
generate code for the trace events. Trace events are invoked directly from |
38 | 38 |
source code like this: |
39 | 39 |
|
... | ... | |
52 | 52 |
|
53 | 53 |
=== Declaring trace events === |
54 | 54 |
|
55 |
The tracetool script produces the trace.h header file which is included by
|
|
55 |
The "tracetool" script produces the trace.h header file which is included by
|
|
56 | 56 |
every source file that uses trace events. Since many source files include |
57 |
trace.h, it uses a minimum of types and other header files included to keep |
|
58 |
the namespace clean and compile times and dependencies down.
|
|
57 |
trace.h, it uses a minimum of types and other header files included to keep the
|
|
58 |
namespace clean and compile times and dependencies down. |
|
59 | 59 |
|
60 | 60 |
Trace events should use types as follows: |
61 | 61 |
|
... | ... | |
110 | 110 |
|
111 | 111 |
== Trace backends == |
112 | 112 |
|
113 |
The tracetool script automates tedious trace event code generation and also
|
|
113 |
The "tracetool" script automates tedious trace event code generation and also
|
|
114 | 114 |
keeps the trace event declarations independent of the trace backend. The trace |
115 | 115 |
events are not tightly coupled to a specific trace backend, such as LTTng or |
116 |
SystemTap. Support for trace backends can be added by extending the tracetool
|
|
116 |
SystemTap. Support for trace backends can be added by extending the "tracetool"
|
|
117 | 117 |
script. |
118 | 118 |
|
119 | 119 |
The trace backend is chosen at configure time and only one trace backend can |
... | ... | |
181 | 181 |
==== Analyzing trace files ==== |
182 | 182 |
|
183 | 183 |
The "simple" backend produces binary trace files that can be formatted with the |
184 |
simpletrace.py script. The script takes the trace-events file and the binary
|
|
184 |
simpletrace.py script. The script takes the "trace-events" file and the binary
|
|
185 | 185 |
trace: |
186 | 186 |
|
187 | 187 |
./simpletrace.py trace-events trace-12345 |
188 | 188 |
|
189 |
You must ensure that the same trace-events file was used to build QEMU,
|
|
189 |
You must ensure that the same "trace-events" file was used to build QEMU,
|
|
190 | 190 |
otherwise trace event declarations may have changed and output will not be |
191 | 191 |
consistent. |
192 | 192 |
|
Also available in: Unified diff