lkml.org 
[lkml]   [2022]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH 2/2] perf gtk: Only support --gtk if compiled in
From
If HAVE_GTK2_SUPPORT isn't defined then --gtk can't succeed, don't
support it as a command line option in this case.

Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/builtin-annotate.c | 8 ++++++++
tools/perf/builtin-report.c | 6 ++++++
2 files changed, 14 insertions(+)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 5e038d9bab05..7664e54bb785 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -50,7 +50,9 @@ struct perf_annotate {
bool use_tui;
#endif
bool use_stdio, use_stdio2;
+#ifdef HAVE_GTK2_SUPPORT
bool use_gtk;
+#endif
bool skip_missing;
bool has_br_stack;
bool group_set;
@@ -506,7 +508,9 @@ int cmd_annotate(int argc, const char **argv)
OPT_BOOLEAN('q', "quiet", &quiet, "do now show any message"),
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
+#ifdef HAVE_GTK2_SUPPORT
OPT_BOOLEAN(0, "gtk", &annotate.use_gtk, "Use the GTK interface"),
+#endif
#ifdef HAVE_SLANG_SUPPORT
OPT_BOOLEAN(0, "tui", &annotate.use_tui, "Use the TUI interface"),
#endif
@@ -592,10 +596,12 @@ int cmd_annotate(int argc, const char **argv)
if (annotate_check_args(&annotate.opts) < 0)
return -EINVAL;

+#ifdef HAVE_GTK2_SUPPORT
if (symbol_conf.show_nr_samples && annotate.use_gtk) {
pr_err("--show-nr-samples is not available in --gtk mode at this time\n");
return ret;
}
+#endif

ret = symbol__validate_sym_arguments();
if (ret)
@@ -634,8 +640,10 @@ int cmd_annotate(int argc, const char **argv)
else if (annotate.use_tui)
use_browser = 1;
#endif
+#ifdef HAVE_GTK2_SUPPORT
else if (annotate.use_gtk)
use_browser = 2;
+#endif

setup_browser(true);

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 1ad75c7ba074..b325d180293d 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -74,7 +74,9 @@ struct report {
#ifdef HAVE_SLANG_SUPPORT
bool use_tui;
#endif
+#ifdef HAVE_GTK2_SUPPORT
bool use_gtk;
+#endif
bool use_stdio;
bool show_full_info;
bool show_threads;
@@ -1213,7 +1215,9 @@ int cmd_report(int argc, const char **argv)
#ifdef HAVE_SLANG_SUPPORT
OPT_BOOLEAN(0, "tui", &report.use_tui, "Use the TUI interface"),
#endif
+#ifdef HAVE_GTK2_SUPPORT
OPT_BOOLEAN(0, "gtk", &report.use_gtk, "Use the GTK2 interface"),
+#endif
OPT_BOOLEAN(0, "stdio", &report.use_stdio,
"Use the stdio interface"),
OPT_BOOLEAN(0, "header", &report.header, "Show data header."),
@@ -1502,8 +1506,10 @@ int cmd_report(int argc, const char **argv)
else if (report.use_tui)
use_browser = 1;
#endif
+#ifdef HAVE_GTK2_SUPPORT
else if (report.use_gtk)
use_browser = 2;
+#endif

/* Force tty output for header output and per-thread stat. */
if (report.header || report.header_only || report.show_threads)
--
2.35.0.rc0.227.g00780c9af4-goog
\
 
 \ /
  Last update: 2022-01-23 20:19    [W:0.054 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site