From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757576AbcBCXgB (ORCPT ); Wed, 3 Feb 2016 18:36:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36672 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757486AbcBCXf6 (ORCPT ); Wed, 3 Feb 2016 18:35:58 -0500 Date: Wed, 3 Feb 2016 21:35:55 -0200 From: Arnaldo Carvalho de Melo To: Wang Nan , Jiri Olsa Cc: Alexei Starovoitov , Brendan Gregg , Daniel Borkmann , "David S. Miller" , He Kuang , Jiri Olsa , Li Zefan , Masami Hiramatsu , Namhyung Kim , Peter Zijlstra , pi3orama@163.com, Will Deacon , linux-kernel@vger.kernel.org Subject: Re: [PATCH 13/54] perf tools: Support perf event alias name Message-ID: <20160203233555.GC12194@redhat.com> References: <1453715801-7732-1-git-send-email-wangnan0@huawei.com> <1453715801-7732-14-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1453715801-7732-14-git-send-email-wangnan0@huawei.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.20 (2009-12-10) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Jan 25, 2016 at 09:56:00AM +0000, Wang Nan escreveu: > 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. > > 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 / In another thread Jiri suggested this as a way to get an alias associated with some event: ----------------------------------------------------------------- On Tue, Feb 02, 2016 at 05:24:16PM +0100, Andreas Hollmann wrote: > Jiri, how do you handle raw counters with this python stat__* > callback? What is the name of the callback? you can use 'name' term like: perf stat -e cycles,"cpu/config=0x6530160,name=krava/" and use following callback in your script: def stat__krava(cpu, thread, time, val, ena, run): ----------------------------------------------------------------- Can't we go with that existing syntax? Jiri? That would be: # perf record -a -e cycles/no-inherit,period=0x7fffffffffffffff,name=cyc/ \ -e './test_bpf_map_2.c/maps:pmu_map.event=cyc/' ls / Your way is shorter, but we already have this name=foo method :-\ - Arnaldo