linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [RFE] perf probe: Support globbing/regex in -a
Date: Wed, 8 Apr 2015 16:48:26 -0300	[thread overview]
Message-ID: <20150408194826.GI5403@kernel.org> (raw)

Hi Masami,

	In tools/perf constructors are named <CLASS>__new, and right now I want
to know hoe many of each <CLASS> objects are being allocated, so I expected to
be able to do:

[root@zoo ~]# perf probe -x ~/bin/perf -a "*__new"
Probe point '*__new' not found.
  Error: Failed to add events.
[root@zoo ~]#

And get the same result that I get from:

[root@zoo ~]# perf probe -x ~/bin/perf `perf probe -x ~/bin/perf -F | grep __new | sed 's/^/-a /g' | sort -u`
Added new event:
  probe_perf:call_path__new (on call_path__new in /home/acme/bin/perf)

You can now use it in all perf tools, such as:

	perf record -e probe_perf:call_path__new -aR sleep 1

Added new event:
  probe_perf:call_path_root__new (on call_path_root__new in /home/acme/bin/perf)

You can now use it in all perf tools, such as:

	perf record -e probe_perf:call_path_root__new -aR sleep 1

Added new event:
  probe_perf:call_return_processor__new (on call_return_processor__new in /home/acme/bin/perf)


<SNIP>

I.e. that I end up with:

[root@zoo ~]# perf probe -l  2>&1 | grep probe_perf:.*__new
  probe_perf:call_path__new (on call_path__new@util/thread-stack.c in /home/acme/bin/perf)
  probe_perf:call_path_root__new (on call_path_root__new@util/thread-stack.c in /home/acme/bin/perf)
  probe_perf:call_return_processor__new (on call_return_processor__new@util/thread-stack.c in /home/acme/bin/perf)
  probe_perf:comm__new (on comm__new@util/comm.c in /home/acme/bin/perf)
  probe_perf:cpu_map__new (on cpu_map__new@util/cpumap.c in /home/acme/bin/perf)
  probe_perf:debuginfo__new (on debuginfo__new@util/probe-finder.c in /home/acme/bin/perf)
  probe_perf:disasm_line__new (on disasm_line__new@util/annotate.c in /home/acme/bin/perf)
  probe_perf:dso__new  (on dso__new@util/dso.c in /home/acme/bin/perf)
  probe_perf:dso__new_map (on dso__new_map@util/dso.c in /home/acme/bin/perf)
  probe_perf:fdarray__new (on fdarray__new@fd/array.c in /home/acme/bin/perf)
  probe_perf:hist_browser__new (on hist_browser__new@ui/browsers/hists.c in /home/acme/bin/perf)
<SNIP>
  probe_perf:thread_map__new_by_uid (on thread_map__new_by_uid@util/thread_map.c in /home/acme/bin/perf)
  probe_perf:thread_map__new_dummy (on thread_map__new_dummy@util/thread_map.c in /home/acme/bin/perf)
  probe_perf:thread_map__new_str (on thread_map__new_str@util/thread_map.c in /home/acme/bin/perf)
[root@zoo ~]#

Some more goodies to have, please consider better compressing the output of successfully installed probes,
Something like:

[root@zoo ~]# perf probe -x ~/bin/perf `perf probe -x ~/bin/perf -F  | grep __new | sed 's/^/-a /g' | sort -u`
Added 46 new events:
  probe_perf:call_path__new (on call_path__new in /home/acme/bin/perf)
  probe_perf:call_path_root__new (on call_path_root__new in /home/acme/bin/perf)
  probe_perf:call_return_processor__new (on call_return_processor__new in /home/acme/bin/perf)
<SNIP>

You can now use them in all perf tools, e.g.:

	perf record -e probe_perf:call_path_root__new -aR sleep 1

------

Also that -l should output to stdout, so that we can grep it, also it would be nice if it -l worked
like in perf list:

[root@zoo ~]# perf probe -l probe_perf:*
Semantic error :There is non-digit char in line number.
  Error: Command Parse Error.
[root@zoo ~]# 

Fails, but:

[root@zoo ~]# perf list *:*switch*

List of pre-defined events (to be used in -e):

  cfg80211:cfg80211_ch_switch_notify                 [Tracepoint event]
  cfg80211:rdev_channel_switch                       [Tracepoint event]
  mac80211:api_chswitch_done                         [Tracepoint event]
  mac80211:drv_channel_switch                        [Tracepoint event]
  mac80211:drv_channel_switch_beacon                 [Tracepoint event]
  mac80211:drv_switch_vif_chanctx                    [Tracepoint event]
  sched:sched_switch                                 [Tracepoint event]

[root@zoo ~]# 

Works :-)

- Arnaldo

             reply	other threads:[~2015-04-08 19:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08 19:48 Arnaldo Carvalho de Melo [this message]
2015-04-09  5:27 ` [RFE] perf probe: Support globbing/regex in -a Masami Hiramatsu
2015-04-09 10:36   ` Arnaldo Carvalho de Melo
2015-04-11  0:25     ` Masami Hiramatsu
2015-04-11 12:22       ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150408194826.GI5403@kernel.org \
    --to=acme@kernel.org \
    --cc=dsahern@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).