perf tools: set GUI mode after returning from perf_session__new()
PATCH 1/1 perf tools: set GUI mode after returning from perf_session__new()
If perf_session__new() returns NULL with use_browser set to 2 via --gtk option previously, perf dies quietly without printing any errors.
The reason behind this is that GTK is not yet initialized when the caller inside perf_session__new() is trying to print error message to the screen.
Reorder code to print the messages to stdio when GTK is not yet ready.
--- tools/perf/builtin-report.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
tools/perf/builtin-report.c +7 -7
@@ -918,13 +918,6 @@ int cmd_report(int argc, const char **argv)return -EINVAL ; } -if (report.use_stdio) - use_browser =0 ; -else if (report.use_tui) - use_browser =1 ; -else if (report.use_gtk) - use_browser =2 ; -if (report.inverted_callchain) callchain_param.order =ORDER_CALLER ;if (symbol_conf.cumulate_callchain && !callchain_param.order_set)
@@ -949,6 +942,13 @@ int cmd_report(int argc, const char **argv)if (session ==NULL )return -1 ; +if (report.use_stdio) + use_browser =0 ; +else if (report.use_tui) + use_browser =1 ; +else if (report.use_gtk) + use_browser =2 ; +if (report.queue_size) {ordered_events__set_alloc_size (&session->ordered_events, report.queue_size);
Signature · 1 line
2.15.1
Namhyung Kim
maintainerHi SeokHo,
Quoted 7 lines · Song Seok Ho
If
perf_session__new()returns NULL withuse_browserset to 2 via --gtk option previously, perf dies quietly without printing any errors.The reason behind this is that GTK is not yet initialized when the caller inside
perf_session__new()is trying to print error message to the screen.Reorder code to print the messages to stdio when GTK is not yet ready.
I'm ok with this change, but it needs to consider other error messages too. There are more pr_err() calls between perf_session__new() and setup_browser(), so I think they have same problem.
Thanks,
Namhyung
Quoted 41 lines
Signed-off-by Song Seok Ho <[email protected]>--- tools/perf/builtin-report.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)tools/perf/builtin-report.c +7
-8@@ -918,13 +918,6 @@ int cmd_report(int argc, const char **argv)return -EINVAL ; } -if (report.use_stdio) - use_browser =0 ; -else if (report.use_tui) - use_browser =1 ; -else if (report.use_gtk) - use_browser =2 ; -if (report.inverted_callchain) callchain_param.order =ORDER_CALLER ;if (symbol_conf.cumulate_callchain && !callchain_param.order_set)@@ -949,6 +942,13 @@ int cmd_report(int argc, const char **argv)if (session ==NULL )return -1 ; +if (report.use_stdio) + use_browser =0 ; +else if (report.use_tui) + use_browser =1 ; +else if (report.use_gtk) + use_browser =2 ; +if (report.queue_size) {ordered_events__set_alloc_size (&session->ordered_events, report.queue_size); --2.15.1
Arnaldo Carvalho de Melo
maintainerEm Tue, Dec 05, 2017 at 12:05:18AM +0900, Namhyung Kim escreveu:
Quoted 6 lines
Hi SeokHo,
Quoted 3 lines · Song Seok Ho
If
perf_session__new()returns NULL withuse_browserset to 2 via --gtk option previously, perf dies quietly without printing any errors.
Quoted 8 lines
Quoted 4 lines
The reason behind this is that GTK is not yet initialized when the caller inside
perf_session__new()is trying to print error message to the screen.Reorder code to print the messages to stdio when GTK is not yet ready.
I'm ok with this change, but it needs to consider other error messages too. There are more
pr_err()calls betweenperf_session__new()andsetup_browser(), so I think they have same problem.
So I think I can apply this one, with Namhyung's acked-by and then Song can continue with followup patches?
- Arnaldo
Quoted 45 lines
Thanks,
NamhyungQuoted 41 lines
Signed-off-by Song Seok Ho <[email protected]>--- tools/perf/builtin-report.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)tools/perf/builtin-report.c +7
-8@@ -918,13 +918,6 @@ int cmd_report(int argc, const char **argv)return -EINVAL ; } -if (report.use_stdio) - use_browser =0 ; -else if (report.use_tui) - use_browser =1 ; -else if (report.use_gtk) - use_browser =2 ; -if (report.inverted_callchain) callchain_param.order =ORDER_CALLER ;if (symbol_conf.cumulate_callchain && !callchain_param.order_set)@@ -949,6 +942,13 @@ int cmd_report(int argc, const char **argv)if (session ==NULL )return -1 ; +if (report.use_stdio) + use_browser =0 ; +else if (report.use_tui) + use_browser =1 ; +else if (report.use_gtk) + use_browser =2 ; +if (report.queue_size) {ordered_events__set_alloc_size (&session->ordered_events, report.queue_size); --2.15.1
Hi Arnaldo,
2017-12-05 0:45 GMT+09:00 Arnaldo Carvalho de Melo <[email protected]>:
Quoted 12 lines
Em Tue, Dec 05, 2017 at 12:05:18AM +0900, Namhyung Kim escreveu:
Quoted 11 lines
Hi SeokHo,
Quoted 7 lines · Song Seok Ho
If
perf_session__new()returns NULL withuse_browserset to 2 via --gtk option previously, perf dies quietly without printing any errors.The reason behind this is that GTK is not yet initialized when the caller inside
perf_session__new()is trying to print error message to the screen.Reorder code to print the messages to stdio when GTK is not yet ready.
Quoted 9 lines
Quoted 3 lines
I'm ok with this change, but it needs to consider other error messages too. There are more
pr_err()calls betweenperf_session__new()andsetup_browser(), so I think they have same problem.So I think I can apply this one, with Namhyung's acked-by and then Song can continue with followup patches?
- Arnaldo
I've sent a follow-up patch with a new title "[PATCH v2] perf tools:
set browser mode
right before setup_browser()" with Namhyung's Acked-by added.
Addressing Namhyung's comment, I've moved the use_browser variable assignment code below when setup_browser() is called.
Please let me know if it deserves to be in a different place.
Thanks.
Arnaldo Carvalho de Melo
maintainerEm Tue, Dec 05, 2017 at 01:11:49AM +0900, SeokHo Song escreveu:
Quoted 25 lines
Hi Arnaldo,
2017-12-05 0:45 GMT+09:00 Arnaldo Carvalho de Melo <[email protected]>:
Quoted 12 lines
Em Tue, Dec 05, 2017 at 12:05:18AM +0900, Namhyung Kim escreveu:
Quoted 11 lines
Hi SeokHo,
Quoted 7 lines · Song Seok Ho
If
perf_session__new()returns NULL withuse_browserset to 2 via --gtk option previously, perf dies quietly without printing any errors.The reason behind this is that GTK is not yet initialized when the caller inside
perf_session__new()is trying to print error message to the screen.Reorder code to print the messages to stdio when GTK is not yet ready.
Quoted 9 lines
Quoted 3 lines
I'm ok with this change, but it needs to consider other error messages too. There are more
pr_err()calls betweenperf_session__new()andsetup_browser(), so I think they have same problem.So I think I can apply this one, with Namhyung's acked-by and then Song can continue with followup patches?
- Arnaldo
Quoted 8 lines
I've sent a follow-up patch with a new title "[PATCH v2] perf tools:
set browser mode
right beforesetup_browser()" with Namhyung's Acked-by added.Addressing Namhyung's comment, I've moved the
use_browservariable assignment code below whensetup_browser()is called.Please let me know if it deserves to be in a different place.
Ok, I've replaced the copy I had with this v2 one.
- Arnaldo