audio: Put buffer state log under CONFIG_SOF_LOG_DBG_BUFFER switch

comp_update_buffer_consume() and comp_update_buffer_produce() generate
too much log output. Usually such amount of logs results in many log
messages been dropped. It is also results in significant CPU load if
selected log backend formats log messages at runtime.

This patch adds a separate switch to enable these logs only when necessary.
Default value is 'n'.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
This commit is contained in:
Serhiy Katsyuba 2023-08-03 18:07:29 +02:00 committed by Kai Vehmanen
parent 6f4084b4d9
commit 3813a135d5
2 changed files with 18 additions and 0 deletions

View File

@ -51,4 +51,14 @@ config SOF_LOG_LEVEL
default 3 if SOF_LOG_LEVEL_INF
default 4 if SOF_LOG_LEVEL_DBG
config SOF_LOG_DBG_BUFFER
bool "Log buffer state on each consume/produce call"
default n
help
Dumps buffer struct audio_stream values on each call to comp_update_buffer_consume()
and comp_update_buffer_produce().
WARNING: Produces too much log output which usually results in many log messaged been
dropped! Also, if selected log backend formats log messages at runtime, enabling this
option results in significant CPU load!
endmenu

View File

@ -228,11 +228,13 @@ void comp_update_buffer_produce(struct comp_buffer __sparse_cache *buffer, uint3
/* return if no bytes */
if (!bytes) {
#if CONFIG_SOF_LOG_DBG_BUFFER
buf_dbg(buffer, "comp_update_buffer_produce(), no bytes to produce, source->comp.id = %u, source->comp.type = %u, sink->comp.id = %u, sink->comp.type = %u",
buffer->source ? dev_comp_id(buffer->source) : (unsigned int)UINT32_MAX,
buffer->source ? dev_comp_type(buffer->source) : (unsigned int)UINT32_MAX,
buffer->sink ? dev_comp_id(buffer->sink) : (unsigned int)UINT32_MAX,
buffer->sink ? dev_comp_type(buffer->sink) : (unsigned int)UINT32_MAX);
#endif
return;
}
@ -242,6 +244,7 @@ void comp_update_buffer_produce(struct comp_buffer __sparse_cache *buffer, uint3
notifier_event(cache_to_uncache(buffer), NOTIFIER_ID_BUFFER_PRODUCE,
NOTIFIER_TARGET_CORE_LOCAL, &cb_data, sizeof(cb_data));
#if CONFIG_SOF_LOG_DBG_BUFFER
buf_dbg(buffer, "comp_update_buffer_produce(), ((buffer->avail << 16) | buffer->free) = %08x, ((buffer->id << 16) | buffer->size) = %08x",
(audio_stream_get_avail_bytes(&buffer->stream) << 16) |
audio_stream_get_free_bytes(&buffer->stream),
@ -251,6 +254,7 @@ void comp_update_buffer_produce(struct comp_buffer __sparse_cache *buffer, uint3
(char *)audio_stream_get_addr(&buffer->stream)) << 16 |
((char *)audio_stream_get_wptr(&buffer->stream) -
(char *)audio_stream_get_addr(&buffer->stream)));
#endif
}
void comp_update_buffer_consume(struct comp_buffer __sparse_cache *buffer, uint32_t bytes)
@ -263,11 +267,13 @@ void comp_update_buffer_consume(struct comp_buffer __sparse_cache *buffer, uint3
/* return if no bytes */
if (!bytes) {
#if CONFIG_SOF_LOG_DBG_BUFFER
buf_dbg(buffer, "comp_update_buffer_consume(), no bytes to consume, source->comp.id = %u, source->comp.type = %u, sink->comp.id = %u, sink->comp.type = %u",
buffer->source ? dev_comp_id(buffer->source) : (unsigned int)UINT32_MAX,
buffer->source ? dev_comp_type(buffer->source) : (unsigned int)UINT32_MAX,
buffer->sink ? dev_comp_id(buffer->sink) : (unsigned int)UINT32_MAX,
buffer->sink ? dev_comp_type(buffer->sink) : (unsigned int)UINT32_MAX);
#endif
return;
}
@ -276,6 +282,7 @@ void comp_update_buffer_consume(struct comp_buffer __sparse_cache *buffer, uint3
notifier_event(cache_to_uncache(buffer), NOTIFIER_ID_BUFFER_CONSUME,
NOTIFIER_TARGET_CORE_LOCAL, &cb_data, sizeof(cb_data));
#if CONFIG_SOF_LOG_DBG_BUFFER
buf_dbg(buffer, "comp_update_buffer_consume(), (buffer->avail << 16) | buffer->free = %08x, (buffer->id << 16) | buffer->size = %08x, (buffer->r_ptr - buffer->addr) << 16 | (buffer->w_ptr - buffer->addr)) = %08x",
(audio_stream_get_avail_bytes(&buffer->stream) << 16) |
audio_stream_get_free_bytes(&buffer->stream),
@ -284,6 +291,7 @@ void comp_update_buffer_consume(struct comp_buffer __sparse_cache *buffer, uint3
(char *)audio_stream_get_addr(&buffer->stream)) << 16 |
((char *)audio_stream_get_wptr(&buffer->stream) -
(char *)audio_stream_get_addr(&buffer->stream)));
#endif
}
/*