how can I get page fault addressed with perf

zhao bao baozhao at gmail.com
Sun Mar 20 05:15:55 EDT 2011


  Hi,  I want to trace page faults in my program. The result I wanted like this:
  1st page fault at addrA.
  2nd page fault at addrB.
  3rd page fault at addrC
  ...

  Perf seems providing this function, but I can't get what I want.
  I use Perf on Fedora 14(kernel 2.6.35). The following is what I have
done in my machine.
Thanks for help in advance.

[root at localhost lab]# perf record -R -c 1  -d  -e  faults ./hello
hello,world
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.010 MB perf.data (~418 samples) ]
[root at localhost lab]# perf report -n
# Events: 91  cycles
#
# Overhead  Samples    Command      Shared Object  Symbol
# ........ ..........  .......  .................  ......
#
    10.99%         10    hello  ld-2.12.90.so      [.] .L198
     6.59%          6    hello  ld-2.12.90.so      [.] _dl_load_cache_lookup
     6.59%          6    hello  ld-2.12.90.so      [.] _dl_lookup_symbol_x
     4.40%          4    hello  ld-2.12.90.so      [.] dl_main
     3.30%          3    hello  ld-2.12.90.so      [.] _dl_start
     3.30%          3    hello  ld-2.12.90.so      [.] _dl_cache_libcmp
     3.30%          3    hello  ld-2.12.90.so      [.] do_lookup_x
     2.20%          2    hello  libc-2.12.90.so    [.] _init
     2.20%          2    hello  libc-2.12.90.so    [.]
_IO_file_overflow_internal
     2.20%          2    hello  ld-2.12.90.so      [.] _dl_map_object_from_fd
     2.20%          2    hello  ld-2.12.90.so      [.] _dl_init_paths
     2.20%          2    hello  ld-2.12.90.so      [.] _dl_setup_hash
     2.20%          2    hello  ld-2.12.90.so      [.] .L302
     .......................



More information about the Kernelnewbies mailing list