mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: David Ahern <dsahern@gmail.com>
Cc: acme@kernel.org, linux-kernel@vger.kernel.org,
	Don Zickus <dzickus@redhat.com>, Joe Mario <jmario@redhat.com>
Subject: Re: [PATCH 2/2] perf tool: Fix ppid for synthesized fork events
Date: Mon, 30 Mar 2015 10:04:29 +0200	[thread overview]
Message-ID: <20150330080429.GA8624@krava.brq.redhat.com> (raw)
In-Reply-To: <1427668202-15422-2-git-send-email-dsahern@gmail.com>

On Sun, Mar 29, 2015 at 04:30:02PM -0600, David Ahern wrote:

SNIP

> -static pid_t perf_event__synthesize_comm(struct perf_tool *tool,
> -					 union perf_event *event, pid_t pid,
> -					 perf_event__handler_t process,
> -					 struct machine *machine)
> +static int perf_event__synthesize_comm(struct perf_tool *tool,
> +				       union perf_event *event, pid_t pid,
> +				       perf_event__handler_t process,
> +				       struct machine *machine,
> +				       pid_t *tgid, pid_t *ppid)
>  {
> -	pid_t tgid = perf_event__prepare_comm(event, pid, machine);
> -
> -	if (tgid == -1)
> -		goto out;
> +	if (perf_event__prepare_comm(event, pid, machine, tgid, ppid) != 0)
> +		return -1;

why dont we set ppid also for single comm event? seems to me
like following assignments:

        event->fork.ppid = ppid;
        event->fork.ptid = ppid;
        event->fork.pid  = tgid;
        event->fork.tid  = pid;
        event->fork.header.type = PERF_RECORD_FORK;

should be part of perf_event__prepare_comm function..?

SNIP

> @@ -365,14 +387,12 @@ static int __event__synthesize_thread(union perf_event *comm_event,
>  	char filename[PATH_MAX];
>  	DIR *tasks;
>  	struct dirent dirent, *next;
> -	pid_t tgid;
> +	pid_t tgid, ppid;
>  
>  	/* special case: only send one comm event using passed in pid */
>  	if (!full) {
> -		tgid = perf_event__synthesize_comm(tool, comm_event, pid,
> -						   process, machine);
> -
> -		if (tgid == -1)
> +		if (perf_event__synthesize_comm(tool, comm_event, pid,
> +						process, machine, &tgid, &ppid) != 0)

why did you add *ppid arg into perf_event__synthesize_comm?
I see no use for it in the rest of the caller..


jirka

  reply	other threads:[~2015-03-30  8:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-29 22:30 [PATCH 1/2] perf tool: Refactor comm/tgid lookup David Ahern
2015-03-29 22:30 ` [PATCH 2/2] perf tool: Fix ppid for synthesized fork events David Ahern
2015-03-30  8:04   ` Jiri Olsa [this message]
2015-03-30 15:23     ` David Ahern
2015-03-30 15:29       ` Arnaldo Carvalho de Melo
2015-03-30 18:20   ` [PATCH v2 " David Ahern
2015-03-30 19:40     ` Arnaldo Carvalho de Melo
2015-03-30 19:53       ` David Ahern
2015-03-30 20:00         ` Arnaldo Carvalho de Melo
2015-03-30  8:01 ` [PATCH 1/2] perf tool: Refactor comm/tgid lookup Jiri Olsa
2015-03-30 15:34   ` David Ahern

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=20150330080429.GA8624@krava.brq.redhat.com \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=dsahern@gmail.com \
    --cc=dzickus@redhat.com \
    --cc=jmario@redhat.com \
    --cc=linux-kernel@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

Powered by JetHome