Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933920AbbLPBvC (ORCPT ); Tue, 15 Dec 2015 20:51:02 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:12524 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932880AbbLPBvA (ORCPT ); Tue, 15 Dec 2015 20:51:00 -0500 Message-ID: <5670C360.5030809@huawei.com> Date: Wed, 16 Dec 2015 09:50:24 +0800 From: "Wangnan (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Jiri Olsa CC: , , , , , , "He Kuang" , Alexei Starovoitov , "Arnaldo Carvalho de Melo" , Namhyung Kim Subject: Re: [PATCH v5 08/14] perf tools: Support perf event alias name References: <1450089563-122430-1-git-send-email-wangnan0@huawei.com> <1450089563-122430-9-git-send-email-wangnan0@huawei.com> <20151215131834.GB31734@krava.brq.redhat.com> In-Reply-To: <20151215131834.GB31734@krava.brq.redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.5670C374.0183,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: bdd1109217adab41202415d8c48ccff3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2678 Lines: 75 On 2015/12/15 21:18, Jiri Olsa wrote: > On Mon, Dec 14, 2015 at 10:39:17AM +0000, Wang Nan wrote: >> From: He Kuang >> >> This patch is useful when trying to pass a perf event to BPF map. >> Before this patch we are unable to pass an event with config term to >> BPF maps. For example: >> >> # perf record -a -e cycles/no-inherit,period=0x7fffffffffffffff/ \ >> -e './test_bpf_map_2.c/maps:pmu_map.event=cycles/no-inherit,period=0x7fffffffffffffff//' ls / >> event syntax error: '..ps:pmu_map.event=cycles/' >> \___ Event not found for map setting >> >> Because those '/' and ',' embarrass parser. > we already have 'name=' term, but it's only for pmu events, > so I think your solution is better Thanks. > >> This patch adds new bison rules for specifying an alias name to a perf >> event, which allows cmdline refer to previous defined perf event through >> its name. With this patch user can give alias name to a perf event using >> following cmdline. The above goal can be achieved using: >> >> # perf record -a -e cyc=cycles/no-inherit,period=0x7fffffffffffffff/ \ >> -e './test_bpf_map_2.c/maps:pmu_map.event=cyc/' ls / >> > so this alias should only help as a quick pointer > to setup the record session, right? Yes. > I'm not sure we want to see it as a part of name being stored > to perf.data and displayed by perf report and stat > > $ ./perf stat -e cyc=cycles ls > > Performance counter stats for 'ls': > > 2,638,646 cyc=cycles > > 0.001111614 seconds time elapsed > > but I guess when you probably have a reason to use that > you want to see it in your report.. just a thought ;-) I thought about this problem. It seems useful. In following patches we will support BPF output. Thinking about this case: # perf record -a -i -e a=bpf-output -e b=bpf-output \ -e mybpf.c/dataA=a,dataB=b/ ... Here we pass two bpf-output events to the BPF script, they have different meaning. For example, 'a' reports instructions costed by one function, 'b' reports time between two events. We use CTF python binding to deal with this report. Then aliases is a indicator to tell us which event is for what. Without them we have to put some magic number in output data. Thank you. > anyway acking the change > > Acked-by: Jiri Olsa > > thanks, > jirka -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/