All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: soc-cache: Add trace event for snd_soc_cache_sync()
@ 2011-01-21 14:35 Dimitris Papastamos
  2011-01-21 14:46 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Dimitris Papastamos @ 2011-01-21 14:35 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, patches

This patch makes it easier to see which of the register writes are part
of the cache syncing functionality.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
 include/trace/events/asoc.h |    9 +++++++++
 sound/soc/soc-cache.c       |    5 +++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h
index 186e84d..7efed81 100644
--- a/include/trace/events/asoc.h
+++ b/include/trace/events/asoc.h
@@ -59,6 +59,15 @@ DEFINE_EVENT(snd_soc_reg, snd_soc_reg_read,
 
 );
 
+DEFINE_EVENT(snd_soc_reg, snd_soc_cache_sync,
+
+	TP_PROTO(struct snd_soc_codec *codec, unsigned int reg,
+		 unsigned int val),
+
+	TP_ARGS(codec, reg, val)
+
+);
+
 DECLARE_EVENT_CLASS(snd_soc_card,
 
 	TP_PROTO(struct snd_soc_card *card, int val),
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index f834839..accd96e 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -18,6 +18,8 @@
 #include <linux/bitmap.h>
 #include <linux/rbtree.h>
 
+#include <trace/events/asoc.h>
+
 static unsigned int snd_soc_4_12_read(struct snd_soc_codec *codec,
 				     unsigned int reg)
 {
@@ -895,6 +897,7 @@ static int snd_soc_rbtree_cache_sync(struct snd_soc_codec *codec)
 		codec->cache_bypass = 0;
 		if (ret)
 			return ret;
+		trace_snd_soc_cache_sync(codec, rbnode->reg, val);
 		dev_dbg(codec->dev, "Synced register %#x, value = %#x\n",
 			rbnode->reg, val);
 	}
@@ -1155,6 +1158,7 @@ static int snd_soc_lzo_cache_sync(struct snd_soc_codec *codec)
 		codec->cache_bypass = 0;
 		if (ret)
 			return ret;
+		trace_snd_soc_cache_sync(codec, i, val);
 		dev_dbg(codec->dev, "Synced register %#x, value = %#x\n",
 			i, val);
 	}
@@ -1415,6 +1419,7 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
 		ret = snd_soc_write(codec, i, val);
 		if (ret)
 			return ret;
+		trace_snd_soc_cache_sync(codec, i, val);
 		dev_dbg(codec->dev, "Synced register %#x, value = %#x\n",
 			i, val);
 	}
-- 
1.7.3.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: soc-cache: Add trace event for snd_soc_cache_sync()
  2011-01-21 14:35 [PATCH] ASoC: soc-cache: Add trace event for snd_soc_cache_sync() Dimitris Papastamos
@ 2011-01-21 14:46 ` Mark Brown
  2011-01-21 14:54   ` Dimitris Papastamos
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2011-01-21 14:46 UTC (permalink / raw)
  To: Dimitris Papastamos; +Cc: alsa-devel, patches, Liam Girdwood

On Fri, Jan 21, 2011 at 02:35:48PM +0000, Dimitris Papastamos wrote:
> This patch makes it easier to see which of the register writes are part
> of the cache syncing functionality.

Might be more useful to have sync start and end events?  That way we can
not only see which writes are part of the sync but we can also see how
long the overall process takes, helping diagnose if our CPU side stuff
is too expensive.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: soc-cache: Add trace event for snd_soc_cache_sync()
  2011-01-21 14:46 ` Mark Brown
@ 2011-01-21 14:54   ` Dimitris Papastamos
  0 siblings, 0 replies; 4+ messages in thread
From: Dimitris Papastamos @ 2011-01-21 14:54 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, patches, Liam, Girdwood

On Fri, 2011-01-21 at 14:46 +0000, Mark Brown wrote:
> On Fri, Jan 21, 2011 at 02:35:48PM +0000, Dimitris Papastamos wrote:
> > This patch makes it easier to see which of the register writes are part
> > of the cache syncing functionality.
> 
> Might be more useful to have sync start and end events?  That way we can
> not only see which writes are part of the sync but we can also see how
> long the overall process takes, helping diagnose if our CPU side stuff
> is too expensive.

I'll add those yes and remove the one I've got now.

Thanks,
Dimitris

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ASoC: soc-cache: Add trace event for snd_soc_cache_sync()
@ 2011-01-21 15:24 Dimitris Papastamos
  0 siblings, 0 replies; 4+ messages in thread
From: Dimitris Papastamos @ 2011-01-21 15:24 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, patches

This patch makes it easy to see when the syncing process begins and
ends.  You can also enable the snd_soc_reg_write tracepoint to see
which registers are being synced.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
 include/trace/events/asoc.h |   25 +++++++++++++++++++++++++
 sound/soc/soc-cache.c       |   10 ++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h
index 186e84d..ce993a3 100644
--- a/include/trace/events/asoc.h
+++ b/include/trace/events/asoc.h
@@ -229,6 +229,31 @@ TRACE_EVENT(snd_soc_jack_notify,
 	TP_printk("jack=%s %x", __get_str(name), (int)__entry->val)
 );
 
+TRACE_EVENT(snd_soc_cache_sync,
+
+	TP_PROTO(struct snd_soc_codec *codec, const char *type,
+		 const char *status),
+
+	TP_ARGS(codec, type, status),
+
+	TP_STRUCT__entry(
+		__string(	name,		codec->name	)
+		__string(	status,		status		)
+		__string(	type,		type		)
+		__field(	int,		id		)
+	),
+
+	TP_fast_assign(
+		__assign_str(name, codec->name);
+		__assign_str(status, status);
+		__assign_str(type, type);
+		__entry->id = codec->id
+	),
+
+	TP_printk("codec=%s.%d type=%s status=%s", __get_str(name),
+		  (int)__entry->id, __get_str(type), __get_str(status))
+);
+
 #endif /* _TRACE_ASOC_H */
 
 /* This part must be outside protection */
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index f834839..db66dc4 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -18,6 +18,8 @@
 #include <linux/bitmap.h>
 #include <linux/rbtree.h>
 
+#include <trace/events/asoc.h>
+
 static unsigned int snd_soc_4_12_read(struct snd_soc_codec *codec,
 				     unsigned int reg)
 {
@@ -1601,18 +1603,26 @@ EXPORT_SYMBOL_GPL(snd_soc_cache_write);
 int snd_soc_cache_sync(struct snd_soc_codec *codec)
 {
 	int ret;
+	const char *name;
 
 	if (!codec->cache_sync) {
 		return 0;
 	}
 
+	if (codec->cache_ops->name)
+		name = codec->cache_ops->name;
+	else
+		name = "unknown";
+
 	if (codec->cache_ops && codec->cache_ops->sync) {
 		if (codec->cache_ops->name)
 			dev_dbg(codec->dev, "Syncing %s cache for %s codec\n",
 				codec->cache_ops->name, codec->name);
+		trace_snd_soc_cache_sync(codec, name, "start");
 		ret = codec->cache_ops->sync(codec);
 		if (!ret)
 			codec->cache_sync = 0;
+		trace_snd_soc_cache_sync(codec, name, "end");
 		return ret;
 	}
 
-- 
1.7.3.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-21 15:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-21 14:35 [PATCH] ASoC: soc-cache: Add trace event for snd_soc_cache_sync() Dimitris Papastamos
2011-01-21 14:46 ` Mark Brown
2011-01-21 14:54   ` Dimitris Papastamos
2011-01-21 15:24 Dimitris Papastamos

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.