public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <srostedt@redhat.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-kernel@vger.kernel.org,
	Grant Likely <grant.likely@secretlab.ca>,
	David Brownell <dbrownell@users.sourceforge.net>
Subject: Re: [PATCH] gpio: add trace events for setting direction and value
Date: Wed, 16 Feb 2011 12:12:51 -0500	[thread overview]
Message-ID: <1297876371.26768.7235.camel@fedora> (raw)
In-Reply-To: <1297875784-2302-1-git-send-email-u.kleine-koenig@pengutronix.de>

On Wed, 2011-02-16 at 18:03 +0100, Uwe Kleine-König wrote:

> --- /dev/null
> +++ b/include/trace/events/gpio.h
> @@ -0,0 +1,56 @@
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM gpio
> +
> +#if !defined(_TRACE_GPIO_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_GPIO_H
> +
> +#include <linux/tracepoint.h>
> +
> +TRACE_EVENT(gpio_direction,
> +
> +	TP_PROTO(unsigned gpio, int in, int err),
> +
> +	TP_ARGS(gpio, in, err),
> +
> +	TP_STRUCT__entry(
> +		__field(unsigned, gpio)
> +		__field(int, in)
> +		__field(int, err)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->gpio = gpio;
> +		__entry->in = in;
> +		__entry->err = err;
> +	),
> +
> +	TP_printk("%u %3s (%d)", __entry->gpio,
> +		__entry->in ? "in" : "out", __entry->err)
> +);
> +
> +TRACE_EVENT(gpio_value,
> +
> +	TP_PROTO(unsigned gpio, int get, int value),
> +
> +	TP_ARGS(gpio, get, value),
> +
> +	TP_STRUCT__entry(
> +		__field(unsigned, gpio)
> +		__field(int, get)
> +		__field(int, value)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->gpio = gpio;
> +		__entry->get = get;
> +		__entry->value = value;
> +	),
> +
> +	TP_printk("%u %3s %d", __entry->gpio,
> +		__entry->get ? "get" : "set", __entry->value)
> +);
> +

Note: to save the memory footprint of these tracepoints, you can use
DEFINE_EVENT_PRINT(). You can see the usage for this in the
include/trace/events/kmem.h.

But to do this, you will need to have a single TP_STRUCT__entry() for
both. Not sure if this is what you want.

	TP_STRUCT__entry(
		__field(unsigned, gpiq)
		__field(int, get_in)
		__field(int, value_err)

??

Just a suggestion, but may not be worth it.

-- Steve



  reply	other threads:[~2011-02-16 17:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-16 17:03 [PATCH] gpio: add trace events for setting direction and value Uwe Kleine-König
2011-02-16 17:12 ` Steven Rostedt [this message]
2011-02-18  9:58   ` Uwe Kleine-König
2011-02-18 15:48     ` Steven Rostedt
2011-03-02 22:03       ` Grant Likely
2011-04-26 15:04         ` Uwe Kleine-König
2011-05-19 18:16 ` Grant Likely

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=1297876371.26768.7235.camel@fedora \
    --to=srostedt@redhat.com \
    --cc=dbrownell@users.sourceforge.net \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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