Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1355799rwd; Thu, 8 Jun 2023 17:04:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4K0YQS1xdxJ4a+L/U7oOfx0cefjiDO4wbTx812kvvIUNgFmNNW/H/Mq45b2motKrYz/2sT X-Received: by 2002:a17:90b:4d83:b0:253:30e1:7d68 with SMTP id oj3-20020a17090b4d8300b0025330e17d68mr66861pjb.0.1686269048899; Thu, 08 Jun 2023 17:04:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686269048; cv=none; d=google.com; s=arc-20160816; b=OxbWTZLoHZTMBdS+xAdDc9J0T/6HSgc4/68wrbQ9J/0rPKQHrLf4phEIqWSThp6Yl2 lMyiltGin+g07yXd5Hwz1xIwd0LBzj4CRYDDUPppraMmGxsGjtFnzxAQOIWpuN4eGu8k HiMZdDQLoFjsmM4XhTo59Ls50sBIA2ojcYu0nzclp3Dsd0uke1HKd0Asxjty+XGFuQsW t4MQitSl328h8+rdtK/fIcQSWiC9J/uTUpLw+6mJ7a1L9fikS+WAWGI16tCbDnQnsNUC ZgnXSBnKM/VKguJ9NogWUoqGwHFpSQ3GMe8hiG0yra076lsQYs21ijqA1LHBt86sCjtP ofUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=kjeLkyzQBXDMmpW+mv6gsgImE+Yu4bQUfqrg+TqZuYQ=; b=rm9Cm95pMV2ExXmcXFsfIVXeFc8txYJAv1qK3THtDHaYpDEE4EE+C/QJJnXG8KD4Eq B4nHRD/cbvUyIKmJwBz2Y6asji9FxgVO+jGtXdDOA1tcBddLq63m4YTikQ0QqK0D2BFo DfU2CzriSLfcX0gshCBv4eOID8k6UayuoxwKU7hUEhyAyyIXu3VNJM2JgC1kqGCQwAdU OSnDic8hvcqbMzAvcJmnNxVjGmNJjWtoUvOFXzzJONs8mMiWktzam98ljbmx46eV2kF8 Zd4H9bWKUkUAaXdWA8bP7i/udt8d7qPvbPP7KHyeYLEM53fcMQZmfAwY4ALI8/g0Y8mM FTaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ibE9O4dY; 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 p22-20020a637f56000000b0052856ce370asi1739008pgn.426.2023.06.08.17.03.56; Thu, 08 Jun 2023 17:04:08 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ibE9O4dY; 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 S231298AbjFHXYL (ORCPT + 99 others); Thu, 8 Jun 2023 19:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235662AbjFHXYF (ORCPT ); Thu, 8 Jun 2023 19:24:05 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B51E30D5; Thu, 8 Jun 2023 16:24:05 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-652dd220d67so1170519b3a.3; Thu, 08 Jun 2023 16:24:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686266644; x=1688858644; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=kjeLkyzQBXDMmpW+mv6gsgImE+Yu4bQUfqrg+TqZuYQ=; b=ibE9O4dYS1ra4OHX4kutCOvMuID0Kg1allAnNGKK7d7R/qu9abP0f7h2svtYDkhnMm bdABXieXA739dpn2o0zTSAI/NcVbO6gashW4K3+EaLqhPjZ7nlPCaa5kYKJoKokOBnBK terliYL8Lw+RoQyGSt6I7CkUnbKfM31IgCkrLXF6TwMYtDDbU1A2yWk0OsDHnSBl1tQo XJnrwA0ubqGIeM3nIL97/sC7E5L0vXSC5wXWXw6QlDkdGc3PqKy+JTdEgOoc/ZdqibjV qfEdUgInntX6zr3dnUHX7YM16yzZmGG/uNYwyaV+0v7HabN+o1lJ50dpgR367Qa2LESD Zg2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686266644; x=1688858644; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=kjeLkyzQBXDMmpW+mv6gsgImE+Yu4bQUfqrg+TqZuYQ=; b=ABVrpVPtxUpHTVgRULyoxpMxJY9hG+215P/TNsxvfqQwczsgxWHUharX7ik2pfQ/VH s55bj0mqKDbKeHI5yhw0Mm8G95sIYNnq3n+6FxNHi9OuYObrVHbi2b56SnCiQkD2cWhn chIT3evKABCWUhIFVXsVH5E3CkP8HQX3zbibbXZKA8nVfqtkL5fVO5w923++IMeVJYnW R76W9yT53E8miOWbNA1sM16lO98e81IyTbRVdsQVMMddmR6a5N6SN3qSw0lN4sS12I2A M4mZ2kIeEAHqxdrGC+eTBVt1Hx84kuBH0y0CFQMQgaSnimuGR0ZoQw/RBwZvae5v+9R1 UfTg== X-Gm-Message-State: AC+VfDwj2PBAWDhit9gAeUCnRl2F+70FGbnpkweJdQ8v4b4uQ5P/5W/s heY2E3apjs1sUdyqraF5mMg= X-Received: by 2002:a05:6a21:7883:b0:10f:be0:4dce with SMTP id bf3-20020a056a21788300b0010f0be04dcemr9864782pzc.8.1686266644383; Thu, 08 Jun 2023 16:24:04 -0700 (PDT) Received: from bangji.hsd1.ca.comcast.net ([2601:647:6700:7f00:c14c:6e39:cb7d:ad66]) by smtp.gmail.com with ESMTPSA id e18-20020a656792000000b0053f1d55676fsm1618203pgr.2.2023.06.08.16.24.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 16:24:04 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ian Rogers , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Stephane Eranian Subject: [PATCH 2/3] perf list: Check arguments to show libpfm4 events Date: Thu, 8 Jun 2023 16:23:59 -0700 Message-ID: <20230608232400.3056312-3-namhyung@kernel.org> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog In-Reply-To: <20230608232400.3056312-1-namhyung@kernel.org> References: <20230608232400.3056312-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Ian Rogers This is particularly useful for tests. $ perf list pfm Signed-off-by: Ian Rogers Signed-off-by: Namhyung Kim --- tools/perf/builtin-list.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index 03b5d26b2489..7fec2cca759f 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c @@ -15,6 +15,7 @@ #include "util/pmu.h" #include "util/debug.h" #include "util/metricgroup.h" +#include "util/pfm.h" #include "util/string2.h" #include "util/strlist.h" #include "util/strbuf.h" @@ -457,7 +458,11 @@ int cmd_list(int argc, const char **argv) OPT_END() }; const char * const list_usage[] = { +#ifdef HAVE_LIBPFM + "perf list [] [hw|sw|cache|tracepoint|pmu|sdt|metric|metricgroup|event_glob|pfm]", +#else "perf list [] [hw|sw|cache|tracepoint|pmu|sdt|metric|metricgroup|event_glob]", +#endif NULL }; @@ -539,7 +544,12 @@ int cmd_list(int argc, const char **argv) default_ps.metricgroups = true; default_ps.metrics = false; metricgroup__print(&print_cb, ps); - } else if ((sep = strchr(argv[i], ':')) != NULL) { + } +#ifdef HAVE_LIBPFM + else if (strcmp(argv[i], "pfm") == 0) + print_libpfm_events(&print_cb, ps); +#endif + else if ((sep = strchr(argv[i], ':')) != NULL) { char *old_pmu_glob = default_ps.pmu_glob; default_ps.event_glob = strdup(argv[i]); -- 2.41.0.162.gfafddb0af9-goog