Statistics
| Branch: | Revision:

root / trace @ c09b437b

# Date Author Comment
45be2f5d 03/28/2013 03:19 pm Lluís Vilanova

trace: Provide a generic tracing event descriptor

Uses tracetool to generate a backend-independent tracing event description
(struct TraceEvent).

The values for such structure are generated with the non-public "events"
backend ("events-c" frontend).

The generation of the defines to check if an event is statically enabled is also...

b1bae816 03/28/2013 03:19 pm Lluís Vilanova

trace: Provide a detailed event control interface

This interface decouples event obtaining from interaction.

Events can be obtained through three different methods:

  • identifier
  • name
  • simple wildcard pattern

Signed-off-by: Lluís Vilanova <>...

fd068a95 03/28/2013 03:19 pm Lluís Vilanova

trace: [default] Port to generic event information and new control interface

Signed-off-by: Lluís Vilanova <>
Signed-off-by: Stefan Hajnoczi <>

60481e21 03/28/2013 03:19 pm Lluís Vilanova

trace: [simple] Port to generic event information and new control interface

The backend is forced to dump event numbers using 64 bits, as TraceEventID is
an enum.

Signed-off-by: Lluís Vilanova <>
Signed-off-by: Stefan Hajnoczi <>

c6f18b91 03/28/2013 03:19 pm Lluís Vilanova

trace: [stderr] Port to generic event information and new control interface

Signed-off-by: Lluís Vilanova <>
Signed-off-by: Stefan Hajnoczi <>

a7373b1f 03/28/2013 03:19 pm Stefan Hajnoczi

trace: rebuild generated-events.o when configuration changes

Make sure to rebuild generated-events.o when ./configure options change.
This prevents linker errors when a stale generated-events.o gets linked
with code compiled against fresh headers. For example, try building...

4a0e6714 02/13/2013 12:26 am Stefan Hajnoczi

trace: deal with deprecated glib thread functions

g_thread_create() was deprecated in favor of g_thread_new() and
g_cond_new() was deprecated in favor of GCond initialization. If the
host has glib 2.31 or newer, avoid using the deprecated functions.

This patch solves compiler warnings that are generated when glib's...

30d94087 02/13/2013 12:26 am Stefan Hajnoczi

trace: use glib atomic int types

Juan reported that RHEL 6.4 hosts give compiler warnings because we use
unsigned int while glib prototypes use volatile gint in trace/simple.c.

trace/simple.c:223: error: pointer targets in passing argument 1 of 'g_atomic_int_compare_and_exchange' differ in signedness...
fb3a5085 02/05/2013 10:52 pm Markus Armbruster

trace: Fix simple trace dropped event record for big endian

We use atomic operations to keep track of dropped events.

Inconveniently, GLib supports only int and void * atomics, but the
counter dropped_events is uint64_t. Can't stop commit 62bab732: a
quick (gint *)&dropped_events bludgeons the compiler into submission....

e722d705 02/05/2013 10:52 pm Markus Armbruster

trace: Direct access of atomics is verboten, use the API

The GLib Reference Manual says:

It is very important that all accesses to a particular integer or
pointer be performed using only this API and that different sizes
of operation are not mixed or used on overlapping memory...
b6b2c962 02/05/2013 10:52 pm Markus Armbruster

trace: Clean up the "try to update atomic until it worked" loops

Signed-off-by: Markus Armbruster <>
Reviewed-by: Laszlo Ersek <>
Reviewed-by: Harsh Prateek Bora <>
Signed-off-by: Stefan Hajnoczi <>

6f329a55 01/30/2013 01:31 am Michael S. Tsirkin

Makefile: clean timestamp generation rule

create timestamp by rule without sideeffects.

Signed-off-by: Michael S. Tsirkin <>

0e848f48 01/12/2013 07:42 pm Paolo Bonzini

build: some simplifications for "trace/Makefile.objs"

Signed-off-by: Lluís Vilanova <>
Signed-off-by: Paolo Bonzini <>

ff667e2e 01/12/2013 07:42 pm Paolo Bonzini

build: fold trace-obj-y into libqemuutil.a

Signed-off-by: Paolo Bonzini <>

2c13ec50 01/12/2013 06:19 pm Paolo Bonzini

build: move dtrace rules to rules.mak

Signed-off-by: Paolo Bonzini <>

eac236ea 12/23/2012 10:28 pm Lluís Vilanova

build: Use separate makefile for "trace/"

Reviewed-by: Paolo Bonzini <>
Signed-off-by: Lluís Vilanova <>
--
Changes in v2:

  • Do not depend on "qemu-timer-common.o".
  • Use "$(obj)" in rules to refer to the build sub-directory....
1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

ddde8acc 11/16/2012 02:12 pm Gerd Hoffmann

trace: allow disabling events in events file

Disable trace events prefixed with a '-'. Useful
to enable a group of tracepoints with exceptions,
like this:

usb_xhci_port_*
-usb_xhci_port_read

which will enable all xhci port tracepoints except reads....

4552e410 08/14/2012 03:19 pm Stefan Weil

trace/simple: Replace asprintf by g_strdup_printf

asprintf is not available for all hosts. g_strdup_printf is
more portable and simplifies the code because if does not
need error handling.

The static variable does not need an explicit assignment to be NULL....

8ae601e8 08/14/2012 12:40 pm Harsh Prateek Bora

trace: rename TraceRecordHeader to TraceLogHeader

The TraceRecordHeader is really the header for the entire trace log
file. It's not per-record header so make this obvious by renaming it.

Signed-off-by: Harsh Prateek Bora <>
Signed-off-by: Stefan Hajnoczi <>

83d35d3e 08/14/2012 12:40 pm Harsh Prateek Bora

trace: remove unnecessary write_to_buffer() typecasting

The buffer argument is void* so it is not necessary to cast.

Signed-off-by: Harsh Prateek Bora <>
Signed-off-by: Stefan Hajnoczi <>

fd82f015 08/14/2012 12:40 pm Harsh Prateek Bora

trace: drop unused TraceBufferRecord->next_tbuf_idx field

Signed-off-by: Harsh Prateek Bora <>
Signed-off-by: Stefan Hajnoczi <>

db8894f2 08/14/2012 12:40 pm Harsh Prateek Bora

trace: avoid pointer aliasing in trace_record_finish()

Declaring a TraceRecord on the stack works fine. No need for a
uint8_t array and pointer aliasing.

Signed-off-by: Harsh Prateek Bora <>
Signed-off-by: Stefan Hajnoczi <>

62bab732 07/19/2012 01:34 pm Harsh Prateek Bora

Simpletrace v2: Support multiple arguments, strings.

Existing simpletrace backend allows to trace at max 6 args and does not
support strings. This newer tracelog format gets rid of fixed size records
and therefore allows to trace variable number of args including strings....

88affa1c 07/19/2012 01:34 pm Harsh Prateek Bora

monitor: remove unused do_info_trace

Going forward with simpletrace v2 variable size trace records, we cannot
have a generic function to print trace event info and therefore this
interface becomes invalid.

As per Stefan Hajnoczi:

"This command is only available from the human monitor. It's not very...

794b1f96 07/19/2012 01:30 pm Alexey Kardashevskiy

trace: added ability to comment out events in the list

It is convenient for debug to be able to switch on/off some events easily.
The only possibility now is to remove event name from the file completely
and type it again when we want it back.

The patch adds '#' symbol handling as a comment specifier....

0d665005 06/08/2012 11:32 am Harsh Prateek Bora

trace/simple.c: fix deprecated glib2 interface

Signed-off-by: Harsh Prateek Bora <>
Signed-off-by: Stefan Hajnoczi <>

db3bf869 03/12/2012 12:12 pm Jun Koi

trace: make trace_thread_create() use its function arg

This patch makes trace_thread_create() to use its function arg to
initialize thread. The other choice is to make this a function to use
void arg, but i prefer this way.

Signed-off-by: Jun Koi <>...

42ed3727 12/20/2011 11:44 pm Alon Levy

g_thread_init users: don't call it if glib >= 2.31

since commit f9b29ca03 included in release 2.31 (docs below say 2.32 but
that is not correct) and onwards g_thread_init is deprecated and calling
it is not required:

http://developer.gnome.org/glib/unstable/glib-Deprecated-Thread-APIs.html#g-thread-init...
454e202d 11/01/2011 04:12 pm Mark Wu

trace: Add wildcard trace event support

A basic wildcard matching is supported in both the monitor command
"trace-event" and the events list file. That means you can enable/disable
the events having a common prefix in a batch. For example, virtio-blk trace...

6c2a4074 09/21/2011 01:30 pm Stefan Hajnoczi

trace: use binary file open mode in simpletrace

For Windows portability the simple trace backend must use the 'b' file
open mode. This prevents the stdio library from mangling 0x0a/0x0d
newline characters.

Signed-off-by: Stefan Hajnoczi <>

85aff158 09/21/2011 01:30 pm Stefan Hajnoczi

trace: portable simple trace backend using glib

Convert the simple trace backend to glib so that it works under Windows.
We cannot use pthread directly but glib provides portable abstractions.
Also use glib atomics instead of newish gcc builtins which may not be...

fc764105 09/01/2011 12:34 pm Lluís

trace: separate trace event control and query routines from the simple backend

Generalize the 'st_print_trace_events' and 'st_change_trace_event_state' into
backend-specific 'trace_print_events' and 'trace_event_set_state' (respectively)
in the "trace/control.h" file....

23d15e86 09/01/2011 12:34 pm Lluís

trace: add "-trace events" argument to control initial state

The "-trace events" argument can be used to provide a file with a list of trace
event names that will be enabled prior to starting execution, thus providing
early tracing.

This saves the user from manually toggling event states through the monitor...

9a82b6a5 09/01/2011 12:34 pm Lluís

trace: [stderr] add support for dynamically enabling/disabling events

Uses the generic interface provided in "trace/control.h" in order to provide
a programmatic interface as well as command line and monitor controls.

Signed-off-by: Fabien Chouteau <>...

edb47ec4 09/01/2011 12:34 pm Lluís

trace: move backend-specific code into the trace/ directory

Signed-off-by: Lluís Vilanova <>

e4858974 09/01/2011 12:34 pm Lluís

trace: avoid conditional code compilation during option parsing

A default implementation for backend-specific routines is provided in
"trace/default.c", which backends can override by setting "trace_default=no" in
"configure".

Signed-off-by: Lluís Vilanova <>