mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Shuah Khan <shuahkh@osg.samsung.com>
Cc: mingo@redhat.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] kobject: add kobject trace points
Date: Tue, 6 Sep 2016 14:05:44 -0400	[thread overview]
Message-ID: <20160906140544.3a46f056@gandalf.local.home> (raw)
In-Reply-To: <a23e150da13c38ac9358fac7da5a1549957aaec0.1473174684.git.shuahkh@osg.samsung.com>

On Tue,  6 Sep 2016 11:49:23 -0600
Shuah Khan <shuahkh@osg.samsung.com> wrote:

> +#if !defined(_TRACE_KOBJECT_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_KOBJECT_H
> +
> +#include <linux/tracepoint.h>
> +#include <linux/kobject.h>
> +
> +/* kobject_init_class */
> +DECLARE_EVENT_CLASS(kobject_init_class,
> +
> +	TP_PROTO(struct kobject *kobj),
> +
> +	TP_ARGS(kobj),
> +
> +	TP_STRUCT__entry(
> +		__field(void *, kobj)
> +		__field(int, state_initialized)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->kobj = kobj;
> +		__entry->state_initialized = kobj->state_initialized;
> +	),
> +
> +	TP_printk("KOBJECT: %p state=%d",
> +		  __entry->kobj,
> +		  __entry->state_initialized
> +	));
> +
> +/**
> + * kobject_init	- called from kobject_init() when kobject is initialized
> + * @kobj:	- pointer to struct kobject
> + */
> +DEFINE_EVENT(kobject_init_class, kobject_init,
> +
> +	TP_PROTO(struct kobject *kobj),
> +	TP_ARGS(kobj));
> +
> +/* kobject_class */
> +DECLARE_EVENT_CLASS(kobject_class,
> +
> +	TP_PROTO(struct kobject *kobj),
> +	TP_ARGS(kobj),
> +
> +	TP_STRUCT__entry(
> +		__field(void *, kobj)
> +		__string(name, kobject_name(kobj))
> +		__field(int, state_initialized)
> +		__field(void *, parent)
> +		__string(pname, kobj->parent ? kobject_name(kobj->parent) : "")
> +		__field(int, count)
> +	),

state_initialized looks to be a single bit. As you have two dynamic
strings, it may be best to move this around and possibly save 3 bytes.
Also, dynamic strings take 4 bytes, and pointers are 8 bytes on 64 bit
machines, we want to move those too.

	__field(void *, kobj)
	__field(void *, parent)
	__field(int, count)
	__string(name, ...)
	__string(pname, ...)
	__field(char, state_initialized)

This will compact the event a bit better.

-- Steve

> +
> +	TP_fast_assign(
> +		__entry->kobj = kobj;
> +		__assign_str(name, kobject_name(kobj));
> +		__entry->state_initialized = kobj->state_initialized;
> +		__entry->parent = kobj->parent;
> +		__assign_str(pname,
> +			     kobj->parent ? kobject_name(kobj->parent) : "");
> +		__entry->count = atomic_read(&kobj->kref.refcount);
> +	),
> +
> +	TP_printk("KOBJECT: %s (%p) state=%d parent= %s (%p) counter= %d",
> +		  __get_str(name),
> +		  __entry->kobj,
> +		  __entry->state_initialized,
> +		  __get_str(pname),
> +		  __entry->parent,
> +		  __entry->count
> +	));
> +

  reply	other threads:[~2016-09-06 18:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-06 17:49 [PATCH 0/3] kobject tracepoints Shuah Khan
2016-09-06 17:49 ` [PATCH 1/3] kobject: add kobject trace points Shuah Khan
2016-09-06 18:05   ` Steven Rostedt [this message]
2016-09-07 23:25     ` Shuah Khan
2016-09-06 17:49 ` [PATCH 2/3] kobject: add kobject trace prototypes Shuah Khan
2016-09-06 17:49 ` [PATCH 3/3] kobject: Add calls to kobject trace points Shuah Khan
2016-09-06 19:30 ` [PATCH 0/3] kobject tracepoints Greg KH
2016-09-06 20:19   ` Shuah Khan
2016-09-07  5:48     ` Greg KH

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=20160906140544.3a46f056@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=shuahkh@osg.samsung.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

all inboxes | Powered by JetHome®