All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Ingo Molnar <mingo@redhat.com>,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@pengutronix.de
Subject: Re: [PATCH] watchdog: Add tracing events for the most usual watchdog events
Date: Mon, 3 Oct 2022 12:29:07 -0400	[thread overview]
Message-ID: <20221003122907.4fc39351@gandalf.local.home> (raw)
In-Reply-To: <20220930144935.3373366-1-u.kleine-koenig@pengutronix.de>

On Fri, 30 Sep 2022 16:49:35 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:


> --- /dev/null
> +++ b/include/trace/events/watchdog.h
> @@ -0,0 +1,92 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM watchdog
> +
> +#if !defined(_TRACE_WATCHDOG_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_WATCHDOG_H
> +
> +#include <linux/watchdog.h>
> +#include <linux/tracepoint.h>
> +
> +TRACE_EVENT(watchdog_start,
> +
> +	TP_PROTO(struct watchdog_device *wdd, int err),
> +
> +	TP_ARGS(wdd, err),
> +
> +	TP_STRUCT__entry(
> +		__field(int, id)
> +		__field(int, err)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->id = wdd->id;
> +		__entry->err = err;
> +	),
> +
> +	TP_printk("watchdog%d err=%d", __entry->id, __entry->err)
> +);
> +

[..]

> +
> +TRACE_EVENT(watchdog_ping,
> +
> +	TP_PROTO(struct watchdog_device *wdd, int err),
> +
> +	TP_ARGS(wdd, err),
> +
> +	TP_STRUCT__entry(
> +		__field(int, id)
> +		__field(int, err)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->id = wdd->id;
> +		__entry->err = err;
> +	),
> +
> +	TP_printk("watchdog%d err=%d", __entry->id, __entry->err)
> +);
> +
> +TRACE_EVENT(watchdog_stop,
> +
> +	TP_PROTO(struct watchdog_device *wdd, int err),
> +
> +	TP_ARGS(wdd, err),
> +
> +	TP_STRUCT__entry(
> +		__field(int, id)
> +		__field(int, err)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->id = wdd->id;
> +		__entry->err = err;
> +	),
> +
> +	TP_printk("watchdog%d err=%d", __entry->id, __entry->err)
> +);

These three events are identical. Please replace them with:

DECLARE_EVENT_CLASS(watchdog_template,

	TP_PROTO(struct watchdog_device *wdd, int err),

	TP_ARGS(wdd, err),

	TP_STRUCT__entry(
		__field(int, id)
		__field(int, err)
	),

	TP_fast_assign(
		__entry->id = wdd->id;
		__entry->err = err;
	),

	TP_printk("watchdog%d err=%d", __entry->id, __entry->err)
);

DEFINE_EVENT(watchdog_template, watchdog_start,
	TP_PROTO(struct watchdog_device *wdd, int err),
	TP_ARGS(wdd, err));

DEFINE_EVENT(watchdog_template, watchdog_ping,
	TP_PROTO(struct watchdog_device *wdd, int err),
	TP_ARGS(wdd, err));

DEFINE_EVENT(watchdog_template, watchdog_stop,
	TP_PROTO(struct watchdog_device *wdd, int err),
	TP_ARGS(wdd, err));


Each TRACE_EVENT() is defined as
  DECLARE_EVENT_CLASS(..)
  DEFINE_EVENT(..)

Where the DECLARE_EVENT_CLASS takes up most of the memory (5KB worth), and
each DEFINE_EVENT() takes up just around 500 bytes to implement.

Using multiple DEFINE_EVENTS() can save 10KB from the above.

-- Steve


> +
> +#endif /* !defined(_TRACE_WATCHDOG_H) || defined(TRACE_HEADER_MULTI_READ) */
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> 
> base-commit: 568035b01cfb107af8d2e4bd2fb9aea22cf5b868


      reply	other threads:[~2022-10-03 16:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-30 14:49 [PATCH] watchdog: Add tracing events for the most usual watchdog events Uwe Kleine-König
2022-10-03 16:29 ` Steven Rostedt [this message]

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=20221003122907.4fc39351@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mingo@redhat.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=wim@linux-watchdog.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.