Commit 14ac5733 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging



Tracing pull request

# gpg: Signature made Mon 09 Jun 2014 14:44:18 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/tracing-pull-request:
  trace: Replace fprintf with error_report and print location
  trace: Multi-backend tracing
  trace: Replace error with warning if event is not defined
  simpletrace: add support for trace record pid field
  trace: add pid field to simpletrace record

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 4a331bb3 a35d9be6
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -66,16 +66,16 @@ matrix:
      compiler: gcc
    # All the trace backends (apart from dtrace)
    - env: TARGETS=i386-softmmu,x86_64-softmmu
           EXTRA_CONFIG="--enable-trace-backend=stderr"
           EXTRA_CONFIG="--enable-trace-backends=stderr"
      compiler: gcc
    - env: TARGETS=i386-softmmu,x86_64-softmmu
           EXTRA_CONFIG="--enable-trace-backend=simple"
           EXTRA_CONFIG="--enable-trace-backends=simple"
      compiler: gcc
    - env: TARGETS=i386-softmmu,x86_64-softmmu
           EXTRA_CONFIG="--enable-trace-backend=ftrace"
           EXTRA_CONFIG="--enable-trace-backends=ftrace"
           TEST_CMD=""
      compiler: gcc
    - env: TARGETS=i386-softmmu,x86_64-softmmu
          EXTRA_PKGS="liblttng-ust-dev liburcu-dev"
          EXTRA_CONFIG="--enable-trace-backend=ust"
          EXTRA_CONFIG="--enable-trace-backends=ust"
      compiler: gcc
+2 −2
Original line number Diff line number Diff line
@@ -52,12 +52,12 @@ GENERATED_HEADERS += trace/generated-events.h
GENERATED_SOURCES += trace/generated-events.c

GENERATED_HEADERS += trace/generated-tracers.h
ifeq ($(TRACE_BACKEND),dtrace)
ifeq ($(findstring dtrace,$(TRACE_BACKENDS)),dtrace)
GENERATED_HEADERS += trace/generated-tracers-dtrace.h
endif
GENERATED_SOURCES += trace/generated-tracers.c

ifeq ($(TRACE_BACKEND),ust)
ifeq ($(findstring ust,$(TRACE_BACKENDS)),ust)
GENERATED_HEADERS += trace/generated-ust-provider.h
GENERATED_SOURCES += trace/generated-ust.c
endif
+2 −2
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ endif
$(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events
	$(call quiet-command,$(TRACETOOL) \
		--format=stap \
		--backend=$(TRACE_BACKEND) \
		--backends=$(TRACE_BACKENDS) \
		--binary=$(bindir)/$(QEMU_PROG) \
		--target-name=$(TARGET_NAME) \
		--target-type=$(TARGET_TYPE) \
@@ -58,7 +58,7 @@ $(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events
$(QEMU_PROG).stp: $(SRC_PATH)/trace-events
	$(call quiet-command,$(TRACETOOL) \
		--format=stap \
		--backend=$(TRACE_BACKEND) \
		--backends=$(TRACE_BACKENDS) \
		--binary=$(realpath .)/$(QEMU_PROG) \
		--target-name=$(TARGET_NAME) \
		--target-type=$(TARGET_TYPE) \
+23 −24
Original line number Diff line number Diff line
@@ -182,6 +182,10 @@ path_of() {
    return 1
}

have_backend () {
    echo "$trace_backends" | grep "$1" >/dev/null
}

# default parameters
source_path=`dirname "$0"`
cpu=""
@@ -293,7 +297,7 @@ pkgversion=""
pie=""
zero_malloc=""
qom_cast_debug="yes"
trace_backend="nop"
trace_backends="nop"
trace_file="trace"
spice=""
rbd=""
@@ -753,7 +757,10 @@ for opt do
  ;;
  --target-list=*) target_list="$optarg"
  ;;
  --enable-trace-backend=*) trace_backend="$optarg"
  --enable-trace-backends=*) trace_backends="$optarg"
  ;;
  # XXX: backwards compatibility
  --enable-trace-backend=*) trace_backends="$optarg"
  ;;
  --with-trace-file=*) trace_file="$optarg"
  ;;
