public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -tip v2 0/6] perf: Introduce bts sub commands
@ 2010-12-21  9:05 Akihiro Nagai
  2010-12-21  9:05 ` [PATCH -tip v2 1/6] perf: Introduce perf sub command 'bts record' Akihiro Nagai
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Akihiro Nagai @ 2010-12-21  9:05 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra,
	Frederic Weisbecker
  Cc: "akihiro.nagai.hw, Peter Zijlstra, Frederic Weisbecker,
	Paul Mackerras, Ingo Molnar, Arnaldo Carvalho de Melo,
	linux-kernel, Masami Hiramatsu, 2nddept-manager

Hi,

This patch series provides the commands 'perf bts record' and 'perf bts trace'
version 2. These commands can record and analyze BTS (Branch Trace Store) log.
And, provide the interface to use BTS log for application developers.

BTS is a facility of Intel x86 processors, which can record the address of
'branch to/from' on every branch/jump instruction and interrupt.
This facility is very useful for developers to test their software.
For example, coverage test, execution path analysis, dynamic step count ...etc.
Also, those tools can have a very big advantage that they don't require any
changes of the target executable binaries.

But, there are few applications using BTS. Reasons I guess are ...
 - Few people know what BTS is.
 - Few people know how to use BTS on Linux box.
 - It's hard to analyze the BTS log because it includes just a series of addresses.

So, I want to provide a user-friendly interface to BTS for application developers.


 About new sub commands
========================
'perf bts record' provides the easy way to record bts log.
Usage is 'perf bts record <command>'.  This command is just an alias to
'perf record -e branches:u -c 1 <command>'. But, new one is more simple and
more intuitive.

'perf bts trace' can parse and analyze recorded bts log and print various
information of execution path. This command can show address, pid, command name,
function+offset, file path of elf.
You can choose the printed information with option.

Example: 'perf bts trace'
function+offset
irq_return+0x0  => _start+0x0
irq_return+0x0  => _start+0x0
_start+0x3      => _dl_start+0x0
irq_return+0x0  => _dl_start+0x0
irq_return+0x0  => _dl_start+0x26
irq_return+0x0  => _dl_start+0x2d
_dl_start+0x71  => _dl_start+0x93
_dl_start+0x97  => _dl_start+0x78
...

This is the default behavior of 'perf bts trace'. It prints function+offset.


Example2: 'perf bts -cas trace'
command address            function+offset                  
ls      0xffffffff8146fe0e irq_return+0x0  => ls   0x0000003806200b20 _start+0x0
ls      0xffffffff8146fe0e irq_return+0x0  => ls   0x0000003806200b20 _start+0x0
ls      0x0000003806200b23 _start+0x3      => ls   0x0000003806204910 _dl_start+0x0
ls      0xffffffff8146fe0e irq_return+0x0  => ls   0x0000003806204910 _dl_start+0x0
ls      0xffffffff8146fe0e irq_return+0x0  => ls   0x0000003806204936 _dl_start+0x26
ls      0xffffffff8146fe0e irq_return+0x0  => ls   0x000000380620493d _dl_start+0x2d
ls      0x0000003806204981 _dl_start+0x71  => ls   0x00000038062049a3 _dl_start+0x93
ls      0x00000038062049a7 _dl_start+0x97  => ls   0x0000003806204988 _dl_start+0x78
...

In the future, I'd like to make this more informative. For example
 - Show source file path
 - Show line number
 - Show inlined function name
 - Draw call graph
 - Browse source code and coloring
 - Make bts record fast
and more!

Changes in V2:
 - Update to the latest -tip tree
 - add bts explanation to the subcommand list
 - remove the patch already merged (add OPT_CALLBACK_DEFAULT_NOOPT)
 - add comments
 - add new function to the todo list

Thanks,

---

Akihiro Nagai (6):
      perf bts trace: add print all option
      perf bts trace: print function+offset
      perf bts trace: print file path of the executed elf
      perf bts trace: print pid and command
      perf bts: Introduce new sub command 'perf bts trace'
      perf: Introduce perf sub command 'bts record'


 tools/perf/Documentation/perf-bts.txt |   53 ++++++
 tools/perf/Makefile                   |    1 
 tools/perf/builtin-bts.c              |  301 +++++++++++++++++++++++++++++++++
 tools/perf/builtin.h                  |    1 
 tools/perf/command-list.txt           |    1 
 tools/perf/perf.c                     |    1 
 6 files changed, 358 insertions(+), 0 deletions(-)
 create mode 100644 tools/perf/Documentation/perf-bts.txt
 create mode 100644 tools/perf/builtin-bts.c

-- 
Akihiro Nagai (akihiro.nagai.hw@hitachi.com)

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2010-12-24 10:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-21  9:05 [PATCH -tip v2 0/6] perf: Introduce bts sub commands Akihiro Nagai
2010-12-21  9:05 ` [PATCH -tip v2 1/6] perf: Introduce perf sub command 'bts record' Akihiro Nagai
2010-12-21  9:05 ` [PATCH -tip v2 2/6] perf bts: Introduce new sub command 'perf bts trace' Akihiro Nagai
2010-12-21 18:31   ` Frederic Weisbecker
2010-12-21 18:40     ` Peter Zijlstra
2010-12-21 18:45       ` Frederic Weisbecker
2010-12-21 18:52         ` Peter Zijlstra
2010-12-21 19:02           ` Frederic Weisbecker
2010-12-21 19:56             ` Peter Zijlstra
2010-12-21 21:33               ` Frederic Weisbecker
2010-12-21 21:41                 ` Peter Zijlstra
2010-12-24 10:04     ` Akihiro Nagai
2010-12-21  9:05 ` [PATCH -tip v2 3/6] perf bts trace: print pid and command Akihiro Nagai
2010-12-21  9:06 ` [PATCH -tip v2 4/6] perf bts trace: print file path of the executed elf Akihiro Nagai
2010-12-21  9:06 ` [PATCH -tip v2 5/6] perf bts trace: print function+offset Akihiro Nagai
2010-12-21  9:06 ` [PATCH -tip v2 6/6] perf bts trace: add print all option Akihiro Nagai
2010-12-21 17:36 ` [PATCH -tip v2 0/6] perf: Introduce bts sub commands Frederic Weisbecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox