Submodules | |
| pw_trace_tokenized | |
Macros | |
| #define | PW_TRACE_TYPE_INSTANT 1 |
| #define | PW_TRACE_TYPE_INSTANT_GROUP 1 |
| #define | PW_TRACE_TYPE_DURATION_START 1 |
| #define | PW_TRACE_TYPE_DURATION_END 1 |
| #define | PW_TRACE_TYPE_DURATION_GROUP_START 1 |
| #define | PW_TRACE_TYPE_DURATION_GROUP_END 1 |
| #define | PW_TRACE_TYPE_ASYNC_START 1 |
| #define | PW_TRACE_TYPE_ASYNC_INSTANT 1 |
| #define | PW_TRACE_TYPE_ASYNC_END 1 |
| #define | PW_TRACE(event_type, flags, label, group, trace_id) _pw_trace_Ignored(event_type, flags, label, group, trace_id) |
| #define | PW_TRACE_DATA( event_type, flags, label, group, trace_id, type, data, size) |
| #define | PW_TRACE_FLAGS_DEFAULT 0 |
| #define | PW_TRACE_TRACE_ID_DEFAULT 0 |
| #define | PW_TRACE_GROUP_LABEL_DEFAULT "" |
| #define | PW_TRACE_HAS_TRACE_ID(TRACE_TYPE) |
| #define | PW_TRACE_HAS_GROUP_LABEL(TRACE_TYPE) (false) |
| #define | PW_TRACE_FUNCTION_LABEL __PRETTY_FUNCTION__ |
| #define | PW_TRACE_ENABLE 1 |
| #define | PW_TRACE_MODULE_NAME "" |
| #define | PW_TRACE_FLAGS PW_TRACE_FLAGS_DEFAULT |
| #define | PW_TRACE_INSTANT(...) PW_TRACE_INSTANT_FLAG(PW_TRACE_FLAGS, __VA_ARGS__) |
| #define | PW_TRACE_INSTANT_FLAG(...) PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_INSTANT_ARGS, __VA_ARGS__) |
| #define | PW_TRACE_INSTANT_DATA(...) PW_TRACE_INSTANT_DATA_FLAG(PW_TRACE_FLAGS, __VA_ARGS__) |
| #define | PW_TRACE_INSTANT_DATA_FLAG(...) PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_INSTANT_DATA_ARGS, __VA_ARGS__) |
| #define | PW_TRACE_START(...) PW_TRACE_START_FLAG(PW_TRACE_FLAGS, __VA_ARGS__) |
| #define | PW_TRACE_START_FLAG(...) PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_START_ARGS, __VA_ARGS__) |
| #define | PW_TRACE_START_DATA(...) PW_TRACE_START_DATA_FLAG(PW_TRACE_FLAGS, __VA_ARGS__) |
| #define | PW_TRACE_START_DATA_FLAG(...) PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_START_DATA_ARGS, __VA_ARGS__) |
| #define | PW_TRACE_END(...) PW_TRACE_END_FLAG(PW_TRACE_FLAGS, __VA_ARGS__) |
| #define | PW_TRACE_END_FLAG(...) PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_END_ARGS, __VA_ARGS__) |
| #define | PW_TRACE_END_DATA(...) PW_TRACE_END_DATA_FLAG(PW_TRACE_FLAGS, __VA_ARGS__) |
| #define | PW_TRACE_END_DATA_FLAG(...) PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_END_DATA_ARGS, __VA_ARGS__) |
| #define | PW_TRACE_SCOPE(...) PW_TRACE_SCOPE_FLAG(PW_TRACE_FLAGS, __VA_ARGS__) |
| #define | PW_TRACE_SCOPE_FLAG(...) PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_SCOPE_ARGS, __VA_ARGS__) |
| #define | PW_TRACE_FUNCTION(...) PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_FUNCTION_ARGS, __VA_ARGS__) |
| #define | PW_TRACE_FUNCTION_FLAG(...) PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_FUNCTION_FLAGS_ARGS, __VA_ARGS__) |
| #define PW_TRACE | ( | event_type, | |
| flags, | |||
| label, | |||
| group, | |||
| trace_id | |||
| ) | _pw_trace_Ignored(event_type, flags, label, group, trace_id) |
Records a trace event. Every pw_trace backend must implement this macro. The facade invokes it from each of the trace event macros, such as PW_TRACE_INSTANT, PW_TRACE_START, and PW_TRACE_END.
| [in] | event_type | The value of the PW_TRACE_TYPE_* macro that the backend defined for this trace type, such as PW_TRACE_TYPE_INSTANT. |
| [in] | flags | The flags value for the event. |
| [in] | label | A string literal which describes the trace. |
| [in] | group | The group label: a string literal which groups this trace with others in the same module and group, or PW_TRACE_GROUP_LABEL_DEFAULT. |
| [in] | trace_id | A runtime uint32_t which groups this trace with others with the same module, group, and trace ID, or PW_TRACE_TRACE_ID_DEFAULT. |
| #define PW_TRACE_DATA | ( | event_type, | |
| flags, | |||
| label, | |||
| group, | |||
| trace_id, | |||
| type, | |||
| data, | |||
| size | |||
| ) |
Records a trace event with an attached user-supplied data buffer. The facade invokes it from each of the *_DATA trace event macros, such as PW_TRACE_INSTANT_DATA. Implementing this macro is optional; if the backend does not define it, all data trace events are removed.
| [in] | event_type | The value of the PW_TRACE_TYPE_* macro that the backend defined for this trace type, such as PW_TRACE_TYPE_INSTANT. |
| [in] | flags | The flags value for the event. |
| [in] | label | A string literal which describes the trace. |
| [in] | group | The group label: a string literal which groups this trace with others in the same module and group, or PW_TRACE_GROUP_LABEL_DEFAULT. |
| [in] | trace_id | A runtime uint32_t which groups this trace with others with the same module, group, and trace ID, or PW_TRACE_TRACE_ID_DEFAULT. |
| [in] | type | The data format string: a string which is used by the decoder to identify the data. |
| [in] | data | A pointer to a buffer of arbitrary caller-provided data (const void*). |
| [in] | size | The size of the data (size_t). |
| #define PW_TRACE_ENABLE 1 |
Controls whether tracing is enabled in the current file. A value of 0 causes traces to be disabled. A non-zero value enables traces.
While tracing defaults to enabled, it is best practice to define PW_TRACE_ENABLE explicitly in files that use tracing, as the default may change in the future. A good pattern is to have a module-level configuration parameter for enabling tracing and to define PW_TRACE_ENABLE in terms of that at the top of each of the module's files:
Specific trace points (or sets of points) can also be enabled or disabled by redefining PW_TRACE_ENABLE around them:
| #define PW_TRACE_END | ( | ... | ) | PW_TRACE_END_FLAG(PW_TRACE_FLAGS, __VA_ARGS__) |
Ends tracing a duration event. Must be paired with a PW_TRACE_START (or PW_TRACE_START_DATA) with the same module, label, group_label, and trace_id.
Overloads:
Arguments:
label - A string literal which describes the trace.group_label (optional) - A string literal which groups this trace with others in the same module and group.trace_id (optional) - A runtime uint32_t which groups this trace with others with the same module, group, and trace ID. Every trace with a trace_id must also have a group_label.Example:
| #define PW_TRACE_END_DATA | ( | ... | ) | PW_TRACE_END_DATA_FLAG(PW_TRACE_FLAGS, __VA_ARGS__) |
Same as PW_TRACE_END, but appends a user-supplied data buffer to the trace event.
Overloads:
PW_TRACE_END_DATA(label, data_format_string, data, size)PW_TRACE_END_DATA(label, group_label, data_format_string, data, size)PW_TRACE_END_DATA(label, group_label, trace_id, data_format_string, data,
size)Arguments:
data_format_string - A string which is used by the decoder to identify the data. This could for example be printf-style tokens, a Python struct packed format string, or a custom label recognized by the decoder.data - A pointer to a buffer of arbitrary caller-provided data (const void*).size - The size of the data (size_t).| #define PW_TRACE_END_DATA_FLAG | ( | ... | ) | PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_END_DATA_ARGS, __VA_ARGS__) |
Same as PW_TRACE_END_DATA, but uses the provided flag value instead of PW_TRACE_FLAGS. The flag goes at the start; the group_label and trace_id arguments are still optional.
Overloads:
| #define PW_TRACE_END_FLAG | ( | ... | ) | PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_END_ARGS, __VA_ARGS__) |
Same as PW_TRACE_END, but uses the provided flag value instead of PW_TRACE_FLAGS. The flag goes at the start; the group_label and trace_id arguments are still optional.
Overloads:
| #define PW_TRACE_FLAGS PW_TRACE_FLAGS_DEFAULT |
The flags value used by the trace macros that don't take an explicit flag argument, such as PW_TRACE_INSTANT. Defaults to PW_TRACE_FLAGS_DEFAULT.
| #define PW_TRACE_FLAGS_DEFAULT 0 |
The default flags value for trace events when no flags are provided. The backend can define this macro to change the default. Defaults to 0.
| #define PW_TRACE_FUNCTION | ( | ... | ) | PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_FUNCTION_ARGS, __VA_ARGS__) |
Traces the duration of the current function. This is the same as PW_TRACE_SCOPE, but uses the function name (PW_TRACE_FUNCTION_LABEL) as the label. This is the only trace macro which does not require a label. C++ only.
Overloads:
Arguments:
group_label (optional) - A string literal which groups this trace with others in the same module and group.trace_id (optional) - A runtime uint32_t which groups this trace with others with the same module, group, and trace ID. Every trace with a trace_id must also have a group_label.Example:
Which can be visualized as:
| #define PW_TRACE_FUNCTION_FLAG | ( | ... | ) | PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_FUNCTION_FLAGS_ARGS, __VA_ARGS__) |
Same as PW_TRACE_FUNCTION, but uses the provided flag value instead of PW_TRACE_FLAGS. The flag goes at the start; the group_label and trace_id arguments are still optional. C++ only.
Overloads:
| #define PW_TRACE_FUNCTION_LABEL __PRETTY_FUNCTION__ |
The label used for PW_TRACE_FUNCTION trace events. The backend can override this macro. Defaults to __PRETTY_FUNCTION__.
| #define PW_TRACE_GROUP_LABEL_DEFAULT "" |
The default group_label value for trace events when no group label is provided. The backend can define this macro to change the default. Defaults to an empty string.
| #define PW_TRACE_HAS_GROUP_LABEL | ( | TRACE_TYPE | ) | (false) |
Evaluates to true if trace events of the given TRACE_TYPE contain a group_label. The backend can override this macro. Defaults to false.
| [in] | TRACE_TYPE | The PW_TRACE_TYPE_* macro value to check. |
| #define PW_TRACE_HAS_TRACE_ID | ( | TRACE_TYPE | ) |
Evaluates to true if trace events of the given TRACE_TYPE contain a trace_id. The backend can override this macro.
| [in] | TRACE_TYPE | The PW_TRACE_TYPE_* macro value to check. |
| #define PW_TRACE_INSTANT | ( | ... | ) | PW_TRACE_INSTANT_FLAG(PW_TRACE_FLAGS, __VA_ARGS__) |
Traces an instantaneous event, which has no duration.
Overloads:
PW_TRACE_INSTANT(label)PW_TRACE_INSTANT(label, group_label)PW_TRACE_INSTANT(label, group_label, trace_id)Arguments:
label - A string literal which describes the trace.group_label (optional) - A string literal which groups this trace with others in the same module and group.trace_id (optional) - A runtime uint32_t which groups this trace with others with the same module, group, and trace ID. Every trace with a trace_id must also have a group_label.Example:
| #define PW_TRACE_INSTANT_DATA | ( | ... | ) | PW_TRACE_INSTANT_DATA_FLAG(PW_TRACE_FLAGS, __VA_ARGS__) |
Same as PW_TRACE_INSTANT, but appends a user-supplied data buffer to the trace event.
Overloads:
PW_TRACE_INSTANT_DATA(label, data_format_string, data, size)PW_TRACE_INSTANT_DATA(label, group_label, data_format_string, data,
size)PW_TRACE_INSTANT_DATA(label, group_label, trace_id, data_format_string,
data, size)Arguments:
data_format_string - A string which is used by the decoder to identify the data. This could for example be printf-style tokens, a Python struct packed format string, or a custom label recognized by the decoder.data - A pointer to a buffer of arbitrary caller-provided data (const void*).size - The size of the data (size_t). | #define PW_TRACE_INSTANT_DATA_FLAG | ( | ... | ) | PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_INSTANT_DATA_ARGS, __VA_ARGS__) |
Same as PW_TRACE_INSTANT_DATA, but uses the provided flag value instead of PW_TRACE_FLAGS. The flag goes at the start; the group_label and trace_id arguments are still optional.
Overloads:
| #define PW_TRACE_INSTANT_FLAG | ( | ... | ) | PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_INSTANT_ARGS, __VA_ARGS__) |
Same as PW_TRACE_INSTANT, but uses the provided flag value instead of PW_TRACE_FLAGS. The flag goes at the start; the group_label and trace_id arguments are still optional.
Overloads:
| #define PW_TRACE_MODULE_NAME "" |
The module name that the backend associates with the trace events in the current file. Traces can be grouped into modules, similar to logging, by defining this macro before including pw_trace/trace.h:
Defaults to an empty string.
| #define PW_TRACE_SCOPE | ( | ... | ) | PW_TRACE_SCOPE_FLAG(PW_TRACE_FLAGS, __VA_ARGS__) |
Traces the duration of the current scope. Emits a start event where the macro appears in code and an end event when the enclosing scope exits. This provides a convenient method of tracing functions or loops. C++ only.
Overloads:
PW_TRACE_SCOPE(label)PW_TRACE_SCOPE(label, group_label)PW_TRACE_SCOPE(label, group_label, trace_id)Arguments:
label - A string literal which describes the trace.group_label (optional) - A string literal which groups this trace with others in the same module and group.trace_id (optional) - A runtime uint32_t which groups this trace with others with the same module, group, and trace ID. Every trace with a trace_id must also have a group_label.Example:
Which can be visualized as:
| #define PW_TRACE_SCOPE_FLAG | ( | ... | ) | PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_SCOPE_ARGS, __VA_ARGS__) |
Same as PW_TRACE_SCOPE, but uses the provided flag value instead of PW_TRACE_FLAGS. The flag goes at the start; the group_label and trace_id arguments are still optional. C++ only.
Overloads:
| #define PW_TRACE_START | ( | ... | ) | PW_TRACE_START_FLAG(PW_TRACE_FLAGS, __VA_ARGS__) |
Starts tracing a duration event. Must be paired with a PW_TRACE_END (or PW_TRACE_END_DATA) with the same module, label, group_label, and trace_id.
Overloads:
PW_TRACE_START(label)PW_TRACE_START(label, group_label)PW_TRACE_START(label, group_label, trace_id)Arguments:
label - A string literal which describes the trace.group_label (optional) - A string literal which groups this trace with others in the same module and group.trace_id (optional) - A runtime uint32_t which groups this trace with others with the same module, group, and trace ID. Every trace with a trace_id must also have a group_label.Example:
| #define PW_TRACE_START_DATA | ( | ... | ) | PW_TRACE_START_DATA_FLAG(PW_TRACE_FLAGS, __VA_ARGS__) |
Same as PW_TRACE_START, but appends a user-supplied data buffer to the trace event.
Overloads:
PW_TRACE_START_DATA(label, data_format_string, data, size)PW_TRACE_START_DATA(label, group_label, data_format_string, data, size)PW_TRACE_START_DATA(label, group_label, trace_id, data_format_string,
data, size)Arguments:
data_format_string - A string which is used by the decoder to identify the data. This could for example be printf-style tokens, a Python struct packed format string, or a custom label recognized by the decoder.data - A pointer to a buffer of arbitrary caller-provided data (const void*).size - The size of the data (size_t).| #define PW_TRACE_START_DATA_FLAG | ( | ... | ) | PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_START_DATA_ARGS, __VA_ARGS__) |
Same as PW_TRACE_START_DATA, but uses the provided flag value instead of PW_TRACE_FLAGS. The flag goes at the start; the group_label and trace_id arguments are still optional.
Overloads:
| #define PW_TRACE_START_FLAG | ( | ... | ) | PW_DELEGATE_BY_ARG_COUNT(_PW_TRACE_START_ARGS, __VA_ARGS__) |
Same as PW_TRACE_START, but uses the provided flag value instead of PW_TRACE_FLAGS. The flag goes at the start; the group_label and trace_id arguments are still optional.
Overloads:
| #define PW_TRACE_TRACE_ID_DEFAULT 0 |
The default trace_id value for trace events when no trace ID is provided. The backend can define this macro to change the default. Defaults to 0.
| #define PW_TRACE_TYPE_ASYNC_END 1 |
Enables end trace events with a label, group, and trace ID. The backend must define this macro to enable this trace type; if left undefined, traces of this type are removed. The macro's value is passed to PW_TRACE and PW_TRACE_DATA as the event_type argument.
| #define PW_TRACE_TYPE_ASYNC_INSTANT 1 |
Enables instant trace events with a label, group, and trace ID. The backend must define this macro to enable this trace type; if left undefined, traces of this type are removed. The macro's value is passed to PW_TRACE and PW_TRACE_DATA as the event_type argument.
| #define PW_TRACE_TYPE_ASYNC_START 1 |
Enables start trace events with a label, group, and trace ID. The backend must define this macro to enable this trace type; if left undefined, traces of this type are removed. The macro's value is passed to PW_TRACE and PW_TRACE_DATA as the event_type argument.
| #define PW_TRACE_TYPE_DURATION_END 1 |
Enables end trace events with only a label. The backend must define this macro to enable this trace type; if left undefined, traces of this type are removed. The macro's value is passed to PW_TRACE and PW_TRACE_DATA as the event_type argument.
| #define PW_TRACE_TYPE_DURATION_GROUP_END 1 |
Enables end trace events with a label and a group. The backend must define this macro to enable this trace type; if left undefined, traces of this type are removed. The macro's value is passed to PW_TRACE and PW_TRACE_DATA as the event_type argument.
| #define PW_TRACE_TYPE_DURATION_GROUP_START 1 |
Enables start trace events with a label and a group. The backend must define this macro to enable this trace type; if left undefined, traces of this type are removed. The macro's value is passed to PW_TRACE and PW_TRACE_DATA as the event_type argument.
| #define PW_TRACE_TYPE_DURATION_START 1 |
Enables start trace events with only a label. The backend must define this macro to enable this trace type; if left undefined, traces of this type are removed. The macro's value is passed to PW_TRACE and PW_TRACE_DATA as the event_type argument.
| #define PW_TRACE_TYPE_INSTANT 1 |
Enables instant trace events with only a label. The backend must define this macro to enable this trace type; if left undefined, traces of this type are removed. The macro's value is passed to PW_TRACE and PW_TRACE_DATA as the event_type argument.
| #define PW_TRACE_TYPE_INSTANT_GROUP 1 |
Enables instant trace events with a label and a group. The backend must define this macro to enable this trace type; if left undefined, traces of this type are removed. The macro's value is passed to PW_TRACE and PW_TRACE_DATA as the event_type argument.