@@ -1320,7 +1327,7 @@ Advanced options (experts only):
  --disable-docs           disable documentation build
  --disable-vhost-net      disable vhost-net acceleration support
  --enable-vhost-net       enable vhost-net acceleration support
  --enable-trace-backend=B Set trace backend
  --enable-trace-backends=B Set trace backend
                           Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
  --with-trace-file=NAME   Full PATH,NAME of file to store traces
                           Default:trace-<pid>
@@ -3666,15 +3673,15 @@ fi
##########################################
# check if trace backend exists

$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend  > /dev/null 2> /dev/null
$python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends  > /dev/null 2> /dev/null
if test "$?" -ne 0 ; then
  error_exit "invalid trace backend" \
      "Please choose a supported trace backend."
  error_exit "invalid trace backends" \
      "Please choose supported trace backends."
fi

##########################################
# For 'ust' backend, test if ust headers are present
if test "$trace_backend" = "ust"; then
if have_backend "ust"; then
  cat > $TMPC << EOF
#include <lttng/tracepoint.h>
int main(void) { return 0; }
@@ -3700,7 +3707,7 @@ fi

##########################################
# For 'dtrace' backend, test if 'dtrace' command is present
if test "$trace_backend" = "dtrace"; then
if have_backend "dtrace"; then
  if ! has 'dtrace' ; then
    error_exit "dtrace command is not found in PATH $PATH"
  fi
@@ -4170,7 +4177,7 @@ echo "uuid support $uuid"
echo "libcap-ng support $cap_ng"
echo "vhost-net support $vhost_net"
echo "vhost-scsi support $vhost_scsi"
echo "Trace backend     $trace_backend"
echo "Trace backends    $trace_backends"
if test "$trace_backend" = "simple"; then
echo "Trace output file $trace_file-<pid>"
fi
@@ -4664,43 +4671,35 @@ if test "$tpm" = "yes"; then
  fi
fi

# use default implementation for tracing backend-specific routines
trace_default=yes
echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
if test "$trace_backend" = "nop"; then
echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
if have_backend "nop"; then
  echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
fi
if test "$trace_backend" = "simple"; then
if have_backend "simple"; then
  echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
  trace_default=no
  # Set the appropriate trace file.
  trace_file="\"$trace_file-\" FMT_pid"
fi
if test "$trace_backend" = "stderr"; then
if have_backend "stderr"; then
  echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
  trace_default=no
fi
if test "$trace_backend" = "ust"; then
if have_backend "ust"; then
  echo "CONFIG_TRACE_UST=y" >> $config_host_mak
fi
if test "$trace_backend" = "dtrace"; then
if have_backend "dtrace"; then
  echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
  if test "$trace_backend_stap" = "yes" ; then
    echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
  fi
fi
if test "$trace_backend" = "ftrace"; then
if have_backend "ftrace"; then
  if test "$linux" = "yes" ; then
    echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
    trace_default=no
  else
    feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
  fi
fi
echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
if test "$trace_default" = "yes"; then
  echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
fi

if test "$rdma" = "yes" ; then
  echo "CONFIG_RDMA=y" >> $config_host_mak
+2 −2
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ for debugging, profiling, and observing execution.

1. Build with the 'simple' trace backend:

    ./configure --enable-trace-backend=simple
    ./configure --enable-trace-backends=simple
    make

2. Create a file with the events you want to trace:
@@ -142,7 +142,7 @@ script.
The trace backend is chosen at configure time and only one trace backend can
be built into the binary:

    ./configure --trace-backend=simple
    ./configure --trace-backends=simple

For a list of supported trace backends, try ./configure --help or see below.

Loading