Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1558329imm; Wed, 13 Jun 2018 23:27:33 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKOxuJ/WnoGQs9I+tsfVBNhSSFcbkNIzgwhOqBirLLV1PnSy1jh1KeA3CBsRtq4uD5l7Hj0 X-Received: by 2002:a17:902:b706:: with SMTP id d6-v6mr1522784pls.105.1528957653781; Wed, 13 Jun 2018 23:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528957653; cv=none; d=google.com; s=arc-20160816; b=zVZ6ZvJJ4RCbxK7nFaFDTCHjek5ZkvMCmtcG+3PuJ4yFJUSAPULkvJr2t2s90CTweE 5valuwxsbkVvKohQTxkWVLZOHAbB1+4yVZRpvIYsNSgdC6NDWolelRH9GP0o9h7Ci2YZ /br/2UuRMAtvnUl+TOHd8EntTsbMXsF3dsacn//OB88VnIaCsxVduMZXg4jkjPvZCWEK O18iYZZoF3lZJ2/ljliLbosjtHBGZ0L1hmt4c+C+ijGRN8qNPdM5dKz47in7kStBxxcY 00c2czJvG/P12gWrCqY2n2P9O6FcR7phVpaD0SsLZkAuSBOJgo0agfrtGs7uvkDoGBB1 jpzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=Rbm0owzC+XpVgeZNSc+EQ1iiF3ufjFjcO0RY/8KK4qk=; b=J0bPsPjgKZWGtyEoiWfc8gb0C/gpe7ZgUytAwndln/Spkq71KG2BuIJFNuTL5zWh1A v6bxarSMXTx/OmO3kVQ3wsIpvp7W/hYx6PmfG+v9o4tqg+G+MBKNh5REAvnYBRQM+GKx nxXSgUT4h6wgp9cXcazxP7FVEV+XQlJrKoCmBvTIR+ooUdAU8TC2BKcGdZyDFYzwrsAb MCcgidmYsbLECbvc6nHQxdJfNW7z4lJBdB3sQnbvjKz/JHQGm439uEXLpE6kWclkdObK K5NoO5WsLgzyiNatMTLgLLyy9Ou+ZLLAUrmu40dWPCtKYxECSqp3qaoB3EU67JXfYd6W vAVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m13-v6si3741437pgv.271.2018.06.13.23.27.19; Wed, 13 Jun 2018 23:27:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754603AbeFNGZW (ORCPT + 99 others); Thu, 14 Jun 2018 02:25:22 -0400 Received: from terminus.zytor.com ([198.137.202.136]:48907 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752671AbeFNGZV (ORCPT ); Thu, 14 Jun 2018 02:25:21 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w5E6OswF765488 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 13 Jun 2018 23:24:54 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w5E6OsN6765485; Wed, 13 Jun 2018 23:24:54 -0700 Date: Wed, 13 Jun 2018 23:24:54 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Seeteena Thoufeek Message-ID: Cc: hpa@zytor.com, peterz@infradead.org, namhyung@kernel.org, tglx@linutronix.de, mingo@kernel.org, jolsa@redhat.com, linux-kernel@vger.kernel.org, s1seetee@linux.vnet.ibm.com, alexander.shishkin@linux.intel.com, acme@redhat.com Reply-To: linux-kernel@vger.kernel.org, s1seetee@linux.vnet.ibm.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, acme@redhat.com, hpa@zytor.com, tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org, namhyung@kernel.org In-Reply-To: <1528455748-20087-1-git-send-email-s1seetee@linux.vnet.ibm.com> References: <1528455748-20087-1-git-send-email-s1seetee@linux.vnet.ibm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf script: Show hw-cache events Git-Commit-ID: fad76d4333fe73cf3f73704aa34d4ce523b1c458 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: fad76d4333fe73cf3f73704aa34d4ce523b1c458 Gitweb: https://git.kernel.org/tip/fad76d4333fe73cf3f73704aa34d4ce523b1c458 Author: Seeteena Thoufeek AuthorDate: Fri, 8 Jun 2018 16:32:28 +0530 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 8 Jun 2018 13:41:30 -0300 perf script: Show hw-cache events 'perf script' fails to report hardware cache events (PERF_TYPE_HW_CACHE) where as 'perf report' shows the samples. Fix it. Ex, # perf record -e L1-dcache-loads ./a.out [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.008 MB perf.data (11 samples)] Before patch: # perf script | wc -l 0 After patch: # perf script | wc -l 11 Committer testing: [root@jouet ~]# perf script | head -30 | tail Timer 9803 [2] 8.963330: 1554 L1-dcache-loads: 7ffef89baae4 __vdso_clock_gettime+0xf4 ([vdso]) swapper 0 [2] 8.963343: 5626 L1-dcache-loads: ffffffffa66f4f6b cpuidle_not_av+0xb (/lib/modules/4.17.0-rc5/build/vmlinux) firefox 4853 [2] 8.964070: 18935 L1-dcache-loads: 7f0b9a00dc30 xcb_poll_for_event+0x0 (/usr/lib64/libxcb.so.1.1.0) Softwar~cTh 4928 [2] 8.964548: 15928 L1-dcache-loads: ffffffffa60d795c update_curr+0x10c (/lib/modules/4.17.0-rc5/build/vmlinux) firefox 4853 [2] 8.964675: 14978 L1-dcache-loads: ffffffffa6897018 mutex_unlock+0x18 (/lib/modules/4.17.0-rc5/build/vmlinux) gnome-shell 2026 [3] 8.964693: 50670 L1-dcache-loads: 7fa08854de6d g_source_iter_next+0x6d (/usr/lib64/libglib-2.0.so.0.5400.3) Compositor 4929 [1] 8.964784: 71772 L1-dcache-loads: 7f0b936bf078 [unknown] (/usr/lib64/firefox/libxul.so) Xwayland 2096 [2] 8.964919: 16799 L1-dcache-loads: 7f68ce2fcb8a glXGetCurrentContext+0x1a (/usr/lib64/libGLX.so.0.0.0) gnome-shell 2026 [3] 8.964997: 50670 L1-dcache-loads: 7fa08854de6d g_source_iter_next+0x6d (/usr/lib64/libglib-2.0.so.0.5400.3) [root@jouet ~]# Signed-off-by: Seeteena Thoufeek Tested-by: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1528455748-20087-1-git-send-email-s1seetee@linux.vnet.ibm.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-script.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index b3bf35512d21..a31d7082188e 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -180,6 +180,18 @@ static struct { PERF_OUTPUT_EVNAME | PERF_OUTPUT_TRACE }, + [PERF_TYPE_HW_CACHE] = { + .user_set = false, + + .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | + PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | + PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | + PERF_OUTPUT_SYM | PERF_OUTPUT_SYMOFFSET | + PERF_OUTPUT_DSO | PERF_OUTPUT_PERIOD, + + .invalid_fields = PERF_OUTPUT_TRACE | PERF_OUTPUT_BPF_OUTPUT, + }, + [PERF_TYPE_RAW] = { .user_set = false,