Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3612017rwl; Tue, 27 Dec 2022 11:58:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXu/O7x0kE3gQYPjMgdgnE0yJQdLxewBxU+jdG0S+OyvpTEKlA3RKjhGeYudL4kkoxY5cfMR X-Received: by 2002:a17:906:99c7:b0:7ae:b637:633f with SMTP id s7-20020a17090699c700b007aeb637633fmr28124115ejn.4.1672171100179; Tue, 27 Dec 2022 11:58:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672171100; cv=none; d=google.com; s=arc-20160816; b=wb0G8GqgBMANsA7foNQTE/p3OstPHRDVtBJ1cAbVQfelBiyVaCHv7/+b4oOLzIQOib gUvl7I8Z8lKmmaLFVDOrzA3gdl/fE3xEi/RK/hxR1QIczmCxlQ2Ney9MNN/8Otjq66eZ Kioe6oPvdELR/PBIFtq3zRKknsL7q7DBpYFIFMGQjcWcoRKwWcPmEusu3/l1Z8HZ92ih 4+f6HJW8ub/dnpktBouOmX3HGwf5QcGaZYSlbGmTaHeVFTw7GjCRFM73FCnCEUrrysJU FXGWSDx7Z7R/bmGQzT7w0K2uuxu79aYRhN/QR5E5AArIki0CZuerUBqrlFsYe3DY7Kxy qkMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=/q0Crof8q8V+8RgYswk3311L1UJGwtVfuTGMKthNFUs=; b=xrsMQ8CmzYe+5/dxDsvorbrg2VTvsE7bCb/rjtZBP6fSVY5kgs3UCbryUIuoZ41sQ/ 2ORwwVPJXjp3idqSRKFuR4yN2mIvfl/fJmD9n0scsxSFmrOF/Vcq3WK1GQ2igWhtVIE/ lmhf1+fqecWRwRa340mG8PfWKQvhG0MSd+OdHH0RvqXq9bYCM+BKBO2C7Cf9XJL/0glQ Ph9vjkRNhtX7nb/pmuNihFrXa6sHSgb3ftjDnGrNIz5RbVwpqXK1XtW+Di65kqlCu3KX Bh2r1tXfujTWLECPV25klvrNHsGDw4tc/4d6rKMcThtLQz+76m1F8K6YXwuyQhOPZHeR tE0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ss4-20020a170907c00400b007bb286800d4si9226578ejc.886.2022.12.27.11.58.04; Tue, 27 Dec 2022 11:58:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231168AbiL0TfU (ORCPT + 66 others); Tue, 27 Dec 2022 14:35:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231917AbiL0Te7 (ORCPT ); Tue, 27 Dec 2022 14:34:59 -0500 Received: from mail-il1-f180.google.com (mail-il1-f180.google.com [209.85.166.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D2CEB1F3; Tue, 27 Dec 2022 11:34:58 -0800 (PST) Received: by mail-il1-f180.google.com with SMTP id y2so7186885ily.5; Tue, 27 Dec 2022 11:34:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/q0Crof8q8V+8RgYswk3311L1UJGwtVfuTGMKthNFUs=; b=KJAeQ6skYR75Ke+GBlomXpMNaNZWm6fulYY6cxlx38ym03Mus+2MtMSvMojMYWU+Jh V4pcRE6MjYVxmR3SBedIFR+uKMNFTY9Xqkls+CoQ4bTaGV97ZxUIG3K3xDhOiv2Frv15 zBwXsyCAcN1TRcR8VNpoNbFA9Rrcfn8krHcuvJaT6yUN8rXrFh53Xokum771igSX8vIY /9aF+cqcTRxQ5/C58sbnYo3lbiZnjEODh0frcGU52zDpg+VWMKEpOUDrOSxuLfngcWti GcvKSkuJBkdEVeq+h3jJfB97fOybY1BarqsGqJDSiw7N4nLYxw91Anz84mLGfveHrn/w Qtyg== X-Gm-Message-State: AFqh2kpI3liDNlaitHIrn9xBCVjaAJm79Y8Pfcp2idjuUnUN6gef7VgW GSFuX/uViVviKWfbJRi76o+iQNHAaA2t66GxNdE= X-Received: by 2002:a92:ceca:0:b0:30b:8e9:1047 with SMTP id z10-20020a92ceca000000b0030b08e91047mr2350445ilq.271.1672169697504; Tue, 27 Dec 2022 11:34:57 -0800 (PST) MIME-Version: 1.0 References: <20221226085703.95081-1-yangjihong1@huawei.com> In-Reply-To: <20221226085703.95081-1-yangjihong1@huawei.com> From: Namhyung Kim Date: Tue, 27 Dec 2022 11:34:46 -0800 Message-ID: Subject: Re: [PATCH] perf help: Use HAVE_LIBTRACEEVENT to filter out unsupported commands To: Yang Jihong Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Mon, Dec 26, 2022 at 1:00 AM Yang Jihong wrote: > > Commands such as kmem, kwork, lock, sched, trace and timechart depend on > libtraceevent, these commands need to be isolated using HAVE_LIBTRACEEVENT > macro when cmdlist generation. > > The output of the generate-cmdlist.sh script is as follows: > > # ./util/generate-cmdlist.sh > /* Automatically generated by ./util/generate-cmdlist.sh */ > struct cmdname_help > { > char name[16]; > char help[80]; > }; > > static struct cmdname_help common_cmds[] = { > {"annotate", "Read perf.data (created by perf record) and display annotated code"}, > {"archive", "Create archive with object files with build-ids found in perf.data file"}, > {"bench", "General framework for benchmark suites"}, > {"buildid-cache", "Manage build-id cache."}, > {"buildid-list", "List the buildids in a perf.data file"}, > {"c2c", "Shared Data C2C/HITM Analyzer."}, > {"config", "Get and set variables in a configuration file."}, > {"daemon", "Run record sessions on background"}, > {"data", "Data file related processing"}, > {"diff", "Read perf.data files and display the differential profile"}, > {"evlist", "List the event names in a perf.data file"}, > {"ftrace", "simple wrapper for kernel's ftrace functionality"}, > {"inject", "Filter to augment the events stream with additional information"}, > {"iostat", "Show I/O performance metrics"}, > {"kallsyms", "Searches running kernel for symbols"}, > {"kvm", "Tool to trace/measure kvm guest os"}, > {"list", "List all symbolic event types"}, > {"mem", "Profile memory accesses"}, > {"record", "Run a command and record its profile into perf.data"}, > {"report", "Read perf.data (created by perf record) and display the profile"}, > {"script", "Read perf.data (created by perf record) and display trace output"}, > {"stat", "Run a command and gather performance counter statistics"}, > {"test", "Runs sanity tests."}, > {"top", "System profiling tool."}, > {"version", "display the version of perf binary"}, > #ifdef HAVE_LIBELF_SUPPORT > {"probe", "Define new dynamic tracepoints"}, > #endif /* HAVE_LIBELF_SUPPORT */ > #if defined(HAVE_LIBTRACEEVENT) && (defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT)) > {"trace", "strace inspired tool"}, > #endif /* HAVE_LIBTRACEEVENT && (HAVE_LIBAUDIT_SUPPORT || HAVE_SYSCALL_TABLE_SUPPORT) */ > #ifdef HAVE_LIBTRACEEVENT > {"kmem", "Tool to trace/measure kernel memory properties"}, > {"kwork", "Tool to trace/measure kernel work properties (latencies)"}, > {"lock", "Analyze lock events"}, > {"sched", "Tool to trace/measure scheduler properties (latencies)"}, > {"timechart", "Tool to visualize total system behavior during a workload"}, > #endif /* HAVE_LIBTRACEEVENT */ > }; > > Fixes: 378ef0f5d9d7 ("perf build: Use libtraceevent from the system") > Signed-off-by: Yang Jihong Acked-by: Namhyung Kim Thanks, Namhyung > --- > tools/perf/command-list.txt | 10 +++++----- > tools/perf/util/generate-cmdlist.sh | 19 +++++++++++++++++-- > 2 files changed, 22 insertions(+), 7 deletions(-) > > diff --git a/tools/perf/command-list.txt b/tools/perf/command-list.txt > index 8fcab5ad00c5..e8d2762adade 100644 > --- a/tools/perf/command-list.txt > +++ b/tools/perf/command-list.txt > @@ -16,20 +16,20 @@ perf-ftrace mainporcelain common > perf-inject mainporcelain common > perf-iostat mainporcelain common > perf-kallsyms mainporcelain common > -perf-kmem mainporcelain common > +perf-kmem mainporcelain traceevent > perf-kvm mainporcelain common > -perf-kwork mainporcelain common > +perf-kwork mainporcelain traceevent > perf-list mainporcelain common > -perf-lock mainporcelain common > +perf-lock mainporcelain traceevent > perf-mem mainporcelain common > perf-probe mainporcelain full > perf-record mainporcelain common > perf-report mainporcelain common > -perf-sched mainporcelain common > +perf-sched mainporcelain traceevent > perf-script mainporcelain common > perf-stat mainporcelain common > perf-test mainporcelain common > -perf-timechart mainporcelain common > +perf-timechart mainporcelain traceevent > perf-top mainporcelain common > perf-trace mainporcelain audit > perf-version mainporcelain common > diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh > index c3cef36d4176..1b5140e5ce99 100755 > --- a/tools/perf/util/generate-cmdlist.sh > +++ b/tools/perf/util/generate-cmdlist.sh > @@ -38,7 +38,7 @@ do > done > echo "#endif /* HAVE_LIBELF_SUPPORT */" > > -echo "#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT)" > +echo "#if defined(HAVE_LIBTRACEEVENT) && (defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT))" > sed -n -e 's/^perf-\([^ ]*\)[ ].* audit*/\1/p' command-list.txt | > sort | > while read cmd > @@ -51,5 +51,20 @@ do > p > }' "Documentation/perf-$cmd.txt" > done > -echo "#endif /* HAVE_LIBELF_SUPPORT */" > +echo "#endif /* HAVE_LIBTRACEEVENT && (HAVE_LIBAUDIT_SUPPORT || HAVE_SYSCALL_TABLE_SUPPORT) */" > + > +echo "#ifdef HAVE_LIBTRACEEVENT" > +sed -n -e 's/^perf-\([^ ]*\)[ ].* traceevent.*/\1/p' command-list.txt | > +sort | > +while read cmd > +do > + sed -n ' > + /^NAME/,/perf-'"$cmd"'/H > + ${ > + x > + s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/ > + p > + }' "Documentation/perf-$cmd.txt" > +done > +echo "#endif /* HAVE_LIBTRACEEVENT */" > echo "};" > -- > 2.17.1 >