Commit Graph

36 Commits

Author SHA1 Message Date
Daniel P. Berrange 1412cf58be trace: add build framework for merging trace-events files
Switch make rules over to use trace-events-all as the
master trace events input file. Add rule that will
construct trace-events-all from $(trace-events-y).

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 1466066426-16657-2-git-send-email-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-06-20 17:22:14 +01:00
Richard W.M. Jones ab8eb29c4a docs: Update documentation for stderr (now log) tracing backend.
This fixes commit ed7f5f1d8d.

Signed-off-by: Richard W.M. Jones.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 1458507614-32470-1-git-send-email-rjones@redhat.com
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-03-31 09:48:59 +01:00
Lluís Vilanova 3d211d9f4d trace: Add 'vcpu' event property to trace guest vCPU
This property identifies events that trace vCPU-specific information.

It adds a "CPUState*" argument to events with the property, identifying
the vCPU raising the event. TCG translation events also have a
"TCGv_env" implicit argument that is later used as the "CPUState*"
argument at execution time.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Message-id: 145641861797.30295.6991314023181842105.stgit@localhost
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-03-01 13:27:10 +00:00
Hollis Blanchard 2c140f5f2c trace: docs: "simple" backend does support strings
The simple tracing backend has supported strings for more than three years
(62bab73213).

Signed-off-by: Hollis Blanchard <hollis_blanchard@mentor.com>
Message-id: 1454976185-30095-1-git-send-email-hollis_blanchard@mentor.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-03-01 13:20:15 +00:00
Lin Ma 2e4ccbbc64 docs: update the usage example of "dtrace" backend in tracing.txt
The usage example of dtrace is quite ancient, We have tracetool.py with
different parameters instead of the original tracetool shell script for
a long time, So update the old information.

Signed-off-by: Lin Ma <lma@suse.com>
Message-id: 1441954730-17341-1-git-send-email-lma@suse.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-10-09 10:14:05 +01:00
Dr. David Alan Gilbert b73e8bd414 Tracing docs fix configure option and description
Fix the example trace configure option.
Update the text to say that multiple backends are allowed and what
happens when multiple backends are enabled.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-id: 1412691161-31785-1-git-send-email-dgilbert@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-11-18 14:05:54 +00:00
Chen Fan 60e17d2822 trace: docs: add trace file description
When user used the trace print command from docs/tracing.txt:
  ./scripts/simpletrace.py trace-events trace-*

the user maybe be misled by the "trace-*", because if user
directly copy the comand line to run, there alway print the
bored message:
"usage: ./scripts/simpletrace.py <trace-events> <trace-file>"

then we should describe that the "trace-*" represented.

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-09-26 09:34:38 +01:00
Lluís Vilanova 0bb403b0ae trace: [tcg] Add documentation
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-08-12 14:26:11 +01:00
Lluís Vilanova 5b808275f3 trace: Multi-backend tracing
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>
2014-06-09 15:43:40 +02:00
Mohamad Gebai ef3ef4a040 Update documentation for LTTng ust tracing
Signed-off-by: Mohamad Gebai <mohamad.gebai@polymtl.ca>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-02-19 11:08:54 +01:00
Paolo Bonzini b9a7b74f77 build: do not use TARGET_ARCH
TARGET_ARCH is generally wrong to use, there are better variables
provided in config-target.mak.  The right one is usually TARGET_NAME
(previously TARGET_ARCH2), but for bsd-user we can also use TARGET_ABI_DIR
for consistency with linux-user.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1370349928-20419-4-git-send-email-pbonzini@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-06-14 15:33:10 +01:00
Eiichi Tsukata e64dd5efb2 trace: document ftrace backend
Add documentation of ftrace backend.

Signed-off-by: Eiichi Tsukata <eiichi.tsukata.xh@hitachi.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-05-03 13:58:09 +02:00
Lluís Vilanova b1bae816c4 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 <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-03-28 14:19:57 +01:00
Markus Armbruster 8f44015e46 trace: Fix location of simpletrace.py in docs
Missed when commit 4c3b5a48 moved it.

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>
2013-02-05 21:52:55 +01:00
Liming Wang e94c4c9287 trace: Remove "info trace" from documents
commit 88affa1c monitor: remove unused do_info_trace

has removed "info trace" function from monitor, so remove it from documents.

Signed-off-by: Liming Wang <walimisdev@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-11-16 13:35:48 +01:00
Stefan Hajnoczi 8f5a0fb1f4 trace: document '-' syntax for disabling events
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-11-16 13:12:13 +01:00
Jun Koi 324883aafe docs: correct ./configure line in tracing.txt
This patch corrects the configure's trace option in docs/tracing.txt.

Signed-off-by: Jun Koi <junkoi2004@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-12 10:12:34 +00:00
Lluís Vilanova b7d66a761f trace: Provide a per-event status define for conditional compilation
Adds a 'TRACE_${NAME}_ENABLED' preprocessor define for each tracing event in
"trace.h".

This lets the user conditionally compile code with a relatively high execution
cost that is only necessary when producing the tracing information for an event
that is enabled.

