From patchwork Mon Nov 14 18:12:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 1619 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2291665wru; Mon, 14 Nov 2022 10:18:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf7zApQhtjcerkpweHuDer43d788MzsXkpK0qCDRu/YLTRI6r1c3Tn2fKcynOYl1b06B/Ygg X-Received: by 2002:a05:6402:5511:b0:468:dc9:ec08 with SMTP id fi17-20020a056402551100b004680dc9ec08mr2444312edb.17.1668449918595; Mon, 14 Nov 2022 10:18:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668449918; cv=none; d=google.com; s=arc-20160816; b=rfRnzSgxVAUwy9o0+Fv6SKfzPDp7XQV+rS7JfldvPuMFDPDZwRKI9Azyjh4xM3igIl swLTjtOFpJ/plpS4KlQu5rbihe5dAif2OksufHpzkCL/sZC2QC1eBUwRq6D2cSffguxd VnmxUN7TXUFppGu5L0oc/qc6a9V7WFfAbiX5bIZympNIRjUnPIS0RvszxmiWujOePOsc 1/Ze6CalHhPga6ZoXWjw7LlsTTOweMeylQEPHHkverAgM3p5YfP13R5sLd25cnov2KiL SAcNDYXb8CJw/cwkWpTZsz2lwQYWSoOGZSYJEZoNVEsERIEf24ClVPUTmhycpZl0/usQ F3aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=lOO9C7JbCmkD1UBVZhc67PcVihTD9v0alGeZxPKLO3A=; b=x7vWSqKbQIm6zPzZe9wM4zGOjv5F0+Al5QQciaKppe4T9G+y5UokFBkrKlwpyLpRfE Jlr8+VEVLuTh2RsjfExWi/xWbu4h4zW2WihTOSMQtUz5puWs8vitpIEuWyVH1ynM5ei3 8eTx24R0woAfqhR+gyJp3s5Zd9PxfmzUvVCTSU/+uFdde9HILbevzqpIGj9eeyjV+ZD5 Ilo0E2sSt7SFymhKoWi4Joj4dbv4iIZEvQYkVgM4tVr4HzC1NfVQucTKUZM2IqBr30Aw ehr7JSYPEs8ZDBVjsYfT/TDmXQ7N/GpTFBSxgfRsfZKkU2W7cmpeOu6WePCTJazxrDYz OlgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="ibO/iIFT"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz16-20020a0564021d5000b0045caa1628c6si3869840edb.216.2022.11.14.10.18.13; Mon, 14 Nov 2022 10:18:38 -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; dkim=pass header.i=@google.com header.s=20210112 header.b="ibO/iIFT"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238362AbiKNSNe (ORCPT + 99 others); Mon, 14 Nov 2022 13:13:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238267AbiKNSNJ (ORCPT ); Mon, 14 Nov 2022 13:13:09 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95FD627CFA for ; Mon, 14 Nov 2022 10:13:08 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id t37-20020a252d25000000b006dcab0e0650so11190752ybt.23 for ; Mon, 14 Nov 2022 10:13:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=lOO9C7JbCmkD1UBVZhc67PcVihTD9v0alGeZxPKLO3A=; b=ibO/iIFTGjanA6GA/lOfrzAyxKO5GHieanh/jSZ55L5rgRPKAMtZe+9I8Y4RNoGDzI BH2oC+kglLsPL0SVwn+DeGgXC5ZoXlPWF11knUMhKtbaBxb4Vfc71PfWtnWIlaItAjbW mgXc0QUs4wxKbH0p/H6M/EuEBWJOXHMQVgawwVFFwMIZhdNBLemxDnlhX6fiNPd8Ed2f ADaaWJdNuLyXXwxdG49DaescQXLpbsulN0CD85jLEdh2jhImq9Kz+XE07sgDhrWRw1MM gWdyPPYpPG5TML6dQCUL+er6xNDPM1fpCtIQMgxNyMKpk/oyFCRTgPo15SIOIJ6RNxsS S8TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=lOO9C7JbCmkD1UBVZhc67PcVihTD9v0alGeZxPKLO3A=; b=idT1cntFyG6gM4O4OO9+ird+SpfWmpxvgJY0SCE50aErZ/OAL3DOgHg1Y+SFfI2qdS W7xtTif8xJjuG5yjVFW2PiTledpWJQKMfM3ZR4WtE0T0yqhhy6GrwppEm2xZGvpXPGBZ 0uU52Ge59LFoVjo1qAPjqLLuT2uriJMVUfGkJVbDtVmJ4JqJvYDnhjIOiXaAuJkc7yKz Ftxg2VyIXti0pmgW3an+4iwAXm8UtmwqAeEjejQwIS63JRf0aLgjrwIv61jt2pPuIFAT lvLL9VOeSGRvBO76eldGZ82ycQxbKAnhcWmb88XDx9DI/QKh9ySJmMZFpVlBEYXvca0u V3Cw== X-Gm-Message-State: ANoB5pmz+WSG53JwxUaq3tgRPoQ9Ar3XGJrT3HYSWEUvQPffNTxAI3No O39BEKySGv7wotlJzi5rIktXW70rPhEq X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:553:438f:b86a:87f]) (user=irogers job=sendgmr) by 2002:a05:6902:18a:b0:6e0:4bb5:b391 with SMTP id t10-20020a056902018a00b006e04bb5b391mr0ybh.533.1668449587340; Mon, 14 Nov 2022 10:13:07 -0800 (PST) Date: Mon, 14 Nov 2022 10:12:42 -0800 Message-Id: <20221114181251.2683871-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Subject: [PATCH v2 0/9] Restructure perf list and add json output From: Ian Rogers To: Weilin Wang , Perry Taylor , Caleb Biggers , Leo Yan , Adrian Hunter , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Sandipan Das , Kajol Jain , Zhengjun Xing , Kan Liang , Ravi Bangoria , Xin Gao , Rob Herring , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Stephane Eranian , Ian Rogers X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749457516497457549?= X-GMAIL-MSGID: =?utf-8?q?1749496541964279378?= Restructure perf list so that it uses callbacks to print events and metrics. Use the callbacks to implement json output. In the process add documentation to pmu.h, avoid some sorting of events, fix some command line and output bugs. v2. Address feedback from Adrian Hunter and make kerneldoc work. Ian Rogers (9): perf pmu: Add documentation tools lib api fs tracing_path: Add scandir alphasort perf tracepoint: Sort events in iterator perf list: Generalize limiting to a PMU name perf list: Simplify cache event printing perf list: Simplify symbol event printing perf pmu: Restructure print_pmu_events perf list: Reorganize to use callbacks perf list: Add json output option tools/lib/api/fs/tracing_path.c | 16 + tools/lib/api/fs/tracing_path.h | 1 + tools/perf/Documentation/perf-list.txt | 10 +- tools/perf/builtin-list.c | 503 +++++++++++++++++--- tools/perf/util/metricgroup.c | 238 +++------- tools/perf/util/metricgroup.h | 4 +- tools/perf/util/pmu.c | 279 +++++------ tools/perf/util/pmu.h | 128 ++++- tools/perf/util/print-events.c | 630 ++++++++++--------------- tools/perf/util/print-events.h | 40 +- 10 files changed, 1054 insertions(+), 795 deletions(-)