Sound Open Firmware
Loading...
Searching...
No Matches
trace-soflogger.h File Reference
Include dependency graph for trace-soflogger.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  trace_filter

Macros

#define _DECLARE_LOG_ENTRY(lvl, format, comp_class, n_params)
 The start of this linker output MUST match the 'ldc_entry_header' struct defined in the logger program running in user space.
#define _TRACE_EVENT_MAX_ARGUMENT_COUNT   4
#define trace_event_with_ids(class, ctx, id_1, id_2, format, ...)
#define trace_event_atomic_with_ids(class, ctx, id_1, id_2, format, ...)
#define trace_warn_with_ids(class, ctx, id_1, id_2, format, ...)
#define trace_warn_atomic_with_ids(class, ctx, id_1, id_2, format, ...)
#define _trace_event_with_ids(lvl, class, ctx, id_1, id_2, format, ...)
#define _trace_event_atomic_with_ids(lvl, class, ctx, id_1, id_2, format, ...)
#define MTRACE_DUPLICATION_LEVEL   LOG_LEVEL_ERROR
#define trace_point(x)
#define BASE_LOG_ASSERT_FAIL_MSG
#define CT_ASSERT(COND, MESSAGE)
#define trace_check_size_uint32(a)
#define STATIC_ASSERT_ARG_SIZE(...)
#define _log_message(log_func, atomic, lvl, comp_class, ctx, id_1, id_2, format, ...)
 _log_message is where the memory-saving dictionary magic described above happens: the "format" string argument is moved to a special linker section and replaced by a &log_entry pointer to it.
#define _log_nodict(atomic, n_args, lvl, format, ...)
#define tracev_event_with_ids(class, ctx, id_1, id_2, format, ...)
#define tracev_event_atomic_with_ids(class, ctx, id_1, id_2, format, ...)
#define trace_error_with_ids(...)
#define trace_error_atomic_with_ids(...)
#define trace_dev_err(get_ctx_m, get_id_m, get_subid_m, dev, fmt, ...)
 Trace from a device on err level.
#define trace_dev_warn(get_ctx_m, get_id_m, get_subid_m, dev, fmt, ...)
 Trace from a device on warning level.
#define trace_dev_info(get_ctx_m, get_id_m, get_subid_m, dev, fmt, ...)
 Trace from a device on info level.
#define trace_dev_dbg(get_ctx_m, get_id_m, get_subid_m, dev, fmt, ...)
 Trace from a device on dbg level.
#define tr_err_atomic(ctx, fmt, ...)
#define tr_warn_atomic(ctx, fmt, ...)
#define tr_info_atomic(ctx, fmt, ...)
#define tr_dbg_atomic(ctx, fmt, ...)
#define tr_err(ctx, fmt, ...)
#define tr_warn(ctx, fmt, ...)
#define tr_info(ctx, fmt, ...)
#define tr_dbg(ctx, fmt, ...)
#define mtrace_printf(log_level, format_str, ...)
 Direct, low-level access to mbox / shared memory logging when DMA tracing is either not initialized yet or disabled or found broken for any reason.

Typedefs

typedef void(* log_func_t) (bool send_atomic, const void *log_entry, const struct tr_ctx *ctx, uint32_t lvl, uint32_t id_1, uint32_t id_2, int arg_count, va_list args)

Functions

static struct trace * trace_get (void)
void trace_flush_dma_to_mbox (void)
void trace_on (void)
void trace_off (void)
void trace_init (struct sof *sof)
void trace_log_filtered (bool send_atomic, const void *log_entry, const struct tr_ctx *ctx, uint32_t lvl, uint32_t id_1, uint32_t id_2, int arg_count, va_list args)
void trace_log_unfiltered (bool send_atomic, const void *log_entry, const struct tr_ctx *ctx, uint32_t lvl, uint32_t id_1, uint32_t id_2, int arg_count, va_list args)
struct sof_ipc_trace_filter_elem * trace_filter_fill (struct sof_ipc_trace_filter_elem *elem, struct sof_ipc_trace_filter_elem *end, struct trace_filter *filter)
int trace_filter_update (const struct trace_filter *elem)
void mtrace_dict_entry (bool atomic_context, uint32_t log_entry_pointer, int n_args,...)
 Appends one SOF dictionary entry and log statement to the ring buffer implementing the 'etrace' in shared memory.
void mtrace_event (const char *complete_packet, uint32_t length)
 Posts a fully prepared log header + log entry.
void _log_sofdict (log_func_t sofdict_logf, bool atomic, const void *log_entry, const struct tr_ctx *ctx, const uint32_t lvl, uint32_t id_1, uint32_t id_2, int arg_count,...)

Macro Definition Documentation

