From patchwork Tue May 13 22:02:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexis Berlemont X-Patchwork-Id: 4171051 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E1754BFF02 for ; Tue, 13 May 2014 22:12:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DABF820304 for ; Tue, 13 May 2014 22:12:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B384E2027D for ; Tue, 13 May 2014 22:12:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933007AbaEMWML (ORCPT ); Tue, 13 May 2014 18:12:11 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:61958 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932072AbaEMWFQ (ORCPT ); Tue, 13 May 2014 18:05:16 -0400 Received: by mail-wi0-f169.google.com with SMTP id hi2so7812104wib.4 for ; Tue, 13 May 2014 15:05:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=myQI/Iwf2TWV5+R5fE/Ly3emORovGfX7lEKq5kLoPqM=; b=Fj4GQUvqIdjFNVv5DNJOQtNRsOg8Fi4Y1Dvnei4PgY0gwXMtOzPkDTNgH5DsYN7SfQ yW9K+fgzkE7nfp5O+NjbTx0ZzLdH6hvGYTFeHM208rr0vgjyG6uUATCU+qhsBWXbe4Y+ tuXnCeblEGUFV3MtY66GSVMeVaT0kXXN4cwnjSktQomad9ZT07fykIS7T4eGetsUbx1Q vmINsu/i1f7dX2YOr9AAjHxJAQaPty5p1FlSW3BJ5JDhgYe989qwav+GBm5hIj1cPZ73 vXNDoS04smdCVuy1alHjkXAJCABBbU33vL3Mo99ti76/aPAZV829gzZjKL3g/eFH1O3p hKSA== X-Received: by 10.180.93.226 with SMTP id cx2mr23166526wib.16.1400018714635; Tue, 13 May 2014 15:05:14 -0700 (PDT) Received: from localhost.localdomain (APuteaux-554-1-77-61.w82-124.abo.wanadoo.fr. [82.124.220.61]) by mx.google.com with ESMTPSA id lj15sm335557wic.13.2014.05.13.15.05.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 May 2014 15:05:13 -0700 (PDT) From: Alexis Berlemont To: linux-kernel@vger.kernel.org Cc: Jiri Olsa , acme@ghostprotocols.net, dsahern@gmail.com, mingo@kernel.org, Peter Zijlstra , Ingo Molnar , Paul Mackerras , Corey Ashford , Frederic Weisbecker , Namhyung Kim , Borislav Petkov , Michal Marek , linux-kbuild@vger.kernel.org, Stephane Eranian Subject: [PATCH 03/34] perf tools: Kbuild builtin source related fixies Date: Wed, 14 May 2014 00:02:58 +0200 Message-Id: <1400018609-20486-4-git-send-email-alexis.berlemont@gmail.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1400018609-20486-1-git-send-email-alexis.berlemont@gmail.com> References: <1400018609-20486-1-git-send-email-alexis.berlemont@gmail.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jiri Olsa Adding CONFIG_BUILTIN_* defines to govern builtin commands. This will be usefull for kbuild process switch. Signed-off-by: Jiri Olsa Cc: Arnaldo Carvalho de Melo Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Paul Mackerras Cc: Corey Ashford Cc: Frederic Weisbecker Cc: Namhyung Kim Cc: Borislav Petkov Cc: Michal Marek Cc: linux-kbuild@vger.kernel.org Cc: Stephane Eranian --- tools/perf/builtin-cmds.h | 27 ++++++++++++++++++++++ tools/perf/builtin-help.c | 1 + tools/perf/perf.c | 45 +++++++++++++++++++++++++++++++++++-- tools/perf/util/generate-cmdlist.sh | 10 +++++++++ 4 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 tools/perf/builtin-cmds.h diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h new file mode 100644 index 0000000..fec342a --- /dev/null +++ b/tools/perf/builtin-cmds.h @@ -0,0 +1,27 @@ +#ifndef BUILTIN_CMDS_H +#define BUILTIN_CMDS_H + +#define CONFIG_BUILTIN_REPORT 1 +#define CONFIG_BUILTIN_SCRIPT 1 +#define CONFIG_BUILTIN_BENCH 1 +#define CONFIG_BUILTIN_SCHED 1 +#define CONFIG_BUILTIN_TRACE 1 +#define CONFIG_BUILTIN_TOP 1 +#define CONFIG_BUILTIN_RECORD 1 +#define CONFIG_BUILTIN_BUILDID_LIST 1 +#define CONFIG_BUILTIN_INJECT 1 +#define CONFIG_BUILTIN_LOCK 1 +#define CONFIG_BUILTIN_KVM 1 +#define CONFIG_BUILTIN_BUILDID_CACHE 1 +#define CONFIG_BUILTIN_EVLIST 1 +#define CONFIG_BUILTIN_KMEM 1 +#define CONFIG_BUILTIN_STAT 1 +#define CONFIG_BUILTIN_DIFF 1 +#define CONFIG_BUILTIN_ANNOTATE 1 +#define CONFIG_BUILTIN_TIMECHART 1 +#define CONFIG_BUILTIN_LIST 1 +#define CONFIG_BUILTIN_HELP 1 +#define CONFIG_BUILTIN_PROBE 1 +#define CONFIG_BUILTIN_MEM 1 + +#endif /* BUILTIN_CMDS_H */ diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c index 178b88a..b6c78a6 100644 --- a/tools/perf/builtin-help.c +++ b/tools/perf/builtin-help.c @@ -7,6 +7,7 @@ #include "util/cache.h" #include "builtin.h" #include "util/exec_cmd.h" +#include "builtin-cmds.h" #include "common-cmds.h" #include "util/parse-options.h" #include "util/run-command.h" diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 431798a..c39470b 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c @@ -7,6 +7,7 @@ * perf top, perf record, perf report, etc.) are started. */ #include "builtin.h" +#include "builtin-cmds.h" #include "util/exec_cmd.h" #include "util/cache.h" @@ -33,34 +34,74 @@ struct cmd_struct { }; static struct cmd_struct commands[] = { +#ifdef CONFIG_BUILTIN_BUILDID_CACHE { "buildid-cache", cmd_buildid_cache, 0 }, +#endif +#ifdef CONFIG_BUILTIN_BUILDID_LIST { "buildid-list", cmd_buildid_list, 0 }, +#endif +#ifdef CONFIG_BUILTIN_DIFF { "diff", cmd_diff, 0 }, +#endif +#ifdef CONFIG_BUILTIN_EVLIST { "evlist", cmd_evlist, 0 }, +#endif +#ifdef CONFIG_BUILTIN_HELP { "help", cmd_help, 0 }, +#endif +#ifdef CONFIG_BUILTIN_LIST { "list", cmd_list, 0 }, +#endif +#ifdef CONFIG_BUILTIN_RECORD { "record", cmd_record, 0 }, +#endif +#ifdef CONFIG_BUILTIN_REPORT { "report", cmd_report, 0 }, +#endif +#ifdef CONFIG_BUILTIN_BENCH { "bench", cmd_bench, 0 }, +#endif +#ifdef CONFIG_BUILTIN_STAT { "stat", cmd_stat, 0 }, +#endif +#ifdef CONFIG_BUILTIN_TIMECHART { "timechart", cmd_timechart, 0 }, +#endif +#ifdef CONFIG_BUILTIN_TOP { "top", cmd_top, 0 }, +#endif +#ifdef CONFIG_BUILTIN_ANNOTATE { "annotate", cmd_annotate, 0 }, +#endif { "version", cmd_version, 0 }, +#ifdef CONFIG_BUILTIN_SCRIPT { "script", cmd_script, 0 }, +#endif +#ifdef CONFIG_BUILTIN_SCHED { "sched", cmd_sched, 0 }, -#ifdef HAVE_LIBELF_SUPPORT +#endif +#if defined HAVE_LIBELF_SUPPORT && defined CONFIG_BUILTIN_PROBE { "probe", cmd_probe, 0 }, #endif +#ifdef CONFIG_BUILTIN_KMEM { "kmem", cmd_kmem, 0 }, +#endif +#ifdef CONFIG_BUILTIN_LOCK { "lock", cmd_lock, 0 }, +#endif +#ifdef CONFIG_BUILTIN_KVM { "kvm", cmd_kvm, 0 }, +#endif { "test", cmd_test, 0 }, -#ifdef HAVE_LIBAUDIT_SUPPORT +#if defined HAVE_LIBAUDIT_SUPPORT && defined CONFIG_BUILTIN_TRACE { "trace", cmd_trace, 0 }, #endif +#ifdef CONFIG_BUILTIN_INJECT { "inject", cmd_inject, 0 }, +#endif +#ifdef CONFIG_BUILTIN_MEM { "mem", cmd_mem, 0 }, +#endif }; struct pager_config { diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh index 36a885d..05ee30f 100755 --- a/tools/perf/util/generate-cmdlist.sh +++ b/tools/perf/util/generate-cmdlist.sh @@ -1,5 +1,11 @@ #!/bin/sh +function cfg() +{ + cfg=`echo $1 | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g'` + echo "$cfg" +} + echo "/* Automatically generated by $0 */ struct cmdname_help { @@ -13,6 +19,7 @@ sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt | sort | while read cmd do + echo "#ifdef CONFIG_BUILTIN_$(cfg $cmd)" sed -n ' /^NAME/,/perf-'"$cmd"'/H ${ @@ -20,6 +27,7 @@ do s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/ p }' "Documentation/perf-$cmd.txt" + echo "#endif" done echo "#ifdef HAVE_LIBELF_SUPPORT" @@ -27,6 +35,7 @@ sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt | sort | while read cmd do + echo "#ifdef CONFIG_BUILTIN_$(cfg $cmd)" sed -n ' /^NAME/,/perf-'"$cmd"'/H ${ @@ -34,6 +43,7 @@ do s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/ p }' "Documentation/perf-$cmd.txt" + echo "#endif" done echo "#endif /* HAVE_LIBELF_SUPPORT */" echo "};"