Features/Tracing/Roadmap: Difference between revisions

From QEMU
No edit summary
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 18: Line 18:
====Timestamps====
====Timestamps====


Owner: Stefan
Owner: Stefan<Sent a patch>


It would be good to have trace-events looged with timestamps, for debugging purposes.
It would be good to have trace-events looged with timestamps, for debugging purposes.
Line 39: Line 39:
Tracing at startup time should still be possible so configuration needs to
Tracing at startup time should still be possible so configuration needs to
happen early.  It should also be possible to flush the trace buffer to the file.
happen early.  It should also be possible to flush the trace buffer to the file.
In addition to a config option, we have implemented an optional '-trace' switch that
allows users to override defaults at runtime. This can also be changed for a running
QEMU instance via the monitor command 'trace-file set FILENAME'


====Binary trace format finalization====
====Binary trace format finalization====
Line 50: Line 54:


This way, post-processing tools can check the format of the binary trace file.
This way, post-processing tools can check the format of the binary trace file.
http://wiki.qemu.org/Features/Tracing/Roadmap
====Switching trace backends makefile dependencies====
Owner: Prerna
Switching trace backends using ./configure does not trigger a rebuild as expected.  The makefile needs to be able to detect that the trace backend setting has changed and trace.c/trace.h need to be rebuilt, along with anything that depends on the files.


===Outstanding===
===Outstanding===
Line 74: Line 85:
not be blocked so an async write-out mechanism is needed.
not be blocked so an async write-out mechanism is needed.


====Switching trace backends makefile dependencies====
====Portable timestamps====


Owner: ?
Owner: ?


Switching trace backends using ./configure does not trigger a rebuild as expected.  The makefile needs to be able to detect that the trace backend setting has changed and trace.c/trace.h need to be rebuilt, along with anything that depends on the files.
The clock_gettime() call used by simpletrace.c is not available under Windows.  The simple trace backend should work on all platforms.  It would be nice to call QEMU's timer code but there are two issues:
# QEMU's timer code is not available in tools like qemu-io, qemu-nbd, and qemu-img.
# Calling QEMU code means that code may not use trace events, otherwise there will be recursion in the simple trace backend.


==Future==
==Future==
Line 107: Line 120:


Enabling trace events individually is tedious.  A mechanism for selecting trace events in bulk would be useful.
Enabling trace events individually is tedious.  A mechanism for selecting trace events in bulk would be useful.
[[Category:Completed feature pages]]

Latest revision as of 14:59, 11 October 2016

Here are the outstanding tasks for a tracing patchset that can be proposed for merge:

Milestone 1

The first patchset that brings basic tracing features to QEMU.

Done

Documentation

Owner: Stefan

User documentation that explains how to collect traces and add new trace events. I have committed documentation to the tracing branch here:

http://repo.or.cz/w/qemu/stefanha.git/blob_plain/91fde34dc6bfe01af6d5e9265f6a81535d6add15:/docs/tracing.txt

Timestamps

Owner: Stefan<Sent a patch>

It would be good to have trace-events looged with timestamps, for debugging purposes.

Fix i386-linux-user build

Owner: Prerna

LINK  i386-linux-user/qemu-i386
../simpletrace.o: In function `do_info_all_trace_events':
/home/stefanha/qemu/simpletrace.c:88: undefined reference to `monitor_printf'
../simpletrace.o: In function `do_info_trace':
/home/stefanha/qemu/simpletrace.c:77: undefined reference to `monitor_printf'

Trace file command

Owner: Prerna

Traces are written out to hardcoded /tmp/trace.log. This must be configurable. Tracing at startup time should still be possible so configuration needs to happen early. It should also be possible to flush the trace buffer to the file.

In addition to a config option, we have implemented an optional '-trace' switch that allows users to override defaults at runtime. This can also be changed for a running QEMU instance via the monitor command 'trace-file set FILENAME'

Binary trace format finalization

Owner: Stefan

We should leave room for extension. I suggest partitioning the Event ID namespace into normal events and special events. The __trace_begin special event is defined to contain the file format version and/or trace record size in bytes as the first trace record in the file.

This way, post-processing tools can check the format of the binary trace file. http://wiki.qemu.org/Features/Tracing/Roadmap

Switching trace backends makefile dependencies

Owner: Prerna

Switching trace backends using ./configure does not trigger a rebuild as expected. The makefile needs to be able to detect that the trace backend setting has changed and trace.c/trace.h need to be rebuilt, along with anything that depends on the files.

Outstanding

Out-of-the-box trace events

Owner: ?

More tracepoints need to be added for instrumenting other qemu components such as virtio drivers, etc.

QEMU must come with a useful set of trace events that allows people to get up and running quickly. Focus areas include:

  • guest device emulation
  • host devices
  • lifecycle and runloop
  • memory management
  • live migration

Out-of-line trace file write-out

Owner: Stefan

Trace buffers are written out to file synchronously. The vcpu thread should not be blocked so an async write-out mechanism is needed.

Portable timestamps

Owner: ?

The clock_gettime() call used by simpletrace.c is not available under Windows. The simple trace backend should work on all platforms. It would be nice to call QEMU's timer code but there are two issues:

  1. QEMU's timer code is not available in tools like qemu-io, qemu-nbd, and qemu-img.
  2. Calling QEMU code means that code may not use trace events, otherwise there will be recursion in the simple trace backend.

Future

Integration with QMP

Owner: Prerna

Currently the trace commands are available from the monitor but a QMP interface is needed.

QMP/monitor command review

Owner: Prerna, Stefan

Are we happy to support the trace commands in the longer term (i.e. did we get the commands and syntax right)? Is input being validated properly?

Minimal (zero?) overhead

Owner: Prerna

In its present format, the tracing infrastructure causes at least two function calls even for trace events that are disabled. Ideally, there should be minimal performance overhead for disabled trace events. Investigating scope for further optimization.

Bulk enable/disable using groups, source file, or tags

Owner: Prerna

Enabling trace events individually is tedious. A mechanism for selecting trace events in bulk would be useful.