◆ _DECLARE_LOG_ENTRY

#define _DECLARE_LOG_ENTRY ( lvl,
format,
comp_class,
n_params )
Value:
__section(".static_log." #lvl) \
static const struct { \
uint32_t level; \
uint32_t component_class; \
uint32_t params_num; \
uint32_t line_idx; \
uint32_t file_name_len; \
uint32_t text_len; \
const char file_name[sizeof(RELATIVE_FILE)]; \
const char text[sizeof(format)]; \
} log_entry = { \
lvl, \
comp_class, \
n_params, \
__LINE__, \
sizeof(RELATIVE_FILE), \
sizeof(format), \
RELATIVE_FILE, \
format \
}
#define __section(x)
Definition compiler_attributes.h:31

The start of this linker output MUST match the 'ldc_entry_header' struct defined in the logger program running in user space.

◆ _log_message

#define _log_message ( log_func,
atomic,
lvl,
comp_class,
ctx,
id_1,
id_2,
format,
... )
Value:
do { \
_DECLARE_LOG_ENTRY(lvl, format, comp_class, \
META_COUNT_VARAGS_BEFORE_COMPILE(__VA_ARGS__)); \
STATIC_ASSERT_ARG_SIZE(__VA_ARGS__); \
META_COUNT_VARAGS_BEFORE_COMPILE(__VA_ARGS__), \
); \
_log_sofdict(log_func, atomic, &log_entry, ctx, lvl, id_1, id_2, \
META_COUNT_VARAGS_BEFORE_COMPILE(__VA_ARGS__), ##__VA_ARGS__); \
_log_nodict(atomic, META_COUNT_VARAGS_BEFORE_COMPILE(__VA_ARGS__), \
lvl, format, ##__VA_ARGS__); \
} while (0)
#define _TRACE_EVENT_MAX_ARGUMENT_COUNT
Definition trace-soflogger.h:53
#define BASE_LOG_ASSERT_FAIL_MSG
Definition trace-soflogger.h:194

_log_message is where the memory-saving dictionary magic described above happens: the "format" string argument is moved to a special linker section and replaced by a &log_entry pointer to it.

This must be a macro for the source location to be meaningful.

◆ _log_nodict

#define _log_nodict ( atomic,
n_args,
lvl,
format,
... )

◆ _trace_event_atomic_with_ids

#define _trace_event_atomic_with_ids ( lvl,
class,
ctx,
id_1,
id_2,
format,
... )
Value:
_log_message(trace_log_filtered, true, lvl, class, ctx, id_1, id_2, format, ##__VA_ARGS__)
#define _log_message(log_func, atomic, lvl, comp_class, ctx, id_1, id_2, format,...)
_log_message is where the memory-saving dictionary magic described above happens: the "format" string...
Definition trace-soflogger.h:212
void trace_log_filtered(bool send_atomic, const void *log_entry, const struct tr_ctx *ctx, uint32_t lvl, uint32_t id_1, uint32_t id_2, int arg_count, va_list args)

◆ _TRACE_EVENT_MAX_ARGUMENT_COUNT

#define _TRACE_EVENT_MAX_ARGUMENT_COUNT   4

◆ _trace_event_with_ids

#define _trace_event_with_ids ( lvl,
class,
ctx,
id_1,
id_2,
format,
... )
Value:
_log_message(trace_log_filtered, false, lvl, class, ctx, id_1, id_2, format, ##__VA_ARGS__)

◆ BASE_LOG_ASSERT_FAIL_MSG

#define BASE_LOG_ASSERT_FAIL_MSG
Value:
unsupported_amount_of_params_in_trace_event\
_thrown_from_macro_BASE_LOG_in_trace_h

◆ CT_ASSERT

#define CT_ASSERT ( COND,
MESSAGE )
Value:
((void)sizeof(char[1 - 2 * !(COND)]))

◆ MTRACE_DUPLICATION_LEVEL

#define MTRACE_DUPLICATION_LEVEL   LOG_LEVEL_ERROR

◆ mtrace_printf

