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?
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html