linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: Arun Kalyanasundaram <arunkaly@google.com>
Cc: tzanussi@gmail.com, linux-kernel@vger.kernel.org,
	David Carrillo-Cisneros <davidcc@google.com>,
	acme@kernel.org
Subject: Re: perf script: Question: Python trace processing script contains the tid of the process in the common_pid attribute
Date: Sat, 1 Jul 2017 11:47:03 -0300	[thread overview]
Message-ID: <20170701144703.GA5504@redhat.com> (raw)
In-Reply-To: <CAGjB_Bp0haKX+YPC5117yK440mTK1ZW3WBubt616hbKaQNxd6w@mail.gmail.com>

Em Fri, Jun 30, 2017 at 03:40:57PM -0700, Arun Kalyanasundaram escreveu:
> The handlers in the python script generated from "perf script" have an
> attribute: common_pid. This attribute contains the tid of the process
> instead of its pid. I would like to know if this is the expected behavior.
> There are no other attributes in the Python handler that provide the pid
> and knowing the process id is useful to be able to group all samples that
> belong to the same process that generated different threads.

Humm, you have:

def process_event(param_dict):
        event_attr = param_dict["attr"]
        sample     = param_dict["sample"]
        raw_buf    = param_dict["raw_buf"]
        comm       = param_dict["comm"]
        name       = param_dict["ev_name"]

And then, on sample you have (from a recent python script for processing
Intel PT samples):

def print_common_start(comm, sample, name):
       ts = sample["time"]
       cpu = sample["cpu"]
       pid = sample["pid"]
       tid = sample["tid"]
       print "%16s %5u/%-5u [%03u] %9u.%09u %7s:" % (comm, pid, tid, cpu, ts / 1000000000, ts %1000000000, name),

- Arnaldo

       reply	other threads:[~2017-07-01 14:47 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 ` Arnaldo Carvalho de Melo [this message]
2017-07-05 16:22   ` perf script: Question: Python trace processing script contains the tid of the process in the common_pid attribute Arun Kalyanasundaram
2017-07-05 19:25     ` Arnaldo Carvalho de Melo
2017-07-05 19:26       ` Arnaldo Carvalho de Melo
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=20170701144703.GA5504@redhat.com \
    --to=acme@redhat.com \
    --cc=acme@kernel.org \
    --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).