trace/simple: Enable tracing on startup only if the user specifies a trace option
PATCH 1/1 trace/simple: Enable tracing on startup only if the user specifies a trace option
From: Josh DuBois <[email protected]>
Tracing can be enabled at the command line or via the monitor. Command-line trace options are recorded during trace_opt_parse(), but tracing is not enabled until the various front-ends later call trace_init_file(). If the user passes a trace option on the command-line, remember that and enable tracing during trace_init_file(). Otherwise, trace_init_file() should record the trace file specified by the frontend and avoid enabling traces until the user requests them via the monitor.
This fixes 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4 and also db25d56c014aa1a96319c663e0a60346a223b31e, by allowing the user to enable traces on the command line and also avoiding unwanted trace-<pid> files when the user has not asked for them.
--- trace/control.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
trace/control.c +5 -1
@@ -39,6 +39,7 @@ static TraceEventGroup *event_groups;static size_t nevent_groups;static uint32_t next_id;static uint32_t next_vcpu_id; +static bool init_trace_on_startup;QemuOptsList qemu_trace_opts = { .name ="trace" ,
@@ -225,7 +226,9 @@ void trace_init_file(const char *file) {#ifdef CONFIG_TRACE_SIMPLE st_set_trace_file (file); -st_set_trace_file_enabled (true); +if (init_trace_on_startup) { +st_set_trace_file_enabled (true); + }#elif definedCONFIG_TRACE_LOG /* * If both the simple and the log backends are enabled, "--trace file"
@@ -299,6 +302,7 @@ char *trace_opt_parse(const char *optarg) }trace_init_events (qemu_opt_get (opts,"events" )); trace_file =g_strdup (qemu_opt_get (opts,"file" )); + init_trace_on_startup = true;qemu_opts_del (opts);return trace_file;
Signature · 1 line
2.25.1
Quoted 46 lines · [email protected] writes:
From: Josh DuBois <[email protected]>
Tracing can be enabled at the command line or via the monitor. Command-line trace options are recorded during
trace_opt_parse(), but tracing is not enabled until the various front-ends later calltrace_init_file(). If the user passes a trace option on the command-line, remember that and enable tracing duringtrace_init_file(). Otherwise,trace_init_file()should record the trace file specified by the frontend and avoid enabling traces until the user requests them via the monitor.This fixes
1b7157be3a8c4300fc8044d40f4b2e64a152a1b4and alsodb25d56c014aa1a96319c663e0a60346a223b31e, by allowing the user to enable traces on the command line and also avoiding unwanted trace-<pid> files when the user has not asked for them.Fixes 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4Signed-off-by Josh DuBois <[email protected]>--- trace/control.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)trace/control.c +4
-1@@ -39,6 +39,7 @@ static TraceEventGroup *event_groups;static size_t nevent_groups;static uint32_t next_id;static uint32_t next_vcpu_id; +static bool init_trace_on_startup;QemuOptsList qemu_trace_opts = { .name ="trace" ,@@ -225,7 +226,9 @@ void trace_init_file(const char *file) {#ifdef CONFIG_TRACE_SIMPLE st_set_trace_file (file); -st_set_trace_file_enabled (true); +if (init_trace_on_startup) { +st_set_trace_file_enabled (true); + }#elif definedCONFIG_TRACE_LOG /* * If both the simple and the log backends are enabled, "--trace file"
trace/control.c char *trace_opt_parse(const char *optarg) · line 308
Quoted 7 lines
trace/control.c +1
-0@@ -299,6 +302,7 @@ char *trace_opt_parse(const char *optarg) }trace_init_events (qemu_opt_get (opts,"events" )); trace_file =g_strdup (qemu_opt_get (opts,"file" )); + init_trace_on_startup = true;qemu_opts_del (opts);return trace_file;
Stops the littering for me.
Stefan, please have a closer look.
Quoted 54 lines · Markus Armbruster
Quoted 52 lines · [email protected] writes:
From: Josh DuBois <[email protected]>
Tracing can be enabled at the command line or via the monitor. Command-line trace options are recorded during
trace_opt_parse(), but tracing is not enabled until the various front-ends later calltrace_init_file(). If the user passes a trace option on the command-line, remember that and enable tracing duringtrace_init_file(). Otherwise,trace_init_file()should record the trace file specified by the frontend and avoid enabling traces until the user requests them via the monitor.This fixes
1b7157be3a8c4300fc8044d40f4b2e64a152a1b4and alsodb25d56c014aa1a96319c663e0a60346a223b31e, by allowing the user to enable traces on the command line and also avoiding unwanted trace-<pid> files when the user has not asked for them.Fixes 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4Signed-off-by Josh DuBois <[email protected]>--- trace/control.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)trace/control.c +5
-1@@ -39,6 +39,7 @@ static TraceEventGroup *event_groups;static size_t nevent_groups;static uint32_t next_id;static uint32_t next_vcpu_id; +static bool init_trace_on_startup;QemuOptsList qemu_trace_opts = { .name ="trace" ,@@ -225,7 +226,9 @@ void trace_init_file(const char *file) {#ifdef CONFIG_TRACE_SIMPLE st_set_trace_file (file); -st_set_trace_file_enabled (true); +if (init_trace_on_startup) { +st_set_trace_file_enabled (true); + }#elif definedCONFIG_TRACE_LOG /* * If both the simple and the log backends are enabled, "--trace file" @@ -299,6 +302,7 @@ char *trace_opt_parse(const char *optarg) }trace_init_events (qemu_opt_get (opts,"events" )); trace_file =g_strdup (qemu_opt_get (opts,"file" )); + init_trace_on_startup = true;qemu_opts_del (opts);
Quoted 5 lines
trace/control.c char *trace_opt_parse(const char *optarg) · line 308
Quoted 1 line
trace/control.c +0
-0return trace_file;Stops the littering for me.
Stefan, please have a closer look.
Ping?
Stefan Hajnoczi
AppliedQuoted 16 lines · On Sun, Aug 16, 2020 at 12:46:10PM -0500, [email protected] wrote:
From: Josh DuBois <[email protected]>
Tracing can be enabled at the command line or via the monitor. Command-line trace options are recorded during
trace_opt_parse(), but tracing is not enabled until the various front-ends later calltrace_init_file(). If the user passes a trace option on the command-line, remember that and enable tracing duringtrace_init_file(). Otherwise,trace_init_file()should record the trace file specified by the frontend and avoid enabling traces until the user requests them via the monitor.This fixes
1b7157be3a8c4300fc8044d40f4b2e64a152a1b4and alsodb25d56c014aa1a96319c663e0a60346a223b31e, by allowing the user to enable traces on the command line and also avoiding unwanted trace-<pid> files when the user has not asked for them.
Quoted 5 lines
Fixes 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4Signed-off-by Josh DuBois <[email protected]>--- trace/control.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Thanks, applied to my tracing-next tree:
https://github.com/stefanha/qemu/commits/tracing-next
Stefan
Quoted 23 lines · Stefan Hajnoczi
Quoted 16 lines · On Sun, Aug 16, 2020 at 12:46:10PM -0500, [email protected] wrote:
From: Josh DuBois <[email protected]>
Tracing can be enabled at the command line or via the monitor. Command-line trace options are recorded during
trace_opt_parse(), but tracing is not enabled until the various front-ends later calltrace_init_file(). If the user passes a trace option on the command-line, remember that and enable tracing duringtrace_init_file(). Otherwise,trace_init_file()should record the trace file specified by the frontend and avoid enabling traces until the user requests them via the monitor.This fixes
1b7157be3a8c4300fc8044d40f4b2e64a152a1b4and alsodb25d56c014aa1a96319c663e0a60346a223b31e, by allowing the user to enable traces on the command line and also avoiding unwanted trace-<pid> files when the user has not asked for them.Quoted 5 lines
Fixes 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4Signed-off-by Josh DuBois <[email protected]>--- trace/control.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Quoted 4 lines
Thanks, applied to my tracing-next tree:
https://github.com/stefanha/qemu/commits/tracing-nextStefan
Pull request?
Quoted 25 lines · Markus Armbruster
Quoted 23 lines · Stefan Hajnoczi
Quoted 21 lines · On Sun, Aug 16, 2020 at 12:46:10PM -0500, [email protected] wrote:
From: Josh DuBois <[email protected]>
Tracing can be enabled at the command line or via the monitor. Command-line trace options are recorded during
trace_opt_parse(), but tracing is not enabled until the various front-ends later calltrace_init_file(). If the user passes a trace option on the command-line, remember that and enable tracing duringtrace_init_file(). Otherwise,trace_init_file()should record the trace file specified by the frontend and avoid enabling traces until the user requests them via the monitor.This fixes
1b7157be3a8c4300fc8044d40f4b2e64a152a1b4and alsodb25d56c014aa1a96319c663e0a60346a223b31e, by allowing the user to enable traces on the command line and also avoiding unwanted trace-<pid> files when the user has not asked for them.Fixes 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4Signed-off-by Josh DuBois <[email protected]>--- trace/control.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Quoted 6 lines
Quoted 4 lines
Thanks, applied to my tracing-next tree:
https://github.com/stefanha/qemu/commits/tracing-nextStefan
Pull request?
Pretty-please?
Thanks for keeping on following-up, Markus.
I know it's a small one, but it's still nice to have a small patch feel loved ;)
Quoted 38 lines · Markus Armbruster
Quoted 25 lines · Markus Armbruster
Quoted 23 lines · Stefan Hajnoczi
Quoted 21 lines · On Sun, Aug 16, 2020 at 12:46:10PM -0500, [email protected] wrote:
From: Josh DuBois <[email protected]>
Tracing can be enabled at the command line or via the monitor. Command-line trace options are recorded during
trace_opt_parse(), but tracing is not enabled until the various front-ends later calltrace_init_file(). If the user passes a trace option on the command-line, remember that and enable tracing duringtrace_init_file(). Otherwise,trace_init_file()should record the trace file specified by the frontend and avoid enabling traces until the user requests them via the monitor.This fixes
1b7157be3a8c4300fc8044d40f4b2e64a152a1b4and alsodb25d56c014aa1a96319c663e0a60346a223b31e, by allowing the user to enable traces on the command line and also avoiding unwanted trace-<pid> files when the user has not asked for them.Fixes 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4Signed-off-by Josh DuBois <[email protected]>---
trace/control.c| 6 +++++-1 file changed, 5 insertions(+), 1 deletion(-)Quoted 6 lines
Quoted 4 lines
Thanks, applied to my tracing-next tree:
https://github.com/stefanha/qemu/commits/tracing-nextStefan
Pull request?
Pretty-please?