[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 09/21] trace: suppress log output of trace point
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [RFC PATCH 09/21] trace: suppress log output of trace points |
Date: |
Fri, 5 Oct 2018 16:48:58 +0100 |
When multiple tracers are enabled and you want to save to binary we
shouldn't assume the user also wants to spam the log. They can always
override it manually if they want.
Signed-off-by: Alex Bennée <address@hidden>
---
util/log.c | 3 ---
vl.c | 18 ++++++++++++++++--
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/util/log.c b/util/log.c
index cc79a146d1..5759bf571f 100644
--- a/util/log.c
+++ b/util/log.c
@@ -56,9 +56,6 @@ static bool log_uses_own_buffers;
void qemu_set_log(int log_flags)
{
qemu_loglevel = log_flags;
-#ifdef CONFIG_TRACE_LOG
- qemu_loglevel |= LOG_TRACE;
-#endif
if (!qemu_logfile &&
(is_daemonized() ? logfilename != NULL : qemu_loglevel)) {
if (logfilename) {
diff --git a/vl.c b/vl.c
index a867c9c4d9..795e025445 100644
--- a/vl.c
+++ b/vl.c
@@ -2908,6 +2908,7 @@ int main(int argc, char **argv, char **envp)
Error *err = NULL;
bool list_data_dirs = false;
char *dir, **dirs;
+ int maybe_log_trace = 0;
typedef struct BlockdevOptions_queue {
BlockdevOptions *bdo;
Location loc;
@@ -3985,6 +3986,19 @@ int main(int argc, char **argv, char **envp)
}
trace_init_file(trace_file);
+#if defined(CONFIG_TRACE_SIMPLE) && defined(CONFIG_TRACE_LOG)
+ /* If the user has both log and simple tracing enabled but hasn't
+ * defined a binary trace file ensure we enable the right logging
+ * flags.
+ */
+ if (!trace_file) {
+ maybe_log_trace = LOG_TRACE;
+ }
+#elif defined CONFIG_TRACE_LOG
+ /* with just CONFIG_TRACE_LOG we enable unconditionally */
+ maybe_log_trace = LOG_TRACE;
+#endif
+
/* Open the logfile at this point and set the log mask if necessary.
*/
if (log_file) {
@@ -3998,9 +4012,9 @@ int main(int argc, char **argv, char **envp)
qemu_print_log_usage(stdout);
exit(1);
}
- qemu_set_log(mask);
+ qemu_set_log(mask | maybe_log_trace);
} else {
- qemu_set_log(0);
+ qemu_set_log(maybe_log_trace);
}
/* add configured firmware directories */
--
2.17.1
- [Qemu-devel] [RFC PATCH 05/21] trace: keep a count of trace-point hits, (continued)
- [Qemu-devel] [RFC PATCH 05/21] trace: keep a count of trace-point hits, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 18/21] linux-user: allow dumping of plugin status at end of run, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 10/21] qom/cpu: add a cpu_exit trace event, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 12/21] configure: expose a plugin to the trace-backends, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 13/21] tracetool: generate plugin snippets, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 09/21] trace: suppress log output of trace points,
Alex Bennée <=
- [Qemu-devel] [RFC PATCH 02/21] util/log: add qemu_dfilter_append_range(), Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 16/21] trace: add infrastructure for building plugins, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 11/21] trace: expose a plugin fn pointer in TraceEvent, Alex Bennée, 2018/10/05
- [Qemu-devel] [RFC PATCH 14/21] trace: add support for plugin infrastructure, Alex Bennée, 2018/10/05