linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: zhao bao <baozhao@gmail.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: Fwd: perf trace cannot work with software events ?
Date: Sun, 27 Mar 2011 15:09:27 -0600	[thread overview]
Message-ID: <4D8FA787.7020308@gmail.com> (raw)
In-Reply-To: <AANLkTi=JefJqiUdvZ+r+sS25+bbDG_c6M8825xKpSUnu@mail.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()


> 
> 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?

  reply	other threads:[~2011-03-27 21:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=4D8FA787.7020308@gmail.com \
    --to=dsahern@gmail.com \
    --cc=baozhao@gmail.com \
    --cc=linux-perf-users@vger.kernel.org \
    /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).