#define mtrace_printf ( log_level,
format_str,
... )
Value:
do { \
STATIC_ASSERT(META_COUNT_VARAGS_BEFORE_COMPILE(__VA_ARGS__) \
too_many_mtrace_printf_arguments); \
_DECLARE_LOG_ENTRY(log_level, format_str, _TRACE_INV_CLASS, \
META_COUNT_VARAGS_BEFORE_COMPILE(__VA_ARGS__)); \
mtrace_dict_entry(true, (uint32_t)&log_entry, \
META_COUNT_VARAGS_BEFORE_COMPILE(__VA_ARGS__), \
##__VA_ARGS__); \
} while (0)
#define _TRACE_INV_CLASS
This has been replaced in commits 6ce635aa82 and earlier by the DECLARE_TR_CTX, tr_ctx and component ...
Definition trace.h:129

Direct, low-level access to mbox / shared memory logging when DMA tracing is either not initialized yet or disabled or found broken for any reason.

To keep it simpler than and with minimal dependencies on the huge number of lines above, this does not check arguments at compile time. There is neither log level filtering, throttling or any other advanced feature.

◆ STATIC_ASSERT_ARG_SIZE

#define STATIC_ASSERT_ARG_SIZE ( ...)
Value:
META_MAP(1, trace_check_size_uint32, __VA_ARGS__)
#define trace_check_size_uint32(a)
Definition trace-soflogger.h:201

◆ tr_dbg

#define tr_dbg ( ctx,
fmt,
... )
Value:
_TRACE_INV_ID, _TRACE_INV_ID, fmt, ##__VA_ARGS__)
#define _TRACE_INV_ID
Default value when there is no specific pipeline, dev, dai, etc.
Definition trace.h:124
#define tracev_event_with_ids(class, ctx, id_1, id_2, format,...)
Definition trace-soflogger.h:256

◆ tr_dbg_atomic

#define tr_dbg_atomic ( ctx,
fmt,
... )
Value:
fmt, ##__VA_ARGS__)
#define tracev_event_atomic_with_ids(class, ctx, id_1, id_2, format,...)
Definition trace-soflogger.h:258

◆ tr_err

#define tr_err ( ctx,
fmt,
... )
Value:
_TRACE_INV_ID, _TRACE_INV_ID, fmt, ##__VA_ARGS__)
#define trace_error_with_ids(...)
Definition trace-soflogger.h:275

◆ tr_err_atomic

#define tr_err_atomic ( ctx,
fmt,
... )
Value:
fmt, ##__VA_ARGS__)
#define trace_error_atomic_with_ids(...)
Definition trace-soflogger.h:276

◆ tr_info

#define tr_info ( ctx,
fmt,
... )
Value:
_TRACE_INV_ID, _TRACE_INV_ID, fmt, ##__VA_ARGS__)
#define trace_event_with_ids(class, ctx, id_1, id_2, format,...)
Definition trace-soflogger.h:87

◆ tr_info_atomic

#define tr_info_atomic ( ctx,
fmt,
... )
Value:
fmt, ##__VA_ARGS__)
#define trace_event_atomic_with_ids(class, ctx, id_1, id_2, format,...)
Definition trace-soflogger.h:91

◆ tr_warn

#define tr_warn ( ctx,
fmt,
... )
Value:
_TRACE_INV_ID, _TRACE_INV_ID, fmt, ##__VA_ARGS__)
#define trace_warn_with_ids(class, ctx, id_1, id_2, format,...)
Definition trace-soflogger.h:95

◆ tr_warn_atomic

#define tr_warn_atomic ( ctx,
fmt,
... )
Value:
fmt, ##__VA_ARGS__)
#define trace_warn_atomic_with_ids(class, ctx, id_1, id_2, format,...)
Definition trace-soflogger.h:99

◆ trace_check_size_uint32

#define trace_check_size_uint32 ( a)
Value:
CT_ASSERT(sizeof(a) <= sizeof(uint32_t), "error: trace argument is bigger than a uint32_t");
#define CT_ASSERT(COND, MESSAGE)
Definition trace-soflogger.h:198

◆ trace_dev_dbg

#define trace_dev_dbg ( get_ctx_m,
get_id_m,
get_subid_m,
dev,
fmt,
... )
Value:
get_ctx_m(dev), get_id_m(dev), \
get_subid_m(dev), fmt, ##__VA_ARGS__)

Trace from a device on dbg level.

◆ trace_dev_err

#define trace_dev_err ( get_ctx_m,
get_id_m,
get_subid_m,
dev,
fmt,
... )
Value:
get_id_m(dev), get_subid_m(dev), \
fmt, ##__VA_ARGS__)

Trace from a device on err level.

Parameters
get_ctx_mMacro that can retrieve trace context from dev
get_id_mMacro that can retrieve device's id0 from the dev
get_subid_mMacro that can retrieve device's id1 from the dev
devDevice
fmtFormat followed by parameters
...Parameters

◆ trace_dev_info

#define trace_dev_info ( get_ctx_m,
get_id_m,
get_subid_m,
dev,
fmt,
... )
Value:
get_id_m(dev), get_subid_m(dev), \
fmt, ##__VA_ARGS__)

Trace from a device on info level.

◆ trace_dev_warn

#define trace_dev_warn ( get_ctx_m,
get_id_m,
get_subid_m,
dev,
fmt,
... )
Value:
get_id_m(dev), get_subid_m(dev), \
fmt, ##__VA_ARGS__)

Trace from a device on warning level.

◆ trace_error_atomic_with_ids

#define trace_error_atomic_with_ids ( ...)
Value:

◆ trace_error_with_ids

#define trace_error_with_ids ( ...)
Value:

◆ trace_event_atomic_with_ids

#define trace_event_atomic_with_ids ( class,
ctx,
id_1,
id_2,
format,
... )
Value:
_trace_event_atomic_with_ids(LOG_LEVEL_INFO, class, ctx, id_1, id_2, \
format, ##__VA_ARGS__)
#define LOG_LEVEL_INFO
Definition trace.h:23
#define _trace_event_atomic_with_ids(lvl, class, ctx, id_1, id_2, format,...)
Definition trace-soflogger.h:125

◆ trace_event_with_ids

#define trace_event_with_ids ( class,
ctx,
id_1,
id_2,
format,
... )
Value:
_trace_event_with_ids(LOG_LEVEL_INFO, class, ctx, id_1, id_2, \
format, ##__VA_ARGS__)
#define _trace_event_with_ids(lvl, class, ctx, id_1, id_2, format,...)
Definition trace-soflogger.h:122

◆ trace_point

#define trace_point ( x)
Value:
platform_trace_point(x)

◆ trace_warn_atomic_with_ids

#define trace_warn_atomic_with_ids ( class,
ctx,
id_1,
id_2,
format,
... )
Value:
ctx, id_1, id_2, \
format, ##__VA_ARGS__)
#define LOG_LEVEL_WARNING
Definition trace.h:22

◆ trace_warn_with_ids

#define trace_warn_with_ids ( class,
ctx,
id_1,
id_2,
format,
... )
Value:
_trace_event_with_ids(LOG_LEVEL_WARNING, class, ctx, id_1, id_2, \
format, ##__VA_ARGS__)

◆ tracev_event_atomic_with_ids

#define tracev_event_atomic_with_ids ( class,
ctx,
id_1,
id_2,
format,
... )
Value:
trace_unused(class, ctx, id_1, id_2, format, ##__VA_ARGS__)
#define trace_unused(class, ctx, id_1, id_2, format,...)
Definition trace.h:41

◆ tracev_event_with_ids

#define tracev_event_with_ids ( class,
ctx,
id_1,
id_2,
format,
... )
Value:
trace_unused(class, ctx, id_1, id_2, format, ##__VA_ARGS__)

Typedef Documentation

◆ log_func_t

typedef void(* log_func_t) (bool send_atomic, const void *log_entry, const struct tr_ctx *ctx, uint32_t lvl, uint32_t id_1, uint32_t id_2, int arg_count, va_list args)

Function Documentation

◆ _log_sofdict()

void _log_sofdict ( log_func_t sofdict_logf,
bool atomic,
const void * log_entry,
const struct tr_ctx * ctx,
const uint32_t lvl,
uint32_t id_1,
uint32_t id_2,
int arg_count,
... )

◆ mtrace_dict_entry()

void mtrace_dict_entry ( bool atomic_context,
uint32_t log_entry_pointer,
int n_args,
... )

Appends one SOF dictionary entry and log statement to the ring buffer implementing the 'etrace' in shared memory.

Parameters
atomic_contextTake the trace->lock if false.
log_entry_pointerdictionary index produced by the _DECLARE_LOG_ENTRY macro.
n_argsnumber of va_args

◆ mtrace_event()

void mtrace_event ( const char * complete_packet,
uint32_t length )

Posts a fully prepared log header + log entry.

◆ trace_filter_fill()

struct sof_ipc_trace_filter_elem * trace_filter_fill ( struct sof_ipc_trace_filter_elem * elem,
struct sof_ipc_trace_filter_elem * end,
struct trace_filter * filter )

◆ trace_filter_update()

int trace_filter_update ( const struct trace_filter * elem)

◆ trace_flush_dma_to_mbox()

void trace_flush_dma_to_mbox ( void )

◆ trace_get()

struct trace * trace_get ( void )
inlinestatic

◆ trace_init()

void trace_init ( struct sof * sof)

◆ trace_log_filtered()

void trace_log_filtered ( bool send_atomic,
const void * log_entry,
const struct tr_ctx * ctx,
uint32_t lvl,
uint32_t id_1,
uint32_t id_2,
int arg_count,
va_list args )

◆ trace_log_unfiltered()

void trace_log_unfiltered ( bool send_atomic,
const void * log_entry,
const struct tr_ctx * ctx,
uint32_t lvl,
uint32_t id_1,
uint32_t id_2,
int arg_count,
va_list args )

◆ trace_off()

void trace_off ( void )

◆ trace_on()

void trace_on ( void )