linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lin Ming <minggr@gmail.com>
To: Artur Baruchi <mail.baruchi@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Kprobe
Date: Wed, 13 Apr 2011 10:58:47 +0800	[thread overview]
Message-ID: <BANLkTi=jEHOVO9v5aaREzCHC5rGBOFcotA@mail.gmail.com> (raw)
In-Reply-To: <BANLkTinpQdbyTRY0m+UL7EKF3jAOv=aU1A@mail.gmail.com>

On Sun, Apr 10, 2011 at 10:28 PM, Artur Baruchi <mail.baruchi@gmail.com> wrote:
> Hi Guys.
>
> Im using kprobe to probe a kernel function (find_get_page) and I would
> like to know more details, like which function is calling it, but I
> couldnt figure out a way to do that. Is it possible to use kprobe or
> other kind of probe to detect which function is calling find_get_page
> ?

Do you know the cool "perf" tool.
Its sub command "perf probe" is exactly what you want.

# cd linux-2.6/tools/perf
# make
# ./perf probe -k ~/vmlinux -s ~/linux-2.6/  find_get_page
# ./perf record -e probe:find_get_page -f -g -a
# ./perf report

# Events: 81K
#
# Overhead  Command      Shared Object         Symbol
# ........  .......  .................  .............
#
   100.00%     perf  [kernel.kallsyms]  [k] find_get_page
               |
               --- find_get_page
                  |
                  |--94.84%-- grab_cache_page_write_begin
                  |          ext3_write_begin
                  |          generic_file_buffered_write
                  |          __generic_file_aio_write
                  |          generic_file_aio_write
                  |          do_sync_write
                  |          vfs_write
                  |          sys_write
                  |          system_call_fastpath
                  |          __libc_write
                  |          |
                  |          |--68.98%-- mmap_read_all
                  |          |          __cmd_record
                  |          |          cmd_record
                  |          |          run_builtin
                  |          |          handle_internal_command
                  |          |          run_argv
                  |          |          main
                  |          |          __libc_start_main
                  |          |
                  |          |--29.30%-- mmap_read
                  |          |          mmap_read_all
                  |          |          __cmd_record
                  |          |          cmd_record
                  |          |          run_builtin
                  |          |          handle_internal_command
                  |          |          run_argv
                  |          |          main
                  |          |          __libc_start_main
                  |          |
                  |           --1.72%-- process_synthesized_event
                  |                     |
                  |                     |--87.99%--
perf_event__synthesize_mmap_events
                  |                     |          __event__synthesize_thread
                  |                     |
perf_event__synthesize_threads
                  |                     |          __cmd_record
                  |                     |          cmd_record
                  |                     |          run_builtin
                  |                     |          handle_internal_command
                  |                     |          run_argv
                  |                     |          main
                  |                     |          __libc_start_main

Have a try and you'll like it!

Lin Ming

>
> Thanks in advance.
>
> Att.
> Artur Baruchi
> --
> 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/
>

      reply	other threads:[~2011-04-13  2:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-10 14:28 Kprobe Artur Baruchi
2011-04-13  2:58 ` Lin Ming [this message]

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='BANLkTi=jEHOVO9v5aaREzCHC5rGBOFcotA@mail.gmail.com' \
    --to=minggr@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mail.baruchi@gmail.com \
    /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).