* perf trace cannot work with software events ?
@ 2011-03-26 8:04 zhao bao
2011-03-26 9:28 ` Lin Ming
0 siblings, 1 reply; 21+ messages in thread
From: zhao bao @ 2011-03-26 8:04 UTC (permalink / raw)
To: linux-perf-users
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@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@localhost lab]# perf trace
Fatal: no event_list!
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: perf trace cannot work with software events ?
2011-03-26 8:04 perf trace cannot work with software events ? zhao bao
@ 2011-03-26 9:28 ` Lin Ming
[not found] ` <AANLkTi=VrazJpV+dpzX2hWJ8dYDgbdo_5FAOMRYRo0GD@mail.gmail.com>
0 siblings, 1 reply; 21+ messages in thread
From: Lin Ming @ 2011-03-26 9:28 UTC (permalink / raw)
To: zhao bao; +Cc: linux-perf-users
On Sat, Mar 26, 2011 at 4:04 PM, zhao bao <baozhao@gmail.com> wrote:
> 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@localhost lab]# perf record -R -c 1 -d -e faults ./hello
It's used to trace kernel space page faults, not for userspace code.
Lin Ming
> hello,world
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.010 MB perf.data (~418 samples) ]
>
> [root@localhost lab]# perf trace
> Fatal: no event_list!
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Fwd: perf trace cannot work with software events ?
[not found] ` <AANLkTi=VrazJpV+dpzX2hWJ8dYDgbdo_5FAOMRYRo0GD@mail.gmail.com>
@ 2011-03-26 12:31 ` zhao bao
2011-03-26 13:13 ` David Ahern
0 siblings, 1 reply; 21+ messages in thread
From: zhao bao @ 2011-03-26 12:31 UTC (permalink / raw)
To: linux-perf-users
---------- Forwarded message ----------
From: zhao bao <baozhao@gmail.com>
Date: 2011/3/26
Subject: Re: perf trace cannot work with software events ?
To: Lin Ming <minggr@gmail.com>
>
> It's used to trace kernel space page faults, not for userspace code.
>
> Lin Ming
>
From the ouput of "perf report" command, I think perf can record the
page faults from userspace code.
[root@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 (~420 samples) ]
[root@localhost lab]# perf report
# Events: 92 cycles
#
# Overhead Command Shared Object Symbol
# ........ ....... ................. ......
#
10.87% hello ld-2.12.90.so [.] .L198
6.52% hello ld-2.12.90.so [.] _dl_load_cache_lookup
6.52% hello ld-2.12.90.so [.] _dl_lookup_symbol_x
4.35% hello ld-2.12.90.so [.] dl_main
3.26% hello ld-2.12.90.so [.] _dl_start
3.26% hello ld-2.12.90.so [.] _dl_cache_libcmp
3.26% hello ld-2.12.90.so [.] do_lookup_x
2.17% hello libc-2.12.90.so [.] _init
2.17% hello libc-2.12.90.so [.] _IO_file_overflow_internal
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fwd: perf trace cannot work with software events ?
2011-03-26 12:31 ` Fwd: " zhao bao
@ 2011-03-26 13:13 ` David Ahern
2011-03-26 14:00 ` zhao bao
0 siblings, 1 reply; 21+ messages in thread
From: David Ahern @ 2011-03-26 13:13 UTC (permalink / raw)
To: zhao bao; +Cc: linux-perf-users
On 03/26/11 06:31, zhao bao wrote:
>> It's used to trace kernel space page faults, not for userspace code.
>>
>> Lin Ming
>>
>
> From the ouput of "perf report" command, I think perf can record the
> page faults from userspace code.
>
> [root@localhost lab]# perf record -R -c 1 -d -e faults ./hello
> hello,world
'-e faults' is a software event. perf-trace does not handle S/W events.
perf-trace has been renamed to perf-script, and perf-script recently
gained the ability to dump S/W events:
https://lkml.org/lkml/2011/3/10/3
David
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.010 MB perf.data (~420 samples) ]
> [root@localhost lab]# perf report
> # Events: 92 cycles
> #
> # Overhead Command Shared Object Symbol
> # ........ ....... ................. ......
> #
> 10.87% hello ld-2.12.90.so [.] .L198
> 6.52% hello ld-2.12.90.so [.] _dl_load_cache_lookup
> 6.52% hello ld-2.12.90.so [.] _dl_lookup_symbol_x
> 4.35% hello ld-2.12.90.so [.] dl_main
> 3.26% hello ld-2.12.90.so [.] _dl_start
> 3.26% hello ld-2.12.90.so [.] _dl_cache_libcmp
> 3.26% hello ld-2.12.90.so [.] do_lookup_x
> 2.17% hello libc-2.12.90.so [.] _init
> 2.17% hello libc-2.12.90.so [.] _IO_file_overflow_internal
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fwd: perf trace cannot work with software events ?
2011-03-26 13:13 ` David Ahern
@ 2011-03-26 14:00 ` zhao bao
2011-03-26 14:23 ` David Ahern
2011-03-26 14:27 ` Lin Ming
0 siblings, 2 replies; 21+ messages in thread
From: zhao bao @ 2011-03-26 14:00 UTC (permalink / raw)
To: David Ahern; +Cc: linux-perf-users
2011/3/26 David Ahern <dsahern@gmail.com>:
> On 03/26/11 06:31, zhao bao wrote:
>>> It's used to trace kernel space page faults, not for userspace code.
>>>
>>> Lin Ming
>>>
>>
>> From the ouput of "perf report" command, I think perf can record the
>> page faults from userspace code.
>>
>> [root@localhost lab]# perf record -R -c 1 -d -e faults ./hello
>> hello,world
>
> '-e faults' is a software event. perf-trace does not handle S/W events.
> perf-trace has been renamed to perf-script, and perf-script recently
> gained the ability to dump S/W events:
>
> https://lkml.org/lkml/2011/3/10/3
>
> David
>
Thanks. How can I apply your patch? May I need upgrade to 2.6.38?
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fwd: perf trace cannot work with software events ?
2011-03-26 14:00 ` zhao bao
@ 2011-03-26 14:23 ` David Ahern
2011-03-26 16:13 ` zhao bao
2011-03-26 14:27 ` Lin Ming
1 sibling, 1 reply; 21+ messages in thread
From: David Ahern @ 2011-03-26 14:23 UTC (permalink / raw)
To: zhao bao; +Cc: linux-perf-users
On 03/26/11 08:00, zhao bao wrote:
> 2011/3/26 David Ahern <dsahern@gmail.com>:
>> On 03/26/11 06:31, zhao bao wrote:
>>>> It's used to trace kernel space page faults, not for userspace code.
>>>>
>>>> Lin Ming
>>>>
>>>
>>> From the ouput of "perf report" command, I think perf can record the
>>> page faults from userspace code.
>>>
>>> [root@localhost lab]# perf record -R -c 1 -d -e faults ./hello
>>> hello,world
>>
>> '-e faults' is a software event. perf-trace does not handle S/W events.
>> perf-trace has been renamed to perf-script, and perf-script recently
>> gained the ability to dump S/W events:
>>
>> https://lkml.org/lkml/2011/3/10/3
>>
>> David
>>
> Thanks. How can I apply your patch? May I need upgrade to 2.6.38?
You can compile latest perf userpsace and it should work with files from
older kernels.
David
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fwd: perf trace cannot work with software events ?
2011-03-26 14:00 ` zhao bao
2011-03-26 14:23 ` David Ahern
@ 2011-03-26 14:27 ` Lin Ming
1 sibling, 0 replies; 21+ messages in thread
From: Lin Ming @ 2011-03-26 14:27 UTC (permalink / raw)
To: zhao bao; +Cc: David Ahern, linux-perf-users
On Sat, Mar 26, 2011 at 10:00 PM, zhao bao <baozhao@gmail.com> wrote:
> 2011/3/26 David Ahern <dsahern@gmail.com>:
>> On 03/26/11 06:31, zhao bao wrote:
>>>> It's used to trace kernel space page faults, not for userspace code.
>>>>
>>>> Lin Ming
>>>>
>>>
>>> From the ouput of "perf report" command, I think perf can record the
>>> page faults from userspace code.
Right, I misunderstood your original question.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fwd: perf trace cannot work with software events ?
2011-03-26 14:23 ` David Ahern
@ 2011-03-26 16:13 ` zhao bao
2011-03-27 3:59 ` David Ahern
0 siblings, 1 reply; 21+ messages in thread
From: zhao bao @ 2011-03-26 16:13 UTC (permalink / raw)
To: David Ahern; +Cc: linux-perf-users
> You can compile latest perf userpsace and it should work with files from
> older kernels.
>
> David
>
Follow your guide, I git the latest kernel and compiled the perf tools
, then perf script works.
But I found the outputed address is instruction address, not the
address caused the page fault. Can I get these addresses with perf
tool?
[root@localhost lab]# /root/bin/perf script
hello 30242 [000] 48324.304652: page-faults:
c05b6d35 clear_user ([kernel.kallsyms])
hello 30242 [000] 48324.304684: page-faults:
c05b6d35 clear_user ([kernel.kallsyms])
hello 30242 [000] 48324.304701: page-faults:
c05b68a0 __copy_to_user_ll ([kernel.kallsyms])
hello 30242 [000] 48324.304746: page-faults:
870 _start (/lib/ld-2.13.so)
hello 30242 [000] 48324.304750: page-faults:
4920 _dl_start (/lib/ld-2.13.so)
hello 30242 [000] 48324.304753: page-faults:
17acb __i686.get_pc_thunk.bx (/lib/ld-2.13.so)
hello 30242 [000] 48324.304755: page-faults:
4939 _dl_start (/lib/ld-2.13.so)
hello 30242 [000] 48324.304765: page-faults:
a790 _dl_setup_hash (/lib/ld-2.13.so)
hello 30242 [000] 48324.304768: page-faults:
14480 _dl_sysdep_start (/lib/ld-2.13.so)
hello 30242 [000] 48324.304771: page-faults:
14560 _dl_sysdep_start (/lib/ld-2.13.so)
hello 30242 [000] 48324.304774: page-faults:
159e0 brk (/lib/ld-2.13.so)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fwd: perf trace cannot work with software events ?
2011-03-26 16:13 ` zhao bao
@ 2011-03-27 3:59 ` David Ahern
2011-03-27 7:44 ` zhao bao
0 siblings, 1 reply; 21+ messages in thread
From: David Ahern @ 2011-03-27 3:59 UTC (permalink / raw)
To: zhao bao; +Cc: linux-perf-users
On 03/26/11 10:13, zhao bao wrote:
> Follow your guide, I git the latest kernel and compiled the perf tools
> , then perf script works.
> But I found the outputed address is instruction address, not the
> address caused the page fault. Can I get these addresses with perf
> tool?
> [root@localhost lab]# /root/bin/perf script
> hello 30242 [000] 48324.304652: page-faults:
> c05b6d35 clear_user ([kernel.kallsyms])
> hello 30242 [000] 48324.304684: page-faults:
> c05b6d35 clear_user ([kernel.kallsyms])
> hello 30242 [000] 48324.304701: page-faults:
> c05b68a0 __copy_to_user_ll ([kernel.kallsyms])
> hello 30242 [000] 48324.304746: page-faults:
> 870 _start (/lib/ld-2.13.so)
> hello 30242 [000] 48324.304750: page-faults:
> 4920 _dl_start (/lib/ld-2.13.so)
> hello 30242 [000] 48324.304753: page-faults:
> 17acb __i686.get_pc_thunk.bx (/lib/ld-2.13.so)
> hello 30242 [000] 48324.304755: page-faults:
> 4939 _dl_start (/lib/ld-2.13.so)
> hello 30242 [000] 48324.304765: page-faults:
> a790 _dl_setup_hash (/lib/ld-2.13.so)
> hello 30242 [000] 48324.304768: page-faults:
> 14480 _dl_sysdep_start (/lib/ld-2.13.so)
> hello 30242 [000] 48324.304771: page-faults:
> 14560 _dl_sysdep_start (/lib/ld-2.13.so)
> hello 30242 [000] 48324.304774: page-faults:
> 159e0 brk (/lib/ld-2.13.so)
Without callchains it shows the IP when the event triggered. If you want
more detail try adding -g to perf-record to get callchains.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fwd: perf trace cannot work with software events ?
2011-03-27 3:59 ` David Ahern
@ 2011-03-27 7:44 ` zhao bao
2011-03-27 21:09 ` David Ahern
0 siblings, 1 reply; 21+ messages in thread
From: zhao bao @ 2011-03-27 7:44 UTC (permalink / raw)
To: David Ahern; +Cc: linux-perf-users
2011/3/27 David Ahern <dsahern@gmail.com>:
>
>
> On 03/26/11 10:13, zhao bao wrote:
>> Follow your guide, I git the latest kernel and compiled the perf tools
>> , then perf script works.
>> But I found the outputed address is instruction address, not the
>> address caused the page fault. Can I get these addresses with perf
>> tool?
>> [root@localhost lab]# /root/bin/perf script
>> hello 30242 [000] 48324.304652: page-faults:
>> c05b6d35 clear_user ([kernel.kallsyms])
>> hello 30242 [000] 48324.304684: page-faults:
>> c05b6d35 clear_user ([kernel.kallsyms])
>> hello 30242 [000] 48324.304701: page-faults:
>> c05b68a0 __copy_to_user_ll ([kernel.kallsyms])
>> hello 30242 [000] 48324.304746: page-faults:
>> 870 _start (/lib/ld-2.13.so)
>> hello 30242 [000] 48324.304750: page-faults:
>> 4920 _dl_start (/lib/ld-2.13.so)
>> hello 30242 [000] 48324.304753: page-faults:
>> 17acb __i686.get_pc_thunk.bx (/lib/ld-2.13.so)
>> hello 30242 [000] 48324.304755: page-faults:
>> 4939 _dl_start (/lib/ld-2.13.so)
>> hello 30242 [000] 48324.304765: page-faults:
>> a790 _dl_setup_hash (/lib/ld-2.13.so)
>> hello 30242 [000] 48324.304768: page-faults:
>> 14480 _dl_sysdep_start (/lib/ld-2.13.so)
>> hello 30242 [000] 48324.304771: page-faults:
>> 14560 _dl_sysdep_start (/lib/ld-2.13.so)
>> hello 30242 [000] 48324.304774: page-faults:
>> 159e0 brk (/lib/ld-2.13.so)
>
> Without callchains it shows the IP when the event triggered. If you want
> more detail try adding -g to perf-record to get callchains.
>
Thanks for your kind reply.I am sorry for misleading you.
The address I want is the value stored in X86 CR2 register when page
fault occurs, Does perf provide these information?
Another question.
I find a new utility called 'trace' mentioned in
http://lwn.net/Articles/415728/ which provides I want (trace report
-p). But I git the tip tree, and make -j install in tools/perf
directory, I couldn't find trace utility. Where is the trace utility?
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fwd: perf trace cannot work with software events ?
2011-03-27 7:44 ` zhao bao
@ 2011-03-27 21:09 ` David Ahern
2011-03-29 15:48 ` zhao bao
2011-03-29 17:07 ` Fwd: perf trace cannot work with software events ? zhao bao
0 siblings, 2 replies; 21+ messages in thread
From: David Ahern @ 2011-03-27 21:09 UTC (permalink / raw)
To: zhao bao; +Cc: linux-perf-users
On 03/27/11 01:44, zhao bao wrote:
> The address I want is the value stored in X86 CR2 register when page
> fault occurs, Does perf provide these information?
Add the -d option to perf-record, and try the following change on
perf-script:
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index ac574ea..85376b7 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -32,6 +32,7 @@ enum perf_output_field {
PERF_OUTPUT_EVNAME = 1U << 5,
PERF_OUTPUT_TRACE = 1U << 6,
PERF_OUTPUT_SYM = 1U << 7,
+ PERF_OUTPUT_ADDR = 1U << 8,
};
struct output_option {
@@ -46,6 +47,7 @@ struct output_option {
{.str = "event", .field = PERF_OUTPUT_EVNAME},
{.str = "trace", .field = PERF_OUTPUT_TRACE},
{.str = "sym", .field = PERF_OUTPUT_SYM},
+ {.str = "addr", .field = PERF_OUTPUT_ADDR},
};
/* default set to maintain compatibility with current format */
@@ -158,6 +160,8 @@ static void print_sample_start(struct perf_sample
*sample,
printf("%s: ", evname ? evname : "(unknown)");
}
+ if (PRINT_FIELD(ADDR))
+ printf("0x%" PRIx64, sample->addr);
}
static void process_event(union perf_event *event __unused,
@@ -829,7 +833,7 @@ static const struct option options[] = {
OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
"Look for files with symbols relative to this directory"),
OPT_CALLBACK('f', "fields", NULL, "str",
- "comma separated output fields prepend with 'type:'. Valid
types: hw,sw,trace. Fields: comm,tid,pid,time,cpu,event,trace,sym",
+ "comma separated output fields prepend with 'type:'. Valid
types: hw,sw,trace. Fields: comm,tid,pid,time,cpu,event,trace,sym,addr",
parse_output_fields),
OPT_END()
>
> Another question.
> I find a new utility called 'trace' mentioned in
> http://lwn.net/Articles/415728/ which provides I want (trace report
> -p). But I git the tip tree, and make -j install in tools/perf
> directory, I couldn't find trace utility. Where is the trace utility?
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: Fwd: perf trace cannot work with software events ?
2011-03-27 21:09 ` David Ahern
@ 2011-03-29 15:48 ` zhao bao
2011-03-29 16:55 ` baozhao
2011-03-29 17:07 ` Fwd: perf trace cannot work with software events ? zhao bao
1 sibling, 1 reply; 21+ messages in thread
From: zhao bao @ 2011-03-29 15:48 UTC (permalink / raw)
To: David Ahern; +Cc: linux-perf-users
2011/3/28 David Ahern <dsahern@gmail.com>:
>
>
> On 03/27/11 01:44, zhao bao wrote:
>> The address I want is the value stored in X86 CR2 register when page
>> fault occurs, Does perf provide these information?
>
> Add the -d option to perf-record, and try the following change on
> perf-script:
>
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index ac574ea..85376b7 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -32,6 +32,7 @@ enum perf_output_field {
> PERF_OUTPUT_EVNAME = 1U << 5,
> PERF_OUTPUT_TRACE = 1U << 6,
> PERF_OUTPUT_SYM = 1U << 7,
> + PERF_OUTPUT_ADDR = 1U << 8,
> };
>
> struct output_option {
> @@ -46,6 +47,7 @@ struct output_option {
> {.str = "event", .field = PERF_OUTPUT_EVNAME},
> {.str = "trace", .field = PERF_OUTPUT_TRACE},
> {.str = "sym", .field = PERF_OUTPUT_SYM},
> + {.str = "addr", .field = PERF_OUTPUT_ADDR},
> };
>
> /* default set to maintain compatibility with current format */
> @@ -158,6 +160,8 @@ static void print_sample_start(struct perf_sample
> *sample,
>
> printf("%s: ", evname ? evname : "(unknown)");
> }
> + if (PRINT_FIELD(ADDR))
> + printf("0x%" PRIx64, sample->addr);
> }
>
> static void process_event(union perf_event *event __unused,
> @@ -829,7 +833,7 @@ static const struct option options[] = {
> OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
> "Look for files with symbols relative to this directory"),
> OPT_CALLBACK('f', "fields", NULL, "str",
> - "comma separated output fields prepend with 'type:'. Valid
> types: hw,sw,trace. Fields: comm,tid,pid,time,cpu,event,trace,sym",
> + "comma separated output fields prepend with 'type:'. Valid
> types: hw,sw,trace. Fields: comm,tid,pid,time,cpu,event,trace,sym,addr",
> parse_output_fields),
>
> OPT_END()
>
>
>>
I applyed this patch in the builtin-script.c , recompile and install
it. But I found it still doesn't show any CR2 address info. The patch
seems to list a addr column, but perf script still work as before.
I tried two ways.
(1) In fedora 14, new "/root/bin/perf record -d" cannot work because
of "-d" option, so I use old perf record (perf version
2.6.35.6-45.fc14.i686), then use new "perf script" , result is still
the same as before.
[root@localhost lab]# perf --version
perf version 2.6.35.6-45.fc14.i686
[root@localhost lab]# /root/bin/perf --version
perf version 2.6.38.2972.gf88210.dirty
[root@localhost lab]# /root/bin/perf record -c 1 -e faults -R -d ./hello
Error: sys_perf_event_open() syscall returned with 22 (Invalid
argument). /bin/dmesg may provide additional information.
Fatal: No CONFIG_PERF_EVENTS=y kernel support configured?
[root@localhost lab]# perf record -c 1 -e faults -R -d ./hello
hello,world
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.010 MB perf.data (~415 samples) ]
[root@localhost lab]# /root/bin/perf script
hello 2924 [000] 1422.290866: page-faults:
c05b6d35 clear_user ([kernel.kallsyms])
hello 2924 [000] 1422.290894: page-faults:
c05b6d35 clear_user ([kernel.kallsyms])
hello 2924 [000] 1422.290910: page-faults:
c05b68a0 __copy_to_user_ll ([kernel.kallsyms])
hello 2924 [000] 1422.290946: page-faults:
870 _start (/lib/ld-2.13.so)
(2) I compiled the 2.6.38.rc6 kernel(I downloaded a month ago) ,
reboot machien. Now new "/root/bin/perf record -d" can work, but new
"perf script" shows no change.
[root@localhost lab]# /root/bin/perf record -c 1 -e faults -R -d ./hello
hello,world
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.013 MB perf.data (~557 samples) ]
[root@localhost lab]# /root/bin/perf script
hello 2229 [000] 1339.388865: page-faults:
c05ccbb3 clear_user ([kernel.kallsyms])
hello 2229 [000] 1339.388898: page-faults:
c05ccbb3 clear_user ([kernel.kallsyms])
hello 2229 [000] 1339.388915: page-faults:
c05cc70c __copy_to_user_ll ([kernel.kallsyms])
hello 2229 [000] 1339.388945: page-faults:
870 _start (/lib/ld-2.13.so)
hello 2229 [000] 1339.388950: page-faults:
4920 _dl_start (/lib/ld-2.13.so)
hello 2229 [000] 1339.388954: page-faults:
17acb __i686.get_pc_thunk.bx (/lib/ld-2.13.so)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fwd: perf trace cannot work with software events ?
2011-03-29 15:48 ` zhao bao
@ 2011-03-29 16:55 ` baozhao
2011-03-29 20:05 ` David Ahern
0 siblings, 1 reply; 21+ messages in thread
From: baozhao @ 2011-03-29 16:55 UTC (permalink / raw)
To: linux-perf-users
zhao bao <baozhao <at> gmail.com> writes:
> I applyed this patch in the builtin-script.c , recompile and install
> it. But I found it still doesn't show any CR2 address info. The patch
> seems to list a addr column, but perf script still work as before.
Hi, I think I find the problem.
In builtin-script.c, array output_fields should also be
changed,PERF_OUTPUT_ADDR should added to [PERF_TYPE_SOFTWARE], am I
right?
static u64 output_fields[PERF_TYPE_MAX] = {
....
[PERF_TYPE_SOFTWARE] = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | \
PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | \
PERF_OUTPUT_EVNAME | PERF_OUTPUT_SYM | \
PERF_OUTPUT_ADDR,
Here is the output:
[root@localhost lab]# /root/bin/perf script
hello 2229 [000] 1339.388865: page-faults: 0x804963c
c05ccbb3 clear_user ([kernel.kallsyms])
hello 2229 [000] 1339.388898: page-faults: 0x670834
c05ccbb3 clear_user ([kernel.kallsyms])
hello 2229 [000] 1339.388915: page-faults: 0xbf905d6b
c05cc70c __copy_to_user_ll ([kernel.kallsyms])
hello 2229 [000] 1339.388945: page-faults: 0x652870
870 _start (/lib/ld-2.13.so)
hello 2229 [000] 1339.388950: page-faults: 0x656920
4920 _dl_start (/lib/ld-2.13.so)
hello 2229 [000] 1339.388954: page-faults: 0x669acb
17acb __i686.get_pc_thunk.bx (/lib/ld-2.13.so)
hello 2229 [000] 1339.388958: page-faults: 0x66fe54
4939 _dl_start (/lib/ld-2.13.so)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fwd: perf trace cannot work with software events ?
2011-03-27 21:09 ` David Ahern
2011-03-29 15:48 ` zhao bao
@ 2011-03-29 17:07 ` zhao bao
1 sibling, 0 replies; 21+ messages in thread
From: zhao bao @ 2011-03-29 17:07 UTC (permalink / raw)
To: David Ahern; +Cc: linux-perf-users
2011/3/28 David Ahern <dsahern@gmail.com>:
>
>
> On 03/27/11 01:44, zhao bao wrote:
>> The address I want is the value stored in X86 CR2 register when page
>> fault occurs, Does perf provide these information?
>
> Add the -d option to perf-record, and try the following change on
> perf-script:
>
Many thanks to you! I hope your patch would be merged into mainline.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fwd: perf trace cannot work with software events ?
2011-03-29 16:55 ` baozhao
@ 2011-03-29 20:05 ` David Ahern
2011-04-18 3:43 ` perf trace Kumar Ranjit-B04060
0 siblings, 1 reply; 21+ messages in thread
From: David Ahern @ 2011-03-29 20:05 UTC (permalink / raw)
To: baozhao; +Cc: linux-perf-users
On 03/29/11 10:55, baozhao wrote:
> zhao bao <baozhao <at> gmail.com> writes:
>
>
>> I applyed this patch in the builtin-script.c , recompile and install
>> it. But I found it still doesn't show any CR2 address info. The patch
>> seems to list a addr column, but perf script still work as before.
>
> Hi, I think I find the problem.
> In builtin-script.c, array output_fields should also be
> changed,PERF_OUTPUT_ADDR should added to [PERF_TYPE_SOFTWARE], am I
> right?
The defaults do need to better detect when it exists. Until then you can
add addr to the --fields option.
>
> static u64 output_fields[PERF_TYPE_MAX] = {
> ....
> [PERF_TYPE_SOFTWARE] = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | \
> PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | \
> PERF_OUTPUT_EVNAME | PERF_OUTPUT_SYM | \
> PERF_OUTPUT_ADDR,
>
>
> Here is the output:
> [root@localhost lab]# /root/bin/perf script
> hello 2229 [000] 1339.388865: page-faults: 0x804963c
> c05ccbb3 clear_user ([kernel.kallsyms])
> hello 2229 [000] 1339.388898: page-faults: 0x670834
> c05ccbb3 clear_user ([kernel.kallsyms])
> hello 2229 [000] 1339.388915: page-faults: 0xbf905d6b
> c05cc70c __copy_to_user_ll ([kernel.kallsyms])
> hello 2229 [000] 1339.388945: page-faults: 0x652870
> 870 _start (/lib/ld-2.13.so)
> hello 2229 [000] 1339.388950: page-faults: 0x656920
> 4920 _dl_start (/lib/ld-2.13.so)
> hello 2229 [000] 1339.388954: page-faults: 0x669acb
> 17acb __i686.get_pc_thunk.bx (/lib/ld-2.13.so)
> hello 2229 [000] 1339.388958: page-faults: 0x66fe54
> 4939 _dl_start (/lib/ld-2.13.so)
And per another thread we can look at converting the sample addresses to
symbols/dsos.
David
>
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* perf trace
2011-03-29 20:05 ` David Ahern
@ 2011-04-18 3:43 ` Kumar Ranjit-B04060
2011-04-18 6:08 ` David Ahern
0 siblings, 1 reply; 21+ messages in thread
From: Kumar Ranjit-B04060 @ 2011-04-18 3:43 UTC (permalink / raw)
To: David Ahern; +Cc: linux-perf-users, baozhao
Hi David
I need to generate instruction trace for Freescale e500mc core. Please tell me whether I can use perf for that.
If yes then please tell me some steps to do that.
Regards
Ranjit
-----Original Message-----
From: linux-perf-users-owner@vger.kernel.org [mailto:linux-perf-users-owner@vger.kernel.org] On Behalf Of David Ahern
Sent: Wednesday, March 30, 2011 1:36 AM
To: baozhao
Cc: linux-perf-users@vger.kernel.org
Subject: Re: Fwd: perf trace cannot work with software events ?
On 03/29/11 10:55, baozhao wrote:
> zhao bao <baozhao <at> gmail.com> writes:
>
>
>> I applyed this patch in the builtin-script.c , recompile and install
>> it. But I found it still doesn't show any CR2 address info. The
>> patch seems to list a addr column, but perf script still work as before.
>
> Hi, I think I find the problem.
> In builtin-script.c, array output_fields should also be
> changed,PERF_OUTPUT_ADDR should added to [PERF_TYPE_SOFTWARE], am I
> right?
The defaults do need to better detect when it exists. Until then you can add addr to the --fields option.
>
> static u64 output_fields[PERF_TYPE_MAX] = {
> ....
> [PERF_TYPE_SOFTWARE] = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | \
> PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | \
> PERF_OUTPUT_EVNAME | PERF_OUTPUT_SYM | \
> PERF_OUTPUT_ADDR,
>
>
> Here is the output:
> [root@localhost lab]# /root/bin/perf script
> hello 2229 [000] 1339.388865: page-faults: 0x804963c
> c05ccbb3 clear_user ([kernel.kallsyms])
> hello 2229 [000] 1339.388898: page-faults: 0x670834
> c05ccbb3 clear_user ([kernel.kallsyms])
> hello 2229 [000] 1339.388915: page-faults: 0xbf905d6b
> c05cc70c __copy_to_user_ll ([kernel.kallsyms])
> hello 2229 [000] 1339.388945: page-faults: 0x652870
> 870 _start (/lib/ld-2.13.so)
> hello 2229 [000] 1339.388950: page-faults: 0x656920
> 4920 _dl_start (/lib/ld-2.13.so)
> hello 2229 [000] 1339.388954: page-faults: 0x669acb
> 17acb __i686.get_pc_thunk.bx (/lib/ld-2.13.so)
> hello 2229 [000] 1339.388958: page-faults: 0x66fe54
> 4939 _dl_start (/lib/ld-2.13.so)
And per another thread we can look at converting the sample addresses to symbols/dsos.
David
>
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe
> linux-perf-users" in the body of a message to
> majordomo@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: perf trace
2011-04-18 3:43 ` perf trace Kumar Ranjit-B04060
@ 2011-04-18 6:08 ` David Ahern
2011-04-18 6:38 ` Kumar Ranjit-B04060
0 siblings, 1 reply; 21+ messages in thread
From: David Ahern @ 2011-04-18 6:08 UTC (permalink / raw)
To: Kumar Ranjit-B04060; +Cc: linux-perf-users, baozhao
On 04/17/11 21:43, Kumar Ranjit-B04060 wrote:
> Hi David
> I need to generate instruction trace for Freescale e500mc core. Please tell me whether I can use perf for that.
> If yes then please tell me some steps to do that.
> Regards
> Ranjit
I have no idea if that processor is supported by perf for H/W counters.
What do you mean by "instruction trace"?
David
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: perf trace
2011-04-18 6:08 ` David Ahern
@ 2011-04-18 6:38 ` Kumar Ranjit-B04060
2011-04-18 6:48 ` David Ahern
0 siblings, 1 reply; 21+ messages in thread
From: Kumar Ranjit-B04060 @ 2011-04-18 6:38 UTC (permalink / raw)
To: David Ahern; +Cc: linux-perf-users
It is supported by perf for H/W counter as i can use perf stat for various H/W events. I want to see actual instruction flow for a particular application. Like we have Kernel Function Trace for the kernel.
Regards
Ranjit
________________________________________
From: linux-perf-users-owner@vger.kernel.org [linux-perf-users-owner@vger.kernel.org] on behalf of David Ahern [dsahern@gmail.com]
Sent: Monday, April 18, 2011 11:38 AM
To: Kumar Ranjit-B04060
Cc: linux-perf-users@vger.kernel.org; baozhao
Subject: Re: perf trace
On 04/17/11 21:43, Kumar Ranjit-B04060 wrote:
> Hi David
> I need to generate instruction trace for Freescale e500mc core. Please tell me whether I can use perf for that.
> If yes then please tell me some steps to do that.
> Regards
> Ranjit
I have no idea if that processor is supported by perf for H/W counters.
What do you mean by "instruction trace"?
David
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: perf trace
2011-04-18 6:38 ` Kumar Ranjit-B04060
@ 2011-04-18 6:48 ` David Ahern
2011-04-18 17:46 ` Kumar Ranjit-B04060
0 siblings, 1 reply; 21+ messages in thread
From: David Ahern @ 2011-04-18 6:48 UTC (permalink / raw)
To: Kumar Ranjit-B04060; +Cc: linux-perf-users
On 04/18/11 00:38, Kumar Ranjit-B04060 wrote:
> It is supported by perf for H/W counter as i can use perf stat for various H/W events. I want to see actual instruction flow for a particular application. Like we have Kernel Function Trace for the kernel.
meaning periodic samples of the counter? perf-record does not generate
periodic reads of H/W counters.
David
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: perf trace
2011-04-18 6:48 ` David Ahern
@ 2011-04-18 17:46 ` Kumar Ranjit-B04060
2011-04-18 19:26 ` David Ahern
0 siblings, 1 reply; 21+ messages in thread
From: Kumar Ranjit-B04060 @ 2011-04-18 17:46 UTC (permalink / raw)
To: David Ahern; +Cc: linux-perf-users
David
> meaning periodic samples of the counter? perf-record does not generate periodic reads of H/W counters.
Just curious, How does then the profiling works? Perf report shows % no of sample point corresponding a particular event. So it must be sampling the PC periodically.
Regards
Ranjit
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: perf trace
2011-04-18 17:46 ` Kumar Ranjit-B04060
@ 2011-04-18 19:26 ` David Ahern
0 siblings, 0 replies; 21+ messages in thread
From: David Ahern @ 2011-04-18 19:26 UTC (permalink / raw)
To: Kumar Ranjit-B04060; +Cc: linux-perf-users
On 04/18/11 11:46, Kumar Ranjit-B04060 wrote:
> David
>
>
> > meaning periodic samples of the counter? perf-record does not generate periodic reads of H/W counters.
>
> Just curious, How does then the profiling works? Perf report shows % no of sample point corresponding a particular event. So it must be sampling the PC periodically.
> Regards
> Ranjit
With H/W counters the values of the counters are not read when samples
are created.
David
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2011-04-18 19:26 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-26 8:04 perf trace cannot work with software events ? zhao bao
2011-03-26 9:28 ` Lin Ming
[not found] ` <AANLkTi=VrazJpV+dpzX2hWJ8dYDgbdo_5FAOMRYRo0GD@mail.gmail.com>
2011-03-26 12:31 ` Fwd: " zhao bao
2011-03-26 13:13 ` David Ahern
2011-03-26 14:00 ` zhao bao
2011-03-26 14:23 ` David Ahern
2011-03-26 16:13 ` zhao bao
2011-03-27 3:59 ` David Ahern
2011-03-27 7:44 ` zhao bao
2011-03-27 21:09 ` David Ahern
2011-03-29 15:48 ` zhao bao
2011-03-29 16:55 ` baozhao
2011-03-29 20:05 ` David Ahern
2011-04-18 3:43 ` perf trace Kumar Ranjit-B04060
2011-04-18 6:08 ` David Ahern
2011-04-18 6:38 ` Kumar Ranjit-B04060
2011-04-18 6:48 ` David Ahern
2011-04-18 17:46 ` Kumar Ranjit-B04060
2011-04-18 19:26 ` David Ahern
2011-03-29 17:07 ` Fwd: perf trace cannot work with software events ? zhao bao
2011-03-26 14:27 ` Lin Ming
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.