public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Wang Nan <wangnan0@huawei.com>
Cc: acme@kernel.org, linux-kernel@vger.kernel.org, pi3orama@163.com,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH 4/6] perf ctf: Generate comm event to CTF output
Date: Fri, 24 Jun 2016 09:07:43 +0200	[thread overview]
Message-ID: <20160624070743.GB10142@krava> (raw)
In-Reply-To: <1466673383-105778-5-git-send-email-wangnan0@huawei.com>

On Thu, Jun 23, 2016 at 09:16:21AM +0000, Wang Nan wrote:
> If non_sample is selected, convert comm event to output CTF stream.
> 
> setup_non_sample_events() is called if non_sample is selected. It creates
> a comm_class for comm event.
> 
> Use macros to generate and process_comm_event and add_comm_event. These
> macros can be reused for other non-sample events.
> 
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> ---
>  tools/perf/util/data-convert-bt.c | 108 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 108 insertions(+)
> 
> diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
> index 0bc3ee2..bc6d42b 100644
> --- a/tools/perf/util/data-convert-bt.c
> +++ b/tools/perf/util/data-convert-bt.c
> @@ -68,6 +68,7 @@ struct ctf_writer {
>  		};
>  		struct bt_ctf_field_type *array[6];
>  	} data;
> +	struct bt_ctf_event_class	*comm_class;
>  };
>  
>  struct convert {
> @@ -761,6 +762,55 @@ static int process_sample_event(struct perf_tool *tool,
>  	return cs ? 0 : -1;
>  }
>  
> +#define __NON_SAMPLE_SET_FIELD(_name, _type, _field) 	\
> +do {							\
> +	ret = value_set_##_type(cw, event, #_field, _event->_name._field);\
> +	if (ret)					\
> +		return -1;				\
> +} while(0)
> +
> +#define __FUNC_PROCESS_NON_SAMPLE(_name, body) 	\
> +static int process_##_name##_event(struct perf_tool *tool,	\
> +				   union perf_event *_event,	\
> +				   struct perf_sample *sample,	\
> +				   struct machine *machine)	\
> +{								\
> +	struct convert *c = container_of(tool, struct convert, tool);\
> +	struct ctf_writer *cw = &c->writer;			\
> +	struct bt_ctf_event_class *event_class = cw->_name##_class;\
> +	struct bt_ctf_event *event;				\
> +	struct ctf_stream *cs;					\
> +	int ret;						\
> +								\
> +	event = bt_ctf_event_create(event_class);		\
> +	if (!event) {						\
> +		pr_err("Failed to create an CTF event\n");	\
> +		return -1;					\
> +	}							\
> +								\
> +	bt_ctf_clock_set_time(cw->clock, sample->time);		\


coudl you please also add the global stats update,
so we get the statistics straight at the end?

        /* update stats */
        c->events_count++;
        c->events_size += _event->header.size;

thanks,
jirka

  reply	other threads:[~2016-06-24  7:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23  9:16 [PATCH 0/6] perf ctf: Convert comm, fork and exit events to CTF Wang Nan
2016-06-23  9:16 ` [PATCH 1/6] perf ctf: Add value_set_string() helper Wang Nan
2016-06-23  9:16 ` [PATCH 2/6] perf ctf: Pass convert options through structure Wang Nan
2016-06-23  9:16 ` [PATCH 3/6] perf ctf: Add non_sample option Wang Nan
2016-06-23  9:16 ` [PATCH 4/6] perf ctf: Generate comm event to CTF output Wang Nan
2016-06-24  7:07   ` Jiri Olsa [this message]
2016-06-23  9:16 ` [PATCH 5/6] perf ctf: Add '--all' option for 'perf data convert' Wang Nan
2016-06-24  7:07   ` Jiri Olsa
2016-06-23  9:16 ` [PATCH 6/6] perf ctf: Generate fork and exit events to CTF output Wang Nan

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=20160624070743.GB10142@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pi3orama@163.com \
    --cc=wangnan0@huawei.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