linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Arun Kalyanasundaram <arunkaly@google.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
	Tom Zanussi <tzanussi@gmail.com>,
	linux-kernel@vger.kernel.org,
	David Carrillo-Cisneros <davidcc@google.com>
Subject: Re: perf script: Question: Python trace processing script contains the tid of the process in the common_pid attribute
Date: Wed, 5 Jul 2017 16:26:40 -0300	[thread overview]
Message-ID: <20170705192640.GJ27350@kernel.org> (raw)
In-Reply-To: <20170705192545.GI27350@kernel.org>

Em Wed, Jul 05, 2017 at 04:25:45PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Jul 05, 2017 at 09:22:07AM -0700, Arun Kalyanasundaram escreveu:
> > Hi Arnaldo,
> > 
> > Thank you for your reply.
> > I actually meant tracepoint event handlers: def
> > trace_unhandled(event_name, context, event_fields_dict)
> > The dict parameter contains an attribute "common_pid" which is
> > actually the "tid" of the thread. There are no other attributes that
> > contain the actual pid of the process. So, I was wondering if this is
> > something intentional? If not I can share a patch to fix this.
> 
> Yeah there is a problem in:
> 
> tools/perf/util/scripting-engines/trace-event-python.c
> 
> static void python_process_event(union perf_event *event,
>                                  struct perf_sample *sample,
>                                  struct perf_evsel *evsel,
>                                  struct addr_location *al)
> {
>         struct tables *tables = &tables_global;
> 
>         switch (evsel->attr.type) {
>         case PERF_TYPE_TRACEPOINT:
>                 python_process_tracepoint(sample, evsel, al);
>                 break;
>         /* Reserve for future process_hw/sw/raw APIs */
>         default:
>                 if (tables->db_export_mode)
>                         db_export__sample(&tables->dbe, event, sample, evsel, al);
>                 else
>                         python_process_general_event(sample, evsel, al);
>         }
> }
> 
> The python_process_tracepoint() thing predates
> python_process_general_event(), and doesn't adds the dict with all the
> perf_sample entries that python_process_general_event() passes to the
> python method :-\
> 
> Both the per-tracepoint python hooks _and_ trace_unhandled() should get
> that dict, is that what your patch does?

Well, for performance reasons I think perhaps we could take a look at
the signature of the python hook and provide the dictionary only if it
is in it?

- Arnaldo

  reply	other threads:[~2017-07-05 19:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAGjB_Bp0haKX+YPC5117yK440mTK1ZW3WBubt616hbKaQNxd6w@mail.gmail.com>
2017-07-01 14:47 ` perf script: Question: Python trace processing script contains the tid of the process in the common_pid attribute Arnaldo Carvalho de Melo
2017-07-05 16:22   ` Arun Kalyanasundaram
2017-07-05 19:25     ` Arnaldo Carvalho de Melo
2017-07-05 19:26       ` Arnaldo Carvalho de Melo [this message]
2017-07-05 20:41         ` Arun Kalyanasundaram
2017-07-05 23:51           ` Arun Kalyanasundaram
2017-07-07 15:18             ` Arnaldo Carvalho de Melo

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=20170705192640.GJ27350@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=arunkaly@google.com \
    --cc=davidcc@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tzanussi@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).