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...
trace: Provide a detailed event control interface
This interface decouples event obtaining from interaction.
Events can be obtained through three different methods:
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>...
trace: [default] Port to generic event information and new control interface
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
trace: [simple] Port to generic event information and new control interface
The backend is forced to dump event numbers using 64 bits, as TraceEventID isan enum.
trace: [stderr] Port to generic event information and new control interface
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 linkedwith code compiled against fresh headers. For example, try building...
trace: deal with deprecated glib thread functions
g_thread_create() was deprecated in favor of g_thread_new() andg_cond_new() was deprecated in favor of GCond initialization. If thehost has glib 2.31 or newer, avoid using the deprecated functions.
This patch solves compiler warnings that are generated when glib's...
trace: use glib atomic int types
Juan reported that RHEL 6.4 hosts give compiler warnings because we useunsigned 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...
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 thecounter dropped_events is uint64_t. Can't stop commit 62bab732: aquick (gint *)&dropped_events bludgeons the compiler into submission....
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...
trace: Clean up the "try to update atomic until it worked" loops
Signed-off-by: Markus Armbruster <armbru@redhat.com>Reviewed-by: Laszlo Ersek <lersek@redhat.com>Reviewed-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Makefile: clean timestamp generation rule
create timestamp by rule without sideeffects.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
build: some simplifications for "trace/Makefile.objs"
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
build: fold trace-obj-y into libqemuutil.a
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
build: move dtrace rules to rules.mak
build: Use separate makefile for "trace/"
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>--Changes in v2:
misc: move include files to include/qemu/
trace: allow disabling events in events file
Disable trace events prefixed with a '-'. Usefulto 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....
trace/simple: Replace asprintf by g_strdup_printf
asprintf is not available for all hosts. g_strdup_printf ismore portable and simplifies the code because if does notneed error handling.
The static variable does not need an explicit assignment to be NULL....
trace: rename TraceRecordHeader to TraceLogHeader
The TraceRecordHeader is really the header for the entire trace logfile. It's not per-record header so make this obvious by renaming it.
Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
trace: remove unnecessary write_to_buffer() typecasting
The buffer argument is void* so it is not necessary to cast.
trace: drop unused TraceBufferRecord->next_tbuf_idx field
trace: avoid pointer aliasing in trace_record_finish()
Declaring a TraceRecord on the stack works fine. No need for auint8_t array and pointer aliasing.
Simpletrace v2: Support multiple arguments, strings.
Existing simpletrace backend allows to trace at max 6 args and does notsupport strings. This newer tracelog format gets rid of fixed size recordsand therefore allows to trace variable number of args including strings....
monitor: remove unused do_info_trace
Going forward with simpletrace v2 variable size trace records, we cannothave a generic function to print trace event info and therefore thisinterface becomes invalid.
As per Stefan Hajnoczi:
"This command is only available from the human monitor. It's not very...
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 completelyand type it again when we want it back.
The patch adds '#' symbol handling as a comment specifier....
trace/simple.c: fix deprecated glib2 interface
trace: make trace_thread_create() use its function arg
This patch makes trace_thread_create() to use its function arg toinitialize thread. The other choice is to make this a function to usevoid arg, but i prefer this way.
Signed-off-by: Jun Koi <junkoi2004@gmail.com>...
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 butthat is not correct) and onwards g_thread_init is deprecated and callingit is not required:
http://developer.gnome.org/glib/unstable/glib-Deprecated-Thread-APIs.html#g-thread-init...
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/disablethe events having a common prefix in a batch. For example, virtio-blk trace...
trace: use binary file open mode in simpletrace
For Windows portability the simple trace backend must use the 'b' fileopen mode. This prevents the stdio library from mangling 0x0a/0x0dnewline characters.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
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...
trace: separate trace event control and query routines from the simple backend
Generalize the 'st_print_trace_events' and 'st_change_trace_event_state' intobackend-specific 'trace_print_events' and 'trace_event_set_state' (respectively)in the "trace/control.h" file....
trace: add "-trace events" argument to control initial state
The "-trace events" argument can be used to provide a file with a list of traceevent names that will be enabled prior to starting execution, thus providingearly tracing.
This saves the user from manually toggling event states through the monitor...
trace: [stderr] add support for dynamically enabling/disabling events
Uses the generic interface provided in "trace/control.h" in order to providea programmatic interface as well as command line and monitor controls.
Signed-off-by: Fabien Chouteau <chouteau@adacore.com>...
trace: move backend-specific code into the trace/ directory
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
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".