diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2016-03-31 13:49:59 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-03-31 13:49:59 +0100 |
commit | 1458317c8ada834cf39287f6d11a8cb8a37360d6 (patch) | |
tree | 279b91f1ad0677981e4134cccd0007227079df9d | |
parent | 92741fc4b6cbf7a8f6cce45e9a468d5637a4ff6a (diff) | |
parent | a6d4953b6057dfc0b9b6b2d775231648fca3ca2b (diff) |
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging
# gpg: Signature made Thu 31 Mar 2016 13:35:23 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-events: Fix typos (found by codespell)
log: move qemu_log_close/qemu_log_flush from header to log.c
trace: do not always call exit() in trace_enable_events
docs: Update documentation for stderr (now log) tracing backend.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | docs/tracing.txt | 4 | ||||
-rw-r--r-- | include/qemu/log.h | 22 | ||||
-rw-r--r-- | trace-events | 4 | ||||
-rw-r--r-- | trace/control.c | 5 | ||||
-rw-r--r-- | util/log.c | 17 |
5 files changed, 30 insertions, 22 deletions
diff --git a/docs/tracing.txt b/docs/tracing.txt index 3182ee82ad..0bd6b9cf9e 100644 --- a/docs/tracing.txt +++ b/docs/tracing.txt @@ -157,9 +157,9 @@ performance penalty. Note that regardless of the selected trace backend, events with the "disable" property will be generated with the "nop" backend. -=== Stderr === +=== Log === -The "stderr" backend sends trace events directly to standard error. This +The "log" backend sends trace events directly to standard error. This effectively turns trace events into debug printfs. This is the simplest backend and can be used together with existing code that diff --git a/include/qemu/log.h b/include/qemu/log.h index cf38adbdb0..c52f136ac1 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -95,23 +95,6 @@ qemu_log_vprintf(const char *fmt, va_list va) /* Maintenance: */ -/* fflush() the log file */ -static inline void qemu_log_flush(void) -{ - fflush(qemu_logfile); -} - -/* Close the log file */ -static inline void qemu_log_close(void) -{ - if (qemu_logfile) { - if (qemu_logfile != stderr) { - fclose(qemu_logfile); - } - qemu_logfile = NULL; - } -} - /* define log items */ typedef struct QEMULogItem { int mask; @@ -146,4 +129,9 @@ int qemu_str_to_log_mask(const char *str); */ void qemu_print_log_usage(FILE *f); +/* fflush() the log file */ +void qemu_log_flush(void); +/* Close the log file */ +void qemu_log_close(void); + #endif diff --git a/trace-events b/trace-events index d494de1446..996a77f013 100644 --- a/trace-events +++ b/trace-events @@ -144,8 +144,8 @@ cpu_out(unsigned int addr, char size, unsigned int val) "addr %#x(%c) value %u" # Since requests are raised via monitor, not many tracepoints are needed. balloon_event(void *opaque, unsigned long addr) "opaque %p addr %lu" virtio_balloon_handle_output(const char *name, uint64_t gpa) "section name: %s gpa: %"PRIx64 -virtio_balloon_get_config(uint32_t num_pages, uint32_t acutal) "num_pages: %d acutal: %d" -virtio_balloon_set_config(uint32_t acutal, uint32_t oldacutal) "acutal: %d oldacutal: %d" +virtio_balloon_get_config(uint32_t num_pages, uint32_t actual) "num_pages: %d actual: %d" +virtio_balloon_set_config(uint32_t actual, uint32_t oldactual) "actual: %d oldactual: %d" virtio_balloon_to_target(uint64_t target, uint32_t num_pages) "balloon target: %"PRIx64" num_pages: %d" # hw/intc/apic_common.c diff --git a/trace/control.c b/trace/control.c index ccddda537f..d099f735d5 100644 --- a/trace/control.c +++ b/trace/control.c @@ -20,6 +20,7 @@ #include "qemu/log.h" #endif #include "qemu/error-report.h" +#include "monitor/monitor.h" int trace_events_enabled_count; bool trace_events_dstate[TRACE_EVENT_COUNT]; @@ -132,7 +133,9 @@ void trace_enable_events(const char *line_buf) { if (is_help_option(line_buf)) { trace_list_events(); - exit(0); + if (cur_mon == NULL) { + exit(0); + } } else { do_trace_enable_events(line_buf); } diff --git a/util/log.c b/util/log.c index b219081e91..1857730dcb 100644 --- a/util/log.c +++ b/util/log.c @@ -198,6 +198,23 @@ void qemu_set_dfilter_ranges(const char *filter_spec) } } +/* fflush() the log file */ +void qemu_log_flush(void) +{ + fflush(qemu_logfile); +} + +/* Close the log file */ +void qemu_log_close(void) +{ + if (qemu_logfile) { + if (qemu_logfile != stderr) { + fclose(qemu_logfile); + } + qemu_logfile = NULL; + } +} + const QEMULogItem qemu_log_items[] = { { CPU_LOG_TB_OUT_ASM, "out_asm", "show generated host assembly code for each compiled TB" }, |