Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1253541

Re: [PATCH 26/31] perf tools: Support perf event alias name

From "Wangnan (F)" <wangnan0@huawei.com>
Newsgroups linux.kernel
Subject Re: [PATCH 26/31] perf tools: Support perf event alias name
Date 2015-10-22 09:40 +0200
Message-ID <qmiDE-3XH-9@gated-at.bofh.it> (permalink)
References <qjtFf-7cv-3@gated-at.bofh.it> <qjtOX-7od-25@gated-at.bofh.it> <qlXpx-6nw-31@gated-at.bofh.it> <qm1jr-3S5-11@gated-at.bofh.it> <qmiki-3B6-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 2015/10/22 15:16, Namhyung Kim wrote:
> Hi,
>
> On Wed, Oct 21, 2015 at 10:00 PM, Wangnan (F) <wangnan0@huawei.com> wrote:
>>
>> On 2015/10/21 16:53, Namhyung Kim wrote:
>>> Hi,
>>>
>>> On Wed, Oct 14, 2015 at 12:41:37PM +0000, Wang Nan wrote:
>>>> From: He Kuang <hekuang@huawei.com>
>>>>
>>>> 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:
>>>>
>>>>    # perf record -e mypmu=cycles ...
>>>>
>>>> To allow parser refer to existing event selecter, pass event list to
>>>> 'struct parse_events_evlist'. perf_evlist__find_evsel_by_alias() is
>>>> introduced to get evsel through its alias.
>>> What about using event name directly?  I guess the alias name is used
>>> only to refer an event so it'd be better to use the event name.
>>> Anyway we need alias as well when event has no name or name is complex.
>>
>> It is possible to trigger two perf events with same PMU but
>> different config options:
>>
>>   # perf record -e cycles/period=9999/ -e cycles/period=99999/ -a sleep 1
>>
>> In this case the name of events are:
>>
>> cycles/period=9999/ `
>> cycles/period=99999/
>>
>> Using it in perf cmdline is painful:
>>
>>   # perf record -e cycles/period=9999/ -e cycles/period=99999/ -e
>> bpf_program.c/myevent=cycles/period=9999//...
> I understand the need of using aliases but I think it's more natural
> to use event name for simple cases..

I will consider this. However, if we allow using event name directly 
like this:

  # perf record -e cycles -e test_pmu.c/myevent=cycles/ ...

Then two '-e' seems redundant, right? Why not directly using:

  # perf record -e test_pmu.c/myevent=cycles/ ...

and make perf creates cycles event for test_pmu.c?

We can make syntax like

  # perf record -e test_pmu.c/myevent=cycles/ ...

as a syntax sugar of

  # perf record -e randomname=cycles -e test_pmu.c/myevent=randomname/ ...

and don't need to find evsel through their names if alias not exist.

So this is a new feature, and worth another patch.

Thought?

> Thanks,
> Namhyung


--
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/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 26/31] perf tools: Support perf event alias name Namhyung Kim <namhyung@kernel.org> - 2015-10-21 11:00 +0200
  Re: [PATCH 26/31] perf tools: Support perf event alias name "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-21 15:10 +0200
    Re: [PATCH 26/31] perf tools: Support perf event alias name Namhyung Kim <namhyung@kernel.org> - 2015-10-22 09:20 +0200
      Re: [PATCH 26/31] perf tools: Support perf event alias name "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-22 09:40 +0200
        Re: [PATCH 26/31] perf tools: Support perf event alias name Namhyung Kim <namhyung@kernel.org> - 2015-10-22 10:00 +0200
          Re: [PATCH 26/31] perf tools: Support perf event alias name "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-22 10:10 +0200

csiph-web