Commit ed7f5f1d authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Stefan Hajnoczi
Browse files

trace: convert stderr backend to log



[Also update .travis.yml --enable-trace-backends=stderr
--Stefan]

Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Acked-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Message-id: 1452174932-28657-10-git-send-email-den@openvz.org
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent d890d50d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ matrix:
      compiler: gcc
    # All the trace backends (apart from dtrace)
    - env: TARGETS=i386-softmmu,x86_64-softmmu
           EXTRA_CONFIG="--enable-trace-backends=stderr"
           EXTRA_CONFIG="--enable-trace-backends=log"
      compiler: gcc
    - env: TARGETS=i386-softmmu,x86_64-softmmu
           EXTRA_CONFIG="--enable-trace-backends=simple"
+2 −2
Original line number Diff line number Diff line
@@ -5445,8 +5445,8 @@ if have_backend "simple"; then
  # Set the appropriate trace file.
  trace_file="\"$trace_file-\" FMT_pid"
fi
if have_backend "stderr"; then
  echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
if have_backend "log"; then
  echo "CONFIG_TRACE_LOG=y" >> $config_host_mak
fi
if have_backend "ust"; then
  echo "CONFIG_TRACE_UST=y" >> $config_host_mak
+1 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ static inline bool qemu_log_separate(void)
#define CPU_LOG_MMU        (1 << 12)
#define CPU_LOG_TB_NOCHAIN (1 << 13)
#define CPU_LOG_PAGE       (1 << 14)
#define LOG_TRACE          (1 << 15)

/* Returns true if a bit is set in the current loglevel mask
 */
+5 −4
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ def generate_h_begin(events):
        '#include <sys/types.h>',
        '#include <unistd.h>',
        '#include "trace/control.h"',
        '#include "qemu/log.h"',
        '')


@@ -36,7 +37,7 @@ def generate_h(event):
    out('    if (trace_event_get_state(%(event_id)s)) {',
        '        struct timeval _now;',
        '        gettimeofday(&_now, NULL);',
        '        fprintf(stderr, "%%d@%%zd.%%06zd:%(name)s " %(fmt)s "\\n",',
        '        qemu_log_mask(LOG_TRACE, "%%d@%%zd.%%06zd:%(name)s " %(fmt)s "\\n",',
        '                      getpid(),',
        '                      (size_t)_now.tv_sec, (size_t)_now.tv_usec',
        '                      %(argnames)s);',
+10 −0
Original line number Diff line number Diff line
@@ -14,6 +14,9 @@
#ifdef CONFIG_TRACE_FTRACE
#include "trace/ftrace.h"
#endif
#ifdef CONFIG_TRACE_LOG
#include "qemu/log.h"
#endif
#include "qemu/error-report.h"

int trace_events_enabled_count;
@@ -174,6 +177,13 @@ void trace_init_file(const char *file)
{
#ifdef CONFIG_TRACE_SIMPLE
    st_set_trace_file(file);
#elif defined CONFIG_TRACE_LOG
    /* If both the simple and the log backends are enabled, "-trace file"
     * only applies to the simple backend; use "-D" for the log backend.
     */
    if (file) {
        qemu_set_log_filename(file);
    }
#else
    if (file) {
        fprintf(stderr, "error: -trace file=...: "
Loading