[PATCH 04/34] perf tools: Kbuild source related fixies

From: Alexis Berlemont
Date: Tue May 13 2014 - 18:05:45 EST


From: Jiri Olsa <jolsa@xxxxxxxxxx>

Fixing several sources config dependencies to allow
separate config builds.

Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Corey Ashford <cjashfor@xxxxxxxxxxxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Borislav Petkov <bp@xxxxxxxxx>
Cc: Michal Marek <mmarek@xxxxxxx>
Cc: linux-kbuild@xxxxxxxxxxxxxxx
Cc: Stephane Eranian <eranian@xxxxxxxxxx>
---
tools/perf/builtin-lock.c | 4 +++-
tools/perf/builtin-sched.c | 2 ++
tools/perf/perf.c | 6 ++++++
tools/perf/perf.h | 2 ++
tools/perf/ui/browsers/scripts.c | 4 ++++
tools/perf/ui/setup.c | 10 +++++++++-
6 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index c852c7a..b255c20 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -992,9 +992,11 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused)
usage_with_options(report_usage, report_options);
}
rc = __cmd_report(false);
+#ifdef CONFIG_BULTIN_SCRIPT
} else if (!strcmp(argv[0], "script")) {
/* Aliased to 'perf script' */
- return cmd_script(argc, argv, prefix);
+ rc = cmd_script(argc, argv, prefix);
+#endif
} else if (!strcmp(argv[0], "info")) {
if (argc) {
argc = parse_options(argc, argv,
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 9ac0a49..cb77a4e 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1741,11 +1741,13 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
if (!argc)
usage_with_options(sched_usage, sched_options);

+#ifdef CONFIG_BULTIN_SCRIPT
/*
* Aliased to 'perf script' for now:
*/
if (!strcmp(argv[0], "script"))
return cmd_script(argc, argv, prefix);
+#endif

symbol__init();
if (!strncmp(argv[0], "rec", 3)) {
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index c39470b..74a1269 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -92,7 +92,9 @@ static struct cmd_struct commands[] = {
#ifdef CONFIG_BUILTIN_KVM
{ "kvm", cmd_kvm, 0 },
#endif
+#ifdef CONFIG_BUILTIN_TEST
{ "test", cmd_test, 0 },
+#endif
#if defined HAVE_LIBAUDIT_SUPPORT && defined CONFIG_BUILTIN_TRACE
{ "trace", cmd_trace, 0 },
#endif
@@ -543,13 +545,17 @@ int main(int argc, const char **argv)
} else {
/* The user didn't specify a command; give them help */
printf("\n usage: %s\n\n", perf_usage_string);
+#ifdef CONFIG_BUILTIN_HELP
list_common_cmds_help();
printf("\n %s\n\n", perf_more_info_string);
+#endif
goto out;
}
cmd = argv[0];

+#ifdef CONFIG_BUILTIN_TEST
test_attr__init();
+#endif

/*
* We use PATH to find perf commands, but we prepend some higher
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 5c11eca..8487a30 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -221,8 +221,10 @@ sys_perf_event_open(struct perf_event_attr *attr,
fd = syscall(__NR_perf_event_open, attr, pid, cpu,
group_fd, flags);

+#ifdef CONFIG_BUILTIN_TEST
if (unlikely(test_attr__enabled))
test_attr__open(attr, pid, cpu, fd, group_fd, flags);
+#endif

return fd;
}
diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c
index 402d2bd..128988d 100644
--- a/tools/perf/ui/browsers/scripts.c
+++ b/tools/perf/ui/browsers/scripts.c
@@ -59,7 +59,11 @@ static int list_scripts(char *script_name)
paths[i] = names[i] + SCRIPT_NAMELEN;
}

+#ifdef CONFIG_BUILTIN_SCRIPT
num = find_scripts(names, paths);
+#else
+ num = 0;
+#endif
if (num > 0) {
choice = ui__popup_menu(num, names);
if (choice < num && choice >= 0) {
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index 5df5140..66ecd08 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -71,16 +71,20 @@ void setup_browser(bool fallback_to_pager)

switch (use_browser) {
case 2:
+#if defined(CONFIG_GUI) || !defined(CONFIG_KBUILD)
if (setup_gtk_browser() == 0)
break;
printf("GTK browser requested but could not find %s\n",
PERF_GTK_DSO);
sleep(1);
+#endif
/* fall through */
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
case 1:
use_browser = 1;
if (ui__init() == 0)
break;
+#endif
/* fall through */
default:
use_browser = 0;
@@ -92,16 +96,20 @@ void setup_browser(bool fallback_to_pager)
}
}

-void exit_browser(bool wait_for_ok)
+void exit_browser(bool wait_for_ok __maybe_unused)
{
switch (use_browser) {
case 2:
+#if defined(CONFIG_GUI) || !defined(CONFIG_KBUILD)
exit_gtk_browser(wait_for_ok);
break;
+#endif

+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
case 1:
ui__exit(wait_for_ok);
break;
+#endif

default:
break;
--
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/