root / trace-events @ 94a420b1
History | View | Annotate | Download (806 Bytes)
1 | 94a420b1 | Stefan Hajnoczi | # Trace events for debugging and performance instrumentation |
---|---|---|---|
2 | 94a420b1 | Stefan Hajnoczi | # |
3 | 94a420b1 | Stefan Hajnoczi | # This file is processed by the tracetool script during the build. |
4 | 94a420b1 | Stefan Hajnoczi | # |
5 | 94a420b1 | Stefan Hajnoczi | # To add a new trace event: |
6 | 94a420b1 | Stefan Hajnoczi | # |
7 | 94a420b1 | Stefan Hajnoczi | # 1. Choose a name for the trace event. Declare its arguments and format |
8 | 94a420b1 | Stefan Hajnoczi | # string. |
9 | 94a420b1 | Stefan Hajnoczi | # |
10 | 94a420b1 | Stefan Hajnoczi | # 2. Call the trace event from code using trace_##name, e.g. multiwrite_cb() -> |
11 | 94a420b1 | Stefan Hajnoczi | # trace_multiwrite_cb(). The source file must #include "trace.h". |
12 | 94a420b1 | Stefan Hajnoczi | # |
13 | 94a420b1 | Stefan Hajnoczi | # Format of a trace event: |
14 | 94a420b1 | Stefan Hajnoczi | # |
15 | 94a420b1 | Stefan Hajnoczi | # <name>(<type1> <arg1>[, <type2> <arg2>] ...) "<format-string>" |
16 | 94a420b1 | Stefan Hajnoczi | # |
17 | 94a420b1 | Stefan Hajnoczi | # Example: qemu_malloc(size_t size) "size %zu" |
18 | 94a420b1 | Stefan Hajnoczi | # |
19 | 94a420b1 | Stefan Hajnoczi | # The <name> must be a valid as a C function name. |
20 | 94a420b1 | Stefan Hajnoczi | # |
21 | 94a420b1 | Stefan Hajnoczi | # Types should be standard C types. Use void * for pointers because the trace |
22 | 94a420b1 | Stefan Hajnoczi | # system may not have the necessary headers included. |
23 | 94a420b1 | Stefan Hajnoczi | # |
24 | 94a420b1 | Stefan Hajnoczi | # The <format-string> should be a sprintf()-compatible format string. |