Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp11992449rwd; Thu, 22 Jun 2023 23:12:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4FaHTRFis+l0S7V3YMgjaY2wvX29pxfKdN/DdH4d578ChuCiBX/u5e9+I+4AXwtMVt2koQ X-Received: by 2002:a17:90a:760c:b0:25b:d67c:6a9e with SMTP id s12-20020a17090a760c00b0025bd67c6a9emr13737899pjk.16.1687500755781; Thu, 22 Jun 2023 23:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687500755; cv=none; d=google.com; s=arc-20160816; b=A7YVPu0yPIe053LK8ceEnUdKgZFuU5MkOU0XVnuAm4v97VsFEkEB8ybDxv7w1zLy3A WBbtvCrH8tIWUIkBNF4jyJssgZ3+gPfKpeQthMYPXLHZXSIZc9Wa33k8g8b+yDz8kC76 guYvY6OSqlsJokdsCf964Aw+CvjkOj/oWQyjJXhHap1W3wccuJByOBmoP3zqfUnbaquj 6GzE27YudpMtVMF8jFRcUutsAgZTEN/SMARMib5vYXDuNAkmSRWyGTUkyCQmwuKeKg7X L+TCYA7waiN1s/Mo0+UwHy7j5kJS+UR1okY75XAIG+FNSjWWExJF92OEeBRDGQXXQac+ F4bg== 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 :message-id:date:subject:cc:to:from; bh=wLI92dtZBC+AZg7mleag/n6fRvL/KR6YRr2lddO8eyI=; b=dgsbDG7x8T7G2NVPoyy9QBSMkpAB4QrkXGIXkkr8aW1x51YO+HRCnNjZSXfgqdS/Vy uJnfWheHZReL55ud8P5OqFMiL2SZdQyV2N/fihnQJ+CX9Ie7u001+KF7fKDe5Sl8iPN9 M3Hho9ooph9e4NL05eBNzseJoKk0CwUWXQpzhRY/kBMT/HiZWgg8NsAnhzz6A8GTc865 YnrZ70IYB64asG68cN0XaykbRkO+2u1AbPF5XpkFd1AYrP1dStIvRkdl7OdFrEnyATbf bjp3W+Q/Ju33U2dAo4xmfV29QA63y1bzzL3Anw+MjuKLbDQpCvJ3Nb3fRGdeL2KKnEF2 RWpw== 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020a63b046000000b00553c50a74bcsi2849239pgo.200.2023.06.22.23.12.20; Thu, 22 Jun 2023 23:12:35 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231627AbjFWFrV (ORCPT + 99 others); Fri, 23 Jun 2023 01:47:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231181AbjFWFqz (ORCPT ); Fri, 23 Jun 2023 01:46:55 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C23B326B9; Thu, 22 Jun 2023 22:46:17 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QnR4m6ppRzLmsp; Fri, 23 Jun 2023 13:44:08 +0800 (CST) Received: from localhost.localdomain (10.67.174.95) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 23 Jun 2023 13:46:08 +0800 From: Yang Jihong To: , , , , , , , , , , , , CC: Subject: [PATCH v5 0/4] perf tools: Add printing perf_event_attr `config` and `id` symbol in perf_event_attr__fprintf() Date: Fri, 23 Jun 2023 05:44:12 +0000 Message-ID: <20230623054416.160858-1-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.95] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Add printing perf_event_attr `config` and `id` symbol to improve the readability of debugging information. Before: # perf --debug verbose=2 record -e cycles,cpu-clock,sched:sched_switch,branch-load-misses,r101,mem:0x0 -C 0 true ------------------------------------------------------------ perf_event_attr: size 136 { sample_period, sample_freq } 4000 sample_type IP|TID|TIME|CPU|PERIOD|IDENTIFIER read_format ID disabled 1 inherit 1 freq 1 sample_id_all 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 5 ------------------------------------------------------------ perf_event_attr: type 1 size 136 { sample_period, sample_freq } 4000 sample_type IP|TID|TIME|CPU|PERIOD|IDENTIFIER read_format ID disabled 1 inherit 1 freq 1 sample_id_all 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 6 ------------------------------------------------------------ perf_event_attr: type 2 size 136 config 0x143 { sample_period, sample_freq } 1 sample_type IP|TID|TIME|CPU|PERIOD|RAW|IDENTIFIER read_format ID disabled 1 inherit 1 sample_id_all 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 7 ------------------------------------------------------------ perf_event_attr: type 3 size 136 config 0x10005 { sample_period, sample_freq } 4000 sample_type IP|TID|TIME|CPU|PERIOD|IDENTIFIER read_format ID disabled 1 inherit 1 freq 1 sample_id_all 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 9 ------------------------------------------------------------ perf_event_attr: type 4 size 136 config 0x101 { sample_period, sample_freq } 4000 sample_type IP|TID|TIME|CPU|PERIOD|IDENTIFIER read_format ID disabled 1 inherit 1 freq 1 sample_id_all 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 10 ------------------------------------------------------------ perf_event_attr: type 5 size 136 { sample_period, sample_freq } 1 sample_type IP|TID|TIME|CPU|IDENTIFIER read_format ID disabled 1 inherit 1 sample_id_all 1 exclude_guest 1 bp_type 3 { bp_len, config2 } 0x4 ------------------------------------------------------------ After: # perf --debug verbose=2 record -e cycles,cpu-clock,sched:sched_switch,branch-load-misses,r101,mem:0x0 -C 0 true ------------------------------------------------------------ perf_event_attr: type 0 (PERF_TYPE_HARDWARE) size 136 config 0 (PERF_COUNT_HW_CPU_CYCLES) { sample_period, sample_freq } 4000 sample_type IP|TID|TIME|CPU|PERIOD|IDENTIFIER read_format ID disabled 1 inherit 1 freq 1 sample_id_all 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 5 ------------------------------------------------------------ perf_event_attr: type 1 (PERF_TYPE_SOFTWARE) size 136 config 0 (PERF_COUNT_SW_CPU_CLOCK) { sample_period, sample_freq } 4000 sample_type IP|TID|TIME|CPU|PERIOD|IDENTIFIER read_format ID disabled 1 inherit 1 freq 1 sample_id_all 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 6 ------------------------------------------------------------ perf_event_attr: type 2 (PERF_TYPE_TRACEPOINT) size 136 config 0x143 (sched:sched_switch) { sample_period, sample_freq } 1 sample_type IP|TID|TIME|CPU|PERIOD|RAW|IDENTIFIER read_format ID disabled 1 inherit 1 sample_id_all 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 7 ------------------------------------------------------------ perf_event_attr: type 3 (PERF_TYPE_HW_CACHE) size 136 config 0x10005 (PERF_COUNT_HW_CACHE_RESULT_MISS | PERF_COUNT_HW_CACHE_OP_READ | PERF_COUNT_HW_CACHE_BPU) { sample_period, sample_freq } 4000 sample_type IP|TID|TIME|CPU|PERIOD|IDENTIFIER read_format ID disabled 1 inherit 1 freq 1 sample_id_all 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 9 ------------------------------------------------------------ perf_event_attr: type 4 (PERF_TYPE_RAW) size 136 config 0x101 { sample_period, sample_freq } 4000 sample_type IP|TID|TIME|CPU|PERIOD|IDENTIFIER read_format ID disabled 1 inherit 1 freq 1 sample_id_all 1 exclude_guest 1 ------------------------------------------------------------ sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 10 ------------------------------------------------------------ perf_event_attr: type 5 (PERF_TYPE_BREAKPOINT) size 136 config 0 { sample_period, sample_freq } 1 sample_type IP|TID|TIME|CPU|IDENTIFIER read_format ID disabled 1 inherit 1 sample_id_all 1 exclude_guest 1 bp_type 3 { bp_len, config2 } 0x4 ------------------------------------------------------------ sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 11 ------------------------------------------------------------ perf_event_attr: type 1 (PERF_TYPE_SOFTWARE) size 136 config 0x9 (PERF_COUNT_SW_DUMMY) { sample_period, sample_freq } 4000 sample_type IP|TID|TIME|CPU|PERIOD|IDENTIFIER read_format ID inherit 1 mmap 1 comm 1 freq 1 task 1 sample_id_all 1 mmap2 1 comm_exec 1 ksymbol 1 bpf_event 1 ------------------------------------------------------------ sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 12 Yang Jihong (4): perf trace-event-info: Add tracepoint_id_to_name() helper perf tools: Extend PRINT_ATTRf to support printing of members with a value of 0 perf tools: Add printing perf_event_attr type symbol in perf_event_attr__fprintf() perf tools: Add printing perf_event_attr config symbol in perf_event_attr__fprintf() tools/perf/util/perf_event_attr_fprintf.c | 186 ++++++++++++++++++++-- tools/perf/util/trace-event-info.c | 12 ++ tools/perf/util/trace-event.h | 6 + 3 files changed, 195 insertions(+), 9 deletions(-) -- Changes since v4_resend: - Format patches based on the perf-tools-next. - Add put_tracepoints_path() before return for tracepoint_id_to_name() in patch1. Changes since v4: - Add acked-by Adrian Hunter. Changes since v3: - Change print_id() helper to a macro function to support printing of both hex and unsigned formats. Changes since v2: - Adjusting the order of local declarations in tracepoint_id_to_name() - Remove unnecessary parentheses and "!= NULL" in tracepoint_id_to_name() - Remove unnecessary comment of synchronizing with perf_event.h - Add print_id helper() - Remove "#ifdef HAVE_LIBTRACEEVENT" put around "#include "trace-event.h" - Remove comment of "// for free" for "#include " Changes since v1: - Modify initialization of path in tracepoint_id_to_path(). - Replace snprintf&strdup with asprintf. - Use switch/case to get stringified name for type and id. 2.30.GIT