Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp181378yba; Fri, 5 Apr 2019 04:41:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXtWxQUm+eAhLt4HzS43E8/KdWhc8phC/y35hE6bPSIfBEQsxoaT8VPY2yWKGxy83NEp5q X-Received: by 2002:a17:902:2ec1:: with SMTP id r59mr12482285plb.171.1554464497760; Fri, 05 Apr 2019 04:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554464497; cv=none; d=google.com; s=arc-20160816; b=OM3gCPam5TDsgfHH1CB3l6IxymZ/GvBwmZcFkNB0KvUpY73wS0aM7WFCFv27IAPGZT cEXuiugmpFmErwQ28WZxqhBN1eAjJXNDNC9sLNzlCJMUSXEENBMRpkjf8oV7V8xyCuoY bBI3RO8K0/FdhFcXVVMVHKLSYh6f2VScpbTFVqA+NI2EhvBsg4fC5WfGqchr7rgdRvL+ G/n8KTJ9EbPTxiWv3NuXTqS8T6ylbmvnafNXXTc+yFqmrTITmcEphr1XmySelIGWvAVr 0LQafYl+fqGUYo8+jbiS216Ms0vAKZ7ENKr2o/PHNXNQ+4vMy5X2igGPnfOPKD+v8C6F FImQ== 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; bh=wLUnpzzH0kFzO+voOwOfnbORbMeXNrx0DrdrtIhf4LQ=; b=yS0to+6uohNBoNE2IPJjrYF/H3s7nII0UFrtj5HmyFbTw389mjjACfIRZYnxOfXlW6 yk8k5+vkVSK9FRAWXWiyzm7yadfdXvNb6krs1LXV0cEMyFPpWIWfGhgl4ehm1XoNfezW ALrOAW67jQ2ZFBPDKlWGw+YuPCJoIDc/fv5BZt070ImjfOmBsOZgU/W7Czz7acHK6X8j DCzb3sMieQNku5BQlhYXzoFVljkZyiP0sJeI/eBK4leKgzRmsrFyk9BX/DyalEzWEEt3 SyZXsbCJKZzN+56VawJVd9Ktv7muYDCtdQHEm8m8I8LpS9oJo5N8+nS2dnXhZ3nNS+e7 TBrg== 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 m5si10080496pgc.12.2019.04.05.04.41.22; Fri, 05 Apr 2019 04:41:37 -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 S1730936AbfDELkr (ORCPT + 99 others); Fri, 5 Apr 2019 07:40:47 -0400 Received: from terminus.zytor.com ([198.137.202.136]:38529 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730596AbfDELkq (ORCPT ); Fri, 5 Apr 2019 07:40:46 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x35BecYW2734849 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 5 Apr 2019 04:40:38 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x35BecDf2734846; Fri, 5 Apr 2019 04:40:38 -0700 Date: Fri, 5 Apr 2019 04:40:38 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Andi Kleen Message-ID: Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, acme@redhat.com, jolsa@kernel.org, hpa@zytor.com, tglx@linutronix.de, ak@linux.intel.com Reply-To: hpa@zytor.com, tglx@linutronix.de, ak@linux.intel.com, linux-kernel@vger.kernel.org, mingo@kernel.org, acme@redhat.com, jolsa@kernel.org In-Reply-To: <20190326221823.11518-5-andi@firstfloor.org> References: <20190326221823.11518-5-andi@firstfloor.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf list: Output tool events Git-Commit-ID: 5e0861baa3fa73e8bd861a4b7ba7fa992b1dff82 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 autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: 5e0861baa3fa73e8bd861a4b7ba7fa992b1dff82 Gitweb: https://git.kernel.org/tip/5e0861baa3fa73e8bd861a4b7ba7fa992b1dff82 Author: Andi Kleen AuthorDate: Tue, 26 Mar 2019 15:18:23 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 1 Apr 2019 14:49:25 -0300 perf list: Output tool events Add support in 'perf list' to output tool internal events, currently only 'duration_time'. Committer testing: $ perf list dur* List of pre-defined events (to be used in -e): duration_time [Tool event] Metric Groups: $ perf list sw List of pre-defined events (to be used in -e): alignment-faults [Software event] bpf-output [Software event] context-switches OR cs [Software event] cpu-clock [Software event] cpu-migrations OR migrations [Software event] dummy [Software event] emulation-faults [Software event] major-faults [Software event] minor-faults [Software event] page-faults OR faults [Software event] task-clock [Software event] duration_time [Tool event] $ perf list | grep duration duration_time [Tool event] [L1D miss outstandings duration in cycles] page walk duration are excluded in Skylake] load. EPT page walk duration are excluded in Skylake] page walk duration are excluded in Skylake] store. EPT page walk duration are excluded in Skylake] (instruction fetch) request. EPT page walk duration are excluded in instruction fetch request. EPT page walk duration are excluded in $ Signed-off-by: Andi Kleen Tested-by: Arnaldo Carvalho de Melo Acked-by: Jiri Olsa Link: http://lkml.kernel.org/r/20190326221823.11518-5-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-list.c | 6 ++++-- tools/perf/util/parse-events.c | 20 ++++++++++++++++++++ tools/perf/util/parse-events.h | 1 + 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index a8394b4f1167..e0312a1c4792 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c @@ -70,10 +70,11 @@ int cmd_list(int argc, const char **argv) print_symbol_events(NULL, PERF_TYPE_HARDWARE, event_symbols_hw, PERF_COUNT_HW_MAX, raw_dump); else if (strcmp(argv[i], "sw") == 0 || - strcmp(argv[i], "software") == 0) + strcmp(argv[i], "software") == 0) { print_symbol_events(NULL, PERF_TYPE_SOFTWARE, event_symbols_sw, PERF_COUNT_SW_MAX, raw_dump); - else if (strcmp(argv[i], "cache") == 0 || + print_tool_events(NULL, raw_dump); + } else if (strcmp(argv[i], "cache") == 0 || strcmp(argv[i], "hwcache") == 0) print_hwcache_events(NULL, raw_dump); else if (strcmp(argv[i], "pmu") == 0) @@ -113,6 +114,7 @@ int cmd_list(int argc, const char **argv) event_symbols_hw, PERF_COUNT_HW_MAX, raw_dump); print_symbol_events(s, PERF_TYPE_SOFTWARE, event_symbols_sw, PERF_COUNT_SW_MAX, raw_dump); + print_tool_events(s, raw_dump); print_hwcache_events(s, raw_dump); print_pmu_events(s, raw_dump, !desc_flag, long_desc_flag, diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 98c0fadaedb9..4432bfe039fd 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -2457,6 +2457,25 @@ out_enomem: return evt_num; } +static void print_tool_event(const char *name, const char *event_glob, + bool name_only) +{ + if (event_glob && !strglobmatch(name, event_glob)) + return; + if (name_only) + printf("%s ", name); + else + printf(" %-50s [%s]\n", name, "Tool event"); + +} + +void print_tool_events(const char *event_glob, bool name_only) +{ + print_tool_event("duration_time", event_glob, name_only); + if (pager_in_use()) + printf("\n"); +} + void print_symbol_events(const char *event_glob, unsigned type, struct event_symbol *syms, unsigned max, bool name_only) @@ -2540,6 +2559,7 @@ void print_events(const char *event_glob, bool name_only, bool quiet_flag, print_symbol_events(event_glob, PERF_TYPE_SOFTWARE, event_symbols_sw, PERF_COUNT_SW_MAX, name_only); + print_tool_events(event_glob, name_only); print_hwcache_events(event_glob, name_only); diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 0c1f5b98f636..a052cd6ac63e 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -204,6 +204,7 @@ extern struct event_symbol event_symbols_sw[]; void print_symbol_events(const char *event_glob, unsigned type, struct event_symbol *syms, unsigned max, bool name_only); +void print_tool_events(const char *event_glob, bool name_only); void print_tracepoint_events(const char *subsys_glob, const char *event_glob, bool name_only); int print_hwcache_events(const char *event_glob, bool name_only);