All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Namhyung Kim <namhyung@kernel.org>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung.kim@lge.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>
Subject: Re: [RFC/PATCH 2/3] perf script: Print comm, fork and exit events also
Date: Sun, 17 Nov 2013 21:44:46 -0700	[thread overview]
Message-ID: <52899B3E.9050901@gmail.com> (raw)
In-Reply-To: <1384743642-15120-2-git-send-email-namhyung@kernel.org>

On 11/17/13, 8:00 PM, Namhyung Kim wrote:
> @@ -578,6 +579,106 @@ static int process_attr(struct perf_tool *tool, union perf_event *event,
>   	return perf_evsel__check_attr(evsel, scr->session);
>   }
>
> +static int process_comm_event(struct perf_tool *tool,
> +			      union perf_event *event,
> +			      struct perf_sample *sample,
> +			      struct machine *machine)
> +{
> +	struct thread *thread;
> +	struct perf_script *script = container_of(tool, struct perf_script, tool);
> +	struct perf_session *session = script->session;
> +	struct perf_evsel *evsel = perf_evlist__first(session->evlist);
> +	char *oldname;
> +
> +	thread = machine__findnew_thread(machine, event->comm.pid, event->comm.tid);
> +	if (thread == NULL) {
> +		pr_debug("problem processing COMM event, skipping it.\n");
> +		return -1;
> +	}
> +
> +	oldname = strdup(thread__comm_str(thread));
> +	if (oldname == NULL) {
> +		pr_debug("problem processing COMM event, skipping it.\n");
> +		return -1;
> +	}
> +
> +	if (perf_event__process_comm(tool, event, sample, machine) < 0)
> +		return -1;
> +
> +	if (!evsel->attr.sample_id_all) {
> +		sample->cpu = 0;
> +		sample->time = 0;
> +		sample->tid = event->comm.tid;
> +		sample->pid = event->comm.pid;
> +	}
> +	print_sample_start(sample, thread, evsel);
> +	printf("comm: %s --> %s\n", oldname, event->comm.comm);

free(oldname)

David

  reply	other threads:[~2013-11-18  4:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-18  3:00 [PATCH 1/3] perf script: Move evname print code to process_event() Namhyung Kim
2013-11-18  3:00 ` [RFC/PATCH 2/3] perf script: Print comm, fork and exit events also Namhyung Kim
2013-11-18  4:44   ` David Ahern [this message]
2013-11-18  3:00 ` [RFC/PATCH 3/3] perf script: Print mmap[2] " Namhyung Kim
2013-11-18  4:47   ` David Ahern
2013-11-18  5:18     ` Namhyung Kim

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=52899B3E.9050901@gmail.com \
    --to=dsahern@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.