public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	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>,
	Steven Rostedt <rostedt@goodmis.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	David Ahern <dsahern@gmail.com>,
	Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 03/15] perf util: Save pid-cmdline mapping into tracing header
Date: Wed, 15 May 2013 23:21:24 +0200	[thread overview]
Message-ID: <20130515212124.GC5814@krava.redhat.com> (raw)
In-Reply-To: <1368526439-31966-4-git-send-email-namhyung@kernel.org>

On Tue, May 14, 2013 at 07:13:47PM +0900, Namhyung Kim wrote:
> From: Namhyung Kim <namhyung.kim@lge.com>
> 
> Current trace info data lacks the saved cmdline mapping which is
> needed for pevent to find out the comm of a task.  Add this and bump
> up the version number so that perf can determine its presence when
> reading.
> 
> This is mostly corresponding to trace.dat file version 6, but still
> lacks 4 byte of number of cpus, and 10 bytes of type string - and I
> think we don't need those anyway.
> 
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/util/trace-event-info.c  | 33 ++++++++++++++++++++++++++++++++-
>  tools/perf/util/trace-event-parse.c | 17 +++++++++++++++++
>  tools/perf/util/trace-event-read.c  | 36 ++++++++++++++++++++++++++++++++++--
>  tools/perf/util/trace-event.h       |  1 +
>  4 files changed, 84 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
> index bfcaeac7ef9d..c0f364273993 100644
> --- a/tools/perf/util/trace-event-info.c
> +++ b/tools/perf/util/trace-event-info.c
> @@ -41,7 +41,7 @@
>  #include <lk/debugfs.h>
>  #include "evsel.h"
>  
> -#define VERSION "0.5"
> +#define VERSION "0.6"
>  
>  static int output_fd;
>  
> @@ -390,6 +390,34 @@ out:
>  	return err;
>  }
>  
> +static int record_saved_cmdline(void)
> +{
> +	unsigned int size;
> +	char *path;
> +	struct stat st;
> +	int ret, err = 0;
> +
> +	path = get_tracing_file("saved_cmdlines");
> +	if (!path) {
> +		pr_debug("can't get tracing/saved_cmdline");
> +		return -ENOMEM;
> +	}
> +
> +	ret = stat(path, &st);
> +	if (ret < 0) {
> +		/* not found */
> +		size = 0;
> +		if (write(output_fd, &size, 8) != 8)
> +			err = -EIO;
> +		goto out;
> +	}
> +	err = record_file(path, 8);
> +
> +out:
> +	put_tracing_file(path);
> +	return err;
> +}
> +
>  static void
>  put_tracepoints_path(struct tracepoint_path *tps)
>  {
> @@ -546,6 +574,9 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs,
>  	if (err)
>  		goto out;
>  	err = record_ftrace_printk();
> +	if (err)
> +		goto out;
> +	err = record_saved_cmdline();
>  
>  out:
>  	/*
> diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
> index fe7a27d67d2b..ef09e4720e04 100644
> --- a/tools/perf/util/trace-event-parse.c
> +++ b/tools/perf/util/trace-event-parse.c
> @@ -232,6 +232,23 @@ void parse_ftrace_printk(struct pevent *pevent,
>  	}
>  }
>  
> +void parse_saved_cmdline(struct pevent *pevent,
> +			 char *file, unsigned int size __maybe_unused)

any reason for the size parameter? I can see some other
functions already following this prototype, but I dont
see the reason.. just curious ;)

void parse_ftrace_printk(struct pevent *pevent,
                         char *file, unsigned int size __maybe_unused)

void parse_proc_kallsyms(struct pevent *pevent,
                         char *file, unsigned int size __maybe_unused)


jirka

  reply	other threads:[~2013-05-15 21:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-14 10:13 [PATCHSET 00/15] perf tools: Introduce new 'ftrace' command (v2) Namhyung Kim
2013-05-14 10:13 ` [PATCH 01/15] perf util: Move debugfs/tracing helper functions to util.c Namhyung Kim
2013-05-14 10:13 ` [PATCH 02/15] perf util: Use evsel->name to get tracepoint_paths Namhyung Kim
2013-05-15 14:59   ` Jiri Olsa
2013-05-16  2:13     ` Namhyung Kim
2013-05-14 10:13 ` [PATCH 03/15] perf util: Save pid-cmdline mapping into tracing header Namhyung Kim
2013-05-15 21:21   ` Jiri Olsa [this message]
2013-05-16  2:51     ` Namhyung Kim
2013-05-14 10:13 ` [PATCH 04/15] perf util: Add more debug message on failure path Namhyung Kim
2013-05-14 10:13 ` [PATCH 05/15] perf tools: Introduce new 'ftrace' tool Namhyung Kim
2013-05-14 10:13 ` [PATCH 06/15] perf ftrace: Add support for --pid option Namhyung Kim
2013-05-14 10:13 ` [PATCH 07/15] perf ftrace: Add support for -a and -C option Namhyung Kim
2013-05-14 10:13 ` [PATCH 08/15] perf ftrace: Split "live" sub-command Namhyung Kim
2013-05-14 10:13 ` [PATCH 09/15] perf ftrace: Add 'record' sub-command Namhyung Kim
2013-05-15 21:20   ` Jiri Olsa
2013-05-16  2:24     ` Namhyung Kim
2013-05-15 21:21   ` Jiri Olsa
2013-05-16  2:43     ` Namhyung Kim
2013-05-14 10:13 ` [PATCH 10/15] perf ftrace: Add 'show' sub-command Namhyung Kim
2013-05-15 21:21   ` Jiri Olsa
2013-05-16  2:47     ` Namhyung Kim
2013-05-14 10:13 ` [PATCH 11/15] perf ftrace: Add 'report' sub-command Namhyung Kim
2013-05-14 10:13 ` [PATCH 12/15] perf ftrace: Use pager for displaying result Namhyung Kim
2013-05-14 10:13 ` [PATCH 13/15] perf ftrace: Cleanup using ftrace_setup/teardown() Namhyung Kim
2013-05-14 10:13 ` [PATCH 14/15] perf tools: Add document for perf-ftrace command Namhyung Kim
2013-05-14 10:13 ` [PATCH 15/15] perf ftrace: Add a signal handler for SIGSEGV 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=20130515212124.GC5814@krava.redhat.com \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=rostedt@goodmis.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