Statistics
| Branch: | Revision:

root / trace / simple.c @ 5a37532d

History | View | Annotate | Download (11.9 kB)

# Date Author Comment
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 <>

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 <>

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

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...

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...

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 <>