Note that events using this define will probably have the "disable" property by
default, in order to avoid such costs on regular builds.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-12 10:12:34 +00:00
Mark Wu 454e202d52 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
events could be enabled using:
    trace-event virtio_blk_* on

Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-01 14:12:15 +00:00
Lluís Vilanova 4b710a3cd4 trace: Update docs to use example events that exist
The events 'qemu_malloc' and 'qemu_free' used in the examples no longer exist,
so use 'qemu_vmalloc' and 'qemu_vfree' instead.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-21 11:32:37 +01:00
Stefan Hajnoczi 8f6421179a trace: allow trace events with string arguments
String arguments are useful for producing human-readable traces without
post-processing (e.g. stderr backend).  Although the simple backend
cannot handles strings all others can.  Strings should be allowed and
the simple backend can be extended to support them.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-21 11:29:45 +01:00
Stefan Hajnoczi 913540a376 trace: allow PRI*64 at beginning and ending of format string
The tracetool parser only picks up PRI*64 and other format string macros
when enclosed between double quoted strings.  Lift this restriction by
extracting everything after the closing ')' as the format string:

  cpu_set_apic_base(uint64_t val) "%016"PRIx64
                                  ^^        ^^

One trick here: it turns out that backslashes in the format string like
"\n" were being interpreted by echo(1).  Fix this by using the POSIX
printf(1) command instead.  Although it normally does not make sense to
include backslashes in trace event format strings, an injected newline
causes tracetool to emit a broken header file and I want to eliminate
cases where broken output is emitted, even if the input was bad.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-17 15:14:05 +00:00
Lluís 9a82b6a590 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 <chouteau@adacore.com>
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
2011-09-01 10:34:54 +01:00
Lluís 03727e6a06 trace: [simple] disable all trace points by default
Note that this refers to the backend-specific state (whether the output must be
generated), not the event "disabled" property (which always uses the "nop"
backend).

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
2011-09-01 10:34:54 +01:00
Lluís dd215f646c trace: always use the "nop" backend on events with the "disable" keyword
Any event with the keyword/property "disable" generates an empty trace event
using the "nop" backend, regardless of the current backend.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
2011-09-01 10:34:54 +01:00
Lluís 23d15e860b 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
interface or whichever backend-specific interface.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
2011-09-01 10:34:54 +01:00
Lluís 31965ae27b trace: always compile support for controlling and querying trace event states
The current interface is generic for this small set of operations, and thus
other backends can easily modify the "trace/control.c" file to add their own
implementation.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
2011-09-01 10:34:54 +01:00
Lluís 49926043c1 trace: generalize the "property" concept in the trace-events file
This adds/modifies the following functions:

* get_name: Get _only_ the event name
* has_property: Return whether an event has a property (keyword before the event
  name)

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
2011-09-01 10:34:54 +01:00
Lluís 7b92e5bc6d docs/tracing.txt: minor documentation fixes
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-04-26 13:14:49 +01:00
Stefan Hajnoczi e6a750aab5 docs: Trace events must not expect pointer dereferencing
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-04-26 13:14:49 +01:00
Stefan Hajnoczi 0b5538c300 simpletrace: Thread-safe tracing
Trace events outside the global mutex cannot be used with the simple
trace backend since it is not thread-safe.  There is no check to prevent
them being enabled so people sometimes learn this the hard way.

This patch restructures the simple trace backend with a ring buffer
suitable for multiple concurrent writers.  A writeout thread empties the
trace buffer when threshold fill levels are reached.  Should the
writeout thread be unable to keep up with trace generation, records will
simply be dropped.

Each time events are dropped a special record is written to the trace
file indicating how many events were dropped.  The event ID is
0xfffffffffffffffe and its signature is dropped(uint32_t count).

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-03-07 15:34:17 +00:00
Stefan Hajnoczi b48c20f723 docs: Update stderr and simple backend, add systemtap backend
The following additions to the tracing documentation are included:

1. Move "stderr" backend documentation to top-level and out of "simple"
   backend.  Include hints on when this backend is useful.

2. Document the "simple" backend thread-safety limitation.

3. Document the "dtrace" backend for SystemTap.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-03-06 19:11:47 +01:00
Fabien Chouteau 320fba2a1f New trace-event backend: stderr
This backend sends trace events to standard error output during the emulation.

Also add a "--list-backends" option to tracetool, so configure script can
display the list of available backends.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Acked-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-29 22:52:00 +00:00
Stefan Hajnoczi cf85cf8e97 trace: Format strings must begin/end with double quotes
Document the restriction that format strings must begin and end with
double quotes.  This is for easy parsing since we don't run cpp over
trace-events.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-20 16:41:31 +00:00
Stefan Hajnoczi 9a85d39447 trace: Use portable format strings
It is not portable to use "%ld" for int64_t because int64_t may have
type long on 64-bit platforms and long long on 32-bit platforms.  Use
the standard library PRId64 macros to keep format strings portable.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-09 08:16:45 +00:00
Stefan Hajnoczi 81a97d9d97 trace: Add user documentation
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-09-09 16:22:44 -05:00