trace: Add static tracing to QEMU
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest posting 2/214 patches 6 repliesIn review
- v3 posting 1/21 patch 0 repliesSuperseded
- v214 patches 7 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 14 patches | 20 replies | Superseded |
Changes in v3 from the cover letter
* write trace files to current working directory by default
* avoid adding -lust to LIBS twice
Patches in v3 posting 2/2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/14 | trace: Add trace-events file for declaring trace events.gitignore Makefile Makefile.objs +4 more | +238 | 2 replies | |
| 2/14 | trace: Add simple built-in tracing backend.gitignore Makefile Makefile.objs +5 more | +360 | 0 replies | |
| 3/14 | trace: Support for dynamically enabling/disabling trace eventsconfigure monitor.c qemu-monitor.hx +3 more | +149 | 0 replies | |
| 4/14 | trace: Support disabled events in trace-eventstrace-events tracetool | +45 | 0 replies | |
| 5/14 | trace: Specify trace file nameconfigure simpletrace.c | +29 | 0 replies | |
| 6/14 | trace: Add trace-file command to open/close/flush trace filemonitor.c qemu-monitor.hx simpletrace.c +1 more | +88 | 0 replies | |
| 7/14 | trace: Add trace file name command-line optionqemu-config.c qemu-options.hx vl.c | +50 | 0 replies | |
| 8/14 | trace: Add LTTng Userspace Tracer backendconfigure tracetool | +102 | 0 replies | |
| 9/14 | trace: Add user documentationdocs/ | +177 | 0 replies | |
| 10/14 | trace: Trace qemu_malloc() and qemu_vmalloc()osdep.c qemu-malloc.c trace-events | +38 | 0 replies | |
| 11/14 | trace: Trace virtio-blk, multiwrite, and paio_submitblock.c hw/ posix-aio-compat.c +1 more | +31 | 0 replies | |
| 12/14 | trace: Trace virtqueue operationshw/ trace-events | +16 | 0 replies | |
| 13/14 | trace: Trace port IOioport.c trace-events | +11 | 0 replies | |
| 14/14 | trace: Trace entry point of balloon request handlerballoon.c trace-events | +6 | 0 replies |
Reviews trailers per patch
None of the 14 patches has a Reviewed-by or Acked-by.
| Patch | Stefan Hajnoczi |
|---|---|
| 1/14 | |
| 2/14 | |
| 3/14 | |
| 4/14 | |
| 5/14 | Edited-by |
| 6/14 | |
| 7/14 | |
| 8/14 | |
| 9/14 | |
| 10/14 | |
| 11/14 | |
| 12/14 | |
| 13/14 | |
| 14/14 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [Qemu-devel] [PATCH v3 00/14] trace: Add static tracing to QEMU
This patch series adds static tracing to QEMU. It can be used to instrument QEMU code by means of lightweight logging called trace events.
Prerna and I are now posting the entire patch series with a serious eye towards checking we meet users' and developers' tracing needs and with the goal of getting this functionality merged into qemu.git.
Tracing infrastructure allows debugging, performance analysis, and observation to be performed. Right now there are ad-hoc logging calls in some source files which require rebuilding QEMU with certain #defines and perform poorly. This patch series introduces a single tracing infrastructure which is easy to use and can replace ad-hoc techniques.
Two key points:
1. The trace-events file contains the set of defined trace events which can be called from a source file. For example, trace-events has:
qemu_malloc(size_t size, void *ptr) "size %zu ptr %p"
and qemu-malloc.c uses this trace event like this:
#include "trace.h" /* needed for trace event prototype */
void *qemu_malloc(size_t size)
{
void *ptr;
if (!size && !allow_zero_malloc()) {
abort();
}
ptr = oom_check(malloc(size ? size : 1));
trace_qemu_malloc(size, ptr); /* <-- trace event */
return ptr;
}2. The built-in 'simple' trace backend writes binary traces to trace-<pid>. They can be pretty-printed like this:
./simpletrace.py trace-events trace-*
Although you can also try LTTng Userspace Tracer ('ust' trace backend), the 'simple' trace backend provides commands within the QEMU monitor to enable/disable trace events at runtime. It is easy to use and should serve as a good default trace backend.
The 'simple' trace backend's limitation is that it isn't thread-safe and can therefore only trace correctly when the QEMU global mutex is held.
For full documentation, see:
http://repo.or.cz/w/qemu/stefanha.git/blob_plain/refs/heads/tracing_v3:/docs/tracing.txt
The git branch is here:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/tracing_v3
Changes in v3:
* write trace files to current working directory by default
* avoid adding -lust to LIBS twice
Changes in v2:
* add 6th argument to trace record to avoid changing file format later
* add type usage documentation for trace event declarations
* switch to QemuOptsList for -trace command-line option
* use atexit() once and only once to flush the trace buffer
* keep disabled event ids in sync between tracetool and simpletrace.py
* change echo -n to printf for portability
* move #include statements to correct spot in the patch series
* fix style issues from code review