From patchwork Mon Nov 14 07:51:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 1590 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2021645wru; Sun, 13 Nov 2022 23:58:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf4NjD77QfNtEFHwwosaamlHsgbJ2dnV/vThBBZdn86irFpufVqps9OR+k23Eyt/wHRNum7o X-Received: by 2002:a17:90a:3d4b:b0:213:d08f:a483 with SMTP id o11-20020a17090a3d4b00b00213d08fa483mr12568673pjf.21.1668412700905; Sun, 13 Nov 2022 23:58:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668412700; cv=none; d=google.com; s=arc-20160816; b=w7E8GhnWIe5dXawTkY1xCJim3E7ranSMMRn9+U4dp4XujIdoHjsPwwwYllny/P+S21 4jaoxaY1N1XyuEVWxZtTHqgLc+j12wrc6+f34jlJVhD64ZQlhKOjgevyPuq3nzGI0MqY Tl8tR1oymdfTYyCL6foYXvgtWzi9xB+mmLQF1XVzZHJA6DZTO98jkZt8nhV58meFx/45 6/jagvORXCNKImHOWikDCW0/4qq/Jww+6CvWEHkNGgCcbmu9VKcR6YylwTZ9lD/6U9F1 VQzHPLtNI5A+vWRNRJTAtsV3cfcTj0hefxro6fh/UPtwZcSshQ8NJS8N9L460LmGX8My YR3w== 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=G6SAmxX7apXJc1sZ6rk+vGVz5JqMggUrClmeEtAw6v8=; b=EQUn5aP2QZuj8m8965HpaRDmlBu9+03TWSC8hpEio6lMFCjTqhmGMGii9YnbRZpE+0 0FlejtM8jOHnhzCC08DtAv3Rg/jcSBgrKAuCjol/TvU/zmlH4brNvmSCjUv0F2U11I2o XfXijN09THsqvRcRVNJuIB0LnNzWr1fAt0jTLF5TLwIilf3Xfv7Ht22dMY7eh6yNF15F 7okKq5BMMfm6p+cPDV4TEGzZiEn9uCstZQr7uzJnV9kyIKsbpuRwvXWrTexE6R9UIRrT ChBisC0MCMpFpuJ9EtX97osSQjbRdcKR5U57Ofu/QFLqGj0JkLR0ud1lMIqYfZAMG0Kt gd7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=bQwfvaqn; 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 v69-20020a638948000000b0046ecd36adbasi8505839pgd.635.2022.11.13.23.58.07; Sun, 13 Nov 2022 23: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; dkim=pass header.i=@google.com header.s=20210112 header.b=bQwfvaqn; 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 S236060AbiKNHvr (ORCPT + 99 others); Mon, 14 Nov 2022 02:51:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236042AbiKNHvn (ORCPT ); Mon, 14 Nov 2022 02:51:43 -0500 Received: from mail-pj1-x1049.google.com (mail-pj1-x1049.google.com [IPv6:2607:f8b0:4864:20::1049]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34C3718E1C for ; Sun, 13 Nov 2022 23:51:43 -0800 (PST) Received: by mail-pj1-x1049.google.com with SMTP id 36-20020a17090a0fa700b00213d5296e13so5407701pjz.6 for ; Sun, 13 Nov 2022 23:51:43 -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=G6SAmxX7apXJc1sZ6rk+vGVz5JqMggUrClmeEtAw6v8=; b=bQwfvaqnGgw3iau0Mqw9WIaSEQ3ScV4gxhh1hWdcHbvItifG7Lgv4sbWAj9/Nvv4hx O/BTIUqD6HoaIQqaPYVVgL2NwGzTO8oNGQNSQxroakZnguud1K7UqJC/QbXwLUH6U5Cy O/0y4jVcpZHLW9fpNt7kx5BpZuOl1Ne1BLvJIvFHI6lUDgWcS2NTrUympRPdB40vmzA8 4c1VRCNc2W6oAwMAo2DtDDy+diH0NqDkRe7UUo//EVafVgJCZfjprVhdeopeU23gTCxS CFFIoHiXogb+9ZvcHksfSuamruT3nJTlM9g8P8PLWMD59AzMAOBQZxmeS6Pc/5ACjFpb ADKw== 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=G6SAmxX7apXJc1sZ6rk+vGVz5JqMggUrClmeEtAw6v8=; b=b4ZICZOgxhBc2dsS0U72Z4xX6k94GpEZM+tfUiPv68WmNvaDAb3QgzpooWxwGMPBe1 PwSsUbLs1Sd9GAZ4idiDJTvf8BGtiU2aZUzz0LUUfrW04jdXohFOvNdD8kHCrRfD5QEP lQSD2Z5lnAWuJijLmXR/jjdJW576EM7GGKlxaLY5W5EKsLwxi/vcoMutXo/CVlOYd0n3 /pvCymla0GlYLaPedqGYZP26u9UqUWhsI2ghM4eT/q+ZY0BON8TTmFLcg8eRRb3XX3W4 R1EXe1ZUqRCZeT3KpB2XueaVq/H1mrMqBWvwaRt5c62J7QmSaxKTWeSHUxKk5famwg3A nCKQ== X-Gm-Message-State: ANoB5pnhvZ1h5JXpB+HSVGFtDdwEWZ3015xP6OyfbD+FRN8SKiin/tb/ 8IGruZ3xEOrBZMT7Vu79K9RvK0xY8KUp X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:cba6:8279:98e6:3d6e]) (user=irogers job=sendgmr) by 2002:a17:902:f80a:b0:186:8376:209f with SMTP id ix10-20020a170902f80a00b001868376209fmr12625608plb.161.1668412302667; Sun, 13 Nov 2022 23:51:42 -0800 (PST) Date: Sun, 13 Nov 2022 23:51:18 -0800 Message-Id: <20221114075127.2650315-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Subject: [PATCH v1 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?1749457516497457549?= 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. 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 | 277 +++++------ tools/perf/util/pmu.h | 110 ++++- tools/perf/util/print-events.c | 630 ++++++++++--------------- tools/perf/util/print-events.h | 40 +- 10 files changed, 1034 insertions(+), 795 deletions(-)