NOTE: hack

Forcing test objects not to be compiled into perf code.
This saves almost 1MB of perf binary size on my setup:

  # standard perf binary
  $ ls -l perf
  -rwxrwxr-x 1 jolsa jolsa 10283684 Jan  1 15:52 perf

  # current perf binary
  $ ls -l perf
  -rwxrwxr-x 1 jolsa jolsa 9303174 Jan  1 15:58 perf

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Alexis Berlemont <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
---
 tools/perf/builtin-cmds.h | 2 +-
 tools/perf/config.default | 2 +-
 tools/perf/perf-sys.h     | 2 +-
 tools/perf/perf.c         | 4 ++++
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
index 5ceb4b58cfdd..d0993b91932e 100644
--- a/tools/perf/builtin-cmds.h
+++ b/tools/perf/builtin-cmds.h
@@ -23,7 +23,7 @@
 #define CONFIG_BUILTIN_HELP
 #define CONFIG_BUILTIN_PROBE
 #define CONFIG_BUILTIN_MEM
-#define CONFIG_BUILTIN_TEST
+//#define CONFIG_BUILTIN_TEST
 
 #endif /* BUILTIN_CMDS_H */
 
diff --git a/tools/perf/config.default b/tools/perf/config.default
index 2781af21b70b..8a31a9d7b940 100644
--- a/tools/perf/config.default
+++ b/tools/perf/config.default
@@ -20,4 +20,4 @@ CONFIG_BUILTIN_INJECT        := y
 CONFIG_BUILTIN_MEM           := y
 CONFIG_BUILTIN_TRACE         := y
 CONFIG_BUILTIN_PROBE         := y
-CONFIG_BUILTIN_TEST          := y
+CONFIG_BUILTIN_TEST          := n
diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h
index a3b13d7dc1d4..48831388db1d 100644
--- a/tools/perf/perf-sys.h
+++ b/tools/perf/perf-sys.h
@@ -181,7 +181,7 @@ sys_perf_event_open(struct perf_event_attr *attr,
        fd = syscall(__NR_perf_event_open, attr, pid, cpu,
                     group_fd, flags);
 
-#ifdef HAVE_ATTR_TEST
+#if defined(CONFIG_BUILTIN_TEST) && defined(HAVE_ATTR_TEST)
        if (unlikely(test_attr__enabled))
                test_attr__open(attr, pid, cpu, fd, group_fd, flags);
 #endif
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 7c5ceff22d47..ef7c92cf9f25 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -57,7 +57,9 @@ static struct cmd_struct commands[] = {
        { "kmem",       cmd_kmem,       0 },
        { "lock",       cmd_lock,       0 },
        { "kvm",        cmd_kvm,        0 },
+#ifdef CONFIG_BUILTIN_TEST
        { "test",       cmd_test,       0 },
+#endif
 #ifdef HAVE_LIBAUDIT_SUPPORT
        { "trace",      cmd_trace,      0 },
 #endif
@@ -539,7 +541,9 @@ int main(int argc, const char **argv)
        }
        cmd = argv[0];
 
+#ifdef CONFIG_BUILTIN_TEST
        test_attr__init();
+#endif
 
        /*
         * We use PATH to find perf commands, but we prepend some higher
-- 
1.9.3

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

Reply via email to