summaryrefslogtreecommitdiffstats
path: root/trace
Commit message (Collapse)AuthorAgeFilesLines
* trace: add make dependencies on tracetool sourceStefan Hajnoczi2019-11-291-11/+19
| | | | | | | | | | | Patches that change tracetool can break the build if old build output files are lying around. This happens because the Makefile does not specify dependencies on tracetool. The build will use old object files that do not match the current source code. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: fix make foo-timestamp rulesStefan Hajnoczi2019-11-291-9/+9
| | | | | | | | | | | | | | | The Makefile uses intermediate timestamp files to avoid rebuilding if tracetool output is unchanged. Timestamps are implemented incorrectly. This was fixed for rules.mak in commit 4b25966ab976f3a7fd9008193b2defcc82f8f04d ("rules.mak: cleanup config generation rules") but never fixed in trace/Makefile.objs. The problem with the old timestamp implementation was that make doesn't notice the updated file modification time until the next time it is run. It was necessary to run make twice in a row to achieve a full rebuild. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace/simple: Fix warning and wrong trace file name for MinGWStefan Weil2015-11-301-1/+2
| | | | | | | | | | | | | | | On Windows, getpid() always returns an int value, but pid_t (which is expected by the format string) is either a 32 bit or a 64 bit value. Without a type cast (or a modified format string), the compiler prints a warning when building for 64 bit Windows and the resulting trace_file_name will include a wrong pid: trace/simple.c:332:9: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int’ [-Wformat=] Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Remove superfluous '\n' around error_report()Gonglei2015-03-101-1/+1
| | | | | | Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* trace: [hmp] Reimplement "trace-event" and "info trace-events" using QMPLluís Vilanova2014-09-262-20/+0
| | | | | | Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 20140825112002.31112.60143.stgit@fimbulvetr.bsc.es Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: [qmp] Add commands to query and control event tracing stateLluís Vilanova2014-09-262-0/+76
| | | | | | Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 20140825111957.31112.31733.stgit@fimbulvetr.bsc.es Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: Only link generated-tracers.o with "simple" backendFam Zheng2014-09-091-2/+1
| | | | | | | | | | In any other cases the object file is effectively empty, which is disliked by ranlib and nm on Mac OS X. Reported-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* trace: [tcg] Generate TCG tracing routinesLluís Vilanova2014-08-121-0/+9
| | | | | | | | | | | | | | Generate header "trace/generated-tcg-tracers.h" with the necessary routines for tracing events in guest code: * trace_${event}_tcg Convenience wrapper that calls the translation-time tracer 'trace_${event}_trans', and calls 'gen_helper_trace_${event}_exec to generate the TCG code to later trace the event at execution time. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: [tcg] Define TCG tracing helper routine wrappersLluís Vilanova2014-08-121-0/+8
| | | | | | | | | | | | Generates header "trace/generated-helpers-wrappers.h" with definitions for TCG helper wrappers. These wrappers ('gen_helper_trace_${event}_exec_wrapper') transform mixed native and TCG argument types to TCG types and call the actual TCG helpers ('gen_helper_trace_${event}_exec_proxy'). Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: [tcg] Define TCG tracing helper routinesLluís Vilanova2014-08-121-0/+12
| | | | | | | | | | | | Generates file "trace/generated-helpers.c" with TCG helper definitions to trace events in guest code at execution time. The helpers ('helper_trace_${event}_exec_proxy') cast the TCG-compatible native argument types to their original types (as defined in "trace-events") and call the tracing routine ('trace_${event}_exec'). Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: [tcg] Declare TCG tracing helper routinesLluís Vilanova2014-08-121-5/+19
| | | | | | | | Generates file "trace/generated-helpers.h" with TCG helper declarations to trace events in guest code at execution time ('trace_${event}_exec_proxy'). Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* glib-compat.h: add new thread API emulation on top of pre-2.31 APIMichael Tokarev2014-06-101-39/+11
| | | | | | | | | | | | | | | | | | | | | | | Thread API changed in glib-2.31 significantly. Before that version, conditionals and mutexes were only allocated dynamically, using _new()/_free() interface. in 2.31 and up, they're allocated statically as regular variables, and old interface is deprecated. (Note: glib docs says the new interface is available since version 2.32, but it was actually introduced in version 2.31). Create the new interface using old primitives, by providing non-opaque definitions of the base types (GCond and GMutex) using GOnces. Replace #ifdeffery around GCond and GMutex in trace/simple.c and coroutine-gthread.c too because it does not work anymore with the new glib-compat.h. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> [Use GOnce to support lazy initialization; introduce CompatGMutex and CompatGCond. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* trace: Replace fprintf with error_report and print locationAlexey Kardashevskiy2014-06-091-13/+18
| | | | | | | | | | | This replaces fprintf(stderr) with error_report. This moves local variables to the beginning of the function to comply with QEMU's coding style. Suggested-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: Multi-backend tracingLluís Vilanova2014-06-0910-156/+76
| | | | | | | | | | | | | | | Adds support to compile QEMU with multiple tracing backends at the same time. For example, you can compile QEMU with: $ ./configure --enable-trace-backends=ftrace,dtrace Where 'ftrace' can be handy for having an in-flight record of events, and 'dtrace' can be later used to extract more information from the system. This patch allows having both available without recompiling QEMU. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: Replace error with warning if event is not definedAlexey Kardashevskiy2014-06-091-7/+7
| | | | | | | | | | | | At the moment QEMU exits if trace point is not defined which makes a developer life harder if he has to switch between branches with different traces implemented. This replaces error+exit wit WARNING if the tracepoint does not exist or not traceable. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: add pid field to simpletrace recordStefan Hajnoczi2014-06-091-2/+6
| | | | | | | | | | | | | | | | It is useful to know the QEMU process ID when working with traces from multiple VMs. Although the trace filename may contain the pid, tools that aggregate traces or even trace globally need somewhere to record the pid. There is a reserved field in the trace event header struct that we can use. It is not necessary to bump the simpletrace file format version number because it has already been incremented for the QEMU 2.1 release cycle in commit "trace: [simple] Bump up log version number". Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: [tracetool] Minimize the amount of per-backend codeLluís Vilanova2014-05-071-2/+2
| | | | | | | Backends now only contain the essential backend-specific code, and most of the work is moved to frontend code. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: [simple] Bump up log version numberLluís Vilanova2014-05-071-1/+1
| | | | | | | The following tracetool cleanup changes the event numbering policy. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* osdep: initialize glib threads in all QEMU toolsStefan Hajnoczi2014-03-251-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | glib versions prior to 2.31.0 require an explicit g_thread_init() call to enable multi-threading. Failure to initialize threading causes glib to take single-threaded code paths without synchronization. For example, the g_slice allocator will crash due to race conditions. Fix this for all QEMU tool programs (qemu-nbd, qemu-io, qemu-img) by moving the g_thread_init() call from vl.c:main() into a new osdep.c:thread_init() constructor function. thread_init() has __attribute__((constructor)) and is automatically invoked by the runtime during startup. We can now drop the "simple" trace backend's g_thread_init() call since thread_init() already called it. Note that we must keep coroutine-gthread.c's g_thread_init() call which is located in a constructor function. There is no guarantee for constructor function ordering so thread_init() may only be called later. Reported-by: Mario de Chenno <mario.dechenno@unina2.it> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: Fix build warnings for Win32 buildPeter Maydell2014-03-121-5/+5
| | | | | | | | | | | | | The Win32 build warns about trace/control-internal.h: warning: 'trace_event_count' declared inline after being called Fix this by simply reordering trace_event_id() and trace_event_count(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* Adapt Makefiles to the new LTTng ust interfaceMohamad Gebai2014-02-191-0/+25
| | | | | | | Add generation of new files for LTTng ust. Signed-off-by: Mohamad Gebai <mohamad.gebai@polymtl.ca> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: add glib 2.32+ static GMutex supportStefan Hajnoczi2014-01-271-7/+16
| | | | | | | | | The GStaticMutex API was deprecated in glib 2.32. We cannot switch over to GMutex unconditionally since we would drop support for older glib versions. But the deprecated API warnings during build are annoying so use static GMutex when possible. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: [simple] Do not include "trace/simple.h" in generated tracer headersLluís Vilanova2014-01-271-0/+1
| | | | | | | | The header is not necessary, given that the simple backend does not define any inlined tracing routines. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: Add ftrace tracing backendEiichi Tsukata2013-05-033-0/+113
| | | | | | | | | | | | | | | | | | | | | | | This patch adds a ftrace tracing backend which sends trace event to ftrace marker file. You can effectively compare qemu trace data and kernel(especially, kvm.ko when using KVM) trace data. The ftrace backend is restricted to Linux only. To try out the ftrace backend: $ ./configure --trace-backend=ftrace $ make if you use KVM, enable kvm events in ftrace: # sudo echo 1 > /sys/kernel/debug/tracing/events/kvm/enable After running qemu by root user, you can get the trace: # cat /sys/kernel/debug/tracing/trace Signed-off-by: Eiichi Tsukata <eiichi.tsukata.xh@hitachi.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: rebuild generated-events.o when configuration changesStefan Hajnoczi2013-03-281-1/+1
| | | | | | | | | | 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 with ./configure --enable-trace-backend=stderr followed by ./configure --enable-trace-backend=dtrace. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: [stderr] Port to generic event information and new control interfaceLluís Vilanova2013-03-282-39/+6
| | | | | 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 interfaceLluís Vilanova2013-03-282-33/+8
| | | | | | | | The backend is forced to dump event numbers using 64 bits, as TraceEventID is an enum. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: [default] Port to generic event information and new control interfaceLluís Vilanova2013-03-281-3/+2
| | | | | Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: Provide a detailed event control interfaceLluís Vilanova2013-03-283-32/+331
| | | | | | | | | | | | | 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 <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: Provide a generic tracing event descriptorLluís Vilanova2013-03-282-1/+56
| | | | | | | | | | | | | | 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 moved to the "events" backend ("events-h" frontend). Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace: deal with deprecated glib thread functionsStefan Hajnoczi2013-02-121-0/+18
| | | | | | | | | | | | | 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 deprecated functions are used. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1360676045-9204-3-git-send-email-stefanha@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* trace: use glib atomic int typesStefan Hajnoczi2013-02-121-3/+3
| | | | | | | | | | | | | | | 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 These variables are only accessed with glib atomic int functions so let's play it by the book and use volatile gint. Reported-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1360676045-9204-2-git-send-email-stefanha@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* trace: Clean up the "try to update atomic until it worked" loopsMarkus Armbruster2013-02-051-13/+5
| | | | | | | 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>
* trace: Direct access of atomics is verboten, use the APIMarkus Armbruster2013-02-051-4/+5
| | | | | | | | | | | | | | | 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 regions. Never read or assign directly from or to a value -- always use this API. 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>
* trace: Fix simple trace dropped event record for big endianMarkus Armbruster2013-02-051-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. That cast is okay only when int is exactly 64 bits wide, which it commonly isn't. If int is even wider, we clobber whatever follows dropped_events. Not worth worrying about, as none of the machines that interest us have such morbidly obese ints. That leaves the common case: int narrower than 64 bits. Harmless on little endian hosts: we just don't access the most significant bits of dropped_events. They remain zero. On big endian hosts, we use only the most significant bits of dropped_events as counter. The least significant bits remain zero. However, we write out the full value, which is the correct counter shifted left a bunch of places. Fix by changing the variables involved to int. There's another, equally suspicious-looking (gint *)&trace_idx argument to g_atomic_int_compare_and_exchange(), but that one casts unsigned *, so it's okay. But it's also superfluous, because GLib's atomic int operations work just fine for unsigned. Drop it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* Makefile: clean timestamp generation ruleMichael S. Tsirkin2013-01-301-2/+2
| | | | | | create timestamp by rule without sideeffects. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* build: fold trace-obj-y into libqemuutil.aPaolo Bonzini2013-01-121-5/+5
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* build: some simplifications for "trace/Makefile.objs"Paolo Bonzini2013-01-121-13/+13
| | | | | Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* build: move dtrace rules to rules.makPaolo Bonzini2013-01-121-12/+0
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* build: Use separate makefile for "trace/"Lluís Vilanova2012-12-231-0/+70
| | | | | | | | | | | | | | Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> -- Changes in v2: * Do not depend on "qemu-timer-common.o". * Use "$(obj)" in rules to refer to the build sub-directory. * Remove dependencies against "$(GENERATED_HEADERS)". Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* misc: move include files to include/qemu/Paolo Bonzini2012-12-191-1/+1
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* trace: allow disabling events in events fileGerd Hoffmann2012-11-161-1/+8
| | | | | | | | | | | | | | 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. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* trace/simple: Replace asprintf by g_strdup_printfStefan Weil2012-08-141-10/+4
| | | | | | | | | | | | 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. Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* trace: avoid pointer aliasing in trace_record_finish()Harsh Prateek Bora2012-08-141-5/+4
| | | | | | | | Declaring a TraceRecord on the stack works fine. No need for a uint8_t array and pointer aliasing. Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* trace: drop unused TraceBufferRecord->next_tbuf_idx fieldHarsh Prateek Bora2012-08-142-3/+0
| | | | | 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() typecastingHarsh Prateek Bora2012-08-141-3/+3
| | | | | | | The buffer argument is void* so it is not necessary to cast. Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* trace: rename TraceRecordHeader to TraceLogHeaderHarsh Prateek Bora2012-08-141-2/+2
| | | | | | | | 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 <harsh@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* Simpletrace v2: Support multiple arguments, strings.Harsh Prateek Bora2012-07-192-101/+191
| | | | | | | | | | | | | 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. Sample trace with strings: v9fs_version 0.000 tag=0xffff id=0x64 msize=0x2000 version=9P2000.L v9fs_version_return 6.705 tag=0xffff id=0x64 msize=0x2000 version=9P2000.L Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* monitor: remove unused do_info_traceHarsh Prateek Bora2012-07-192-19/+0
| | | | | | | | | | | | | | | | | | | | | | | 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 useful because it historically hasn't been able to pretty-print events or show them in the right order (we use a ringbuffer but it prints them out from index 0). Therefore, I don't think we're under any obligation to keep this command around. No one has complained about it's limitations - I think this is a sign that no one has used it. I'd be okay with a patch that removes it." Ref: http://lists.gnu.org/archive/html/qemu-devel/2012-01/msg01268.html Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* trace: added ability to comment out events in the listAlexey Kardashevskiy2012-07-191-0/+3
| | | | | | | | | | | 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. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
OpenPOWER on IntegriCloud