#include <common/xroad_common_types.h>#include <common/xroad_string.h>#include <common/xroad_base_writer.h>#include <tracing/xroad_tracing_types.h>#include <tracing/detail/xroad_tracing_impl.h>#include <tracing/detail/xroad_tracing_sdk.h>
Go to the source code of this file.
Classes | |
| struct | xroad_traces_ctl_param_s |
| Parameters structure for opening trace series controller. More... | |
Macros | |
| #define | XROAD_LOGGER_INCLUDED |
| #define | xroad_trace_struct_decl(sname, ...) _xroad_trace_struct_decl(sname, __VA_ARGS__) |
| #define | xroad_traces_writer_decl(traces_type, rec_type) |
| #define | xroad_trace_write_rec(traces_writer_var, ...) |
Macro for writing record into trace stream (returns the result of xroad_traces_writer_write_record). More... | |
| #define | xroad_traces_writer_init(ctl, traces_writer_var) xroad_traces_ctl_init_writer(ctl, &traces_writer_var.stream) |
| Init macro for a trace stream variable. | |
| #define | xroad_trace_struct_num_fields(sname) xroad_trace_struct_get_num_fields(xroad_trace_struct_fields(sname)) |
Helper macro to obtain the number of fields in a structure sname. | |
Typedefs | |
| typedef struct xroad_tracing_s | xroad_tracing_t |
| Tracing subsystem. It's in use only for persisting traces. | |
| typedef struct xroad_traces_ctl_param_s | xroad_traces_ctl_param_t |
| Parameters structure for opening trace series controller. | |
| typedef struct xroad_traces_ctl_s | xroad_traces_ctl_t |
| Type of trace series controller (representing single record type and one file at a time) control structure. | |
Functions | |
| xroad_traces_ctl_t * | xroad_traces_ctl_open (xroad_tracing_t *tracing, const xroad_traces_ctl_param_t *params) |
| Open trace series controller. Consider using xroad_node_trace_init_writer() instead of this function. | |
| void | xroad_traces_ctl_close (xroad_traces_ctl_t *stream) |
| Close trace series controller. | |
| bool | xroad_traces_ctl_write_record (xroad_traces_ctl_t *ctl, const void *rec_data, size_t rec_size) |
| void | xroad_traces_ctl_init_writer (xroad_traces_ctl_t *ctl, xroad_trace_stream_t *writer) |
| Init faster writer for the traces series. | |
| void | xroad_traces_writer_stub_init (xroad_trace_stream_t *writer) |
| Init writer stub. | |
| XROAD_TRACE_SDK_NONINLINE bool | xroad_traces_writer_write_record (xroad_trace_stream_t *writer, const void *rec_data, size_t rec_size) |
| Write record to the traces via writer. | |
| XROAD_TRACE_SDK_NONINLINE bool | xroad_traces_writer_is_enabled (xroad_trace_stream_t *writer) |
| Check whether tracing through the writer is enabled (to skip tracing-specific logic if tracing is disabled) | |
| unsigned | xroad_trace_struct_get_num_fields (const xroad_tracing_field_descr_t descr[]) |
| Helper method to find number fields in the array of fields description (by finding the first empty description) | |
There're a few steps required to use tracing subsystem:
xroad_trace_struct_decl() macroxroad_traces_writer_decl() macroxroad_node_trace_init_writer() macroxroad_node_get_epoll_timestamps() to get timestamps of incoming events.xroad_trace_write_rec() macroxroad_node_trace_close() macro. This is not required if the node is going to be destroyed. | #define xroad_trace_struct_decl | ( | sname, | |
| ... | |||
| ) | _xroad_trace_struct_decl(sname, __VA_ARGS__) |
Macro to declare a structure with metainfo available via <type>_get_field_descr() function.
Example: xroad_trace_struct_decl(test_struct_t (int, fld_i), (long, fld_l) ); This macro will declare a structure test_struct_t with two fields: fld_i of type int and fld_l of type long. It also declares a function test_struct_t_get_field_descr() that returns an array of field descriptors for the structure.
| #define xroad_trace_write_rec | ( | traces_writer_var, | |
| ... | |||
| ) |
Macro for writing record into trace stream (returns the result of xroad_traces_writer_write_record).
| #define xroad_traces_writer_decl | ( | traces_type, | |
| rec_type | |||
| ) |
Declare a type of trace series controller for specific record type. It's not a real union. Instead it encodes information about record type for compile time.
Note that the stream must be unique
| bool xroad_traces_ctl_write_record | ( | xroad_traces_ctl_t * | ctl, |
| const void * | rec_data, | ||
| size_t | rec_size | ||
| ) |
Write record to the trace series controller (relatively slow, see caution)
Don't mix it with xroad_traces_writer_write_record() or xroad_trace_write_rec(). It temporarily creates a traces stream object and basically invalidates any other stream object.