![]() |
reactor-c 1.0
C Runtime for Lingua Franca
|
Functions for tracing. More...
Files | |
| file | /Users/runner/work/reactor-c/reactor-c/util/tracing/influxdb.h |
| Structures and functions supporting interaction with InfluxDB. | |
| file | /Users/runner/work/reactor-c/reactor-c/trace/api/trace.h |
| API for the tracing module that records runtime events for debugging and analysis. | |
| file | /Users/runner/work/reactor-c/reactor-c/trace/api/types/trace_types.h |
| Definitions that are needed by both implementors and callers of the trace API regardless of whether tracing is enabled at compile time. | |
| file | /Users/runner/work/reactor-c/reactor-c/util/tracing/trace_util.h |
| Header file for common utilities used in converting Lingua Franca trace files into other formats. | |
Data Structures | |
| struct | influx_client_t |
| InfluxDB client. More... | |
| struct | influx_v2_client_t |
| InfluxDB v2 client. More... | |
| struct | trace_record_nodeps_t |
| Trace record without dependencies. More... | |
Macros | |
| #define | _LF_TRACE_FAILURE(trace_file) |
| Macro to use when access to trace file fails. | |
| #define | BUFFER_SIZE 1024 |
| Buffer size for reading object descriptions. | |
Typedefs | |
| typedef struct influx_client_t | influx_client_t |
| InfluxDB client. | |
| typedef struct influx_v2_client_t | influx_v2_client_t |
| InfluxDB v2 client. | |
| typedef struct object_description_t | object_description_t |
| Struct for table of pointers to a description of the object. | |
Functions | |
| int | format_line (char **buf, int *len, size_t used,...) |
| Format a line for InfluxDB. | |
| char * | get_object_description (void *reactor, int *index) |
| Get the description of the object pointed to by the specified pointer. | |
| char * | get_trigger_name (void *trigger, int *index) |
| Get the trigger name for the specified pointer. | |
| void | lf_tracing_flush () |
| Flush all in-memory trace buffers to disk without shutting tracing down. | |
| void | lf_tracing_global_init (char *process_name, char *process_names, int process_id, int max_num_local_threads) |
| Initialize the tracing module. | |
| void | lf_tracing_global_shutdown () |
| Shut down the tracing module. | |
| void | lf_tracing_register_trace_event (object_description_t description) |
| Register a kind of trace event. | |
| void | lf_tracing_set_start_time (int64_t start_time) |
| Give the tracing module access to the start time. | |
| void | lf_tracing_tracepoint (int worker, trace_record_nodeps_t *tr) |
| Submit a tracepoint from the given worker to the tracing module. | |
| const version_t * | lf_version_tracing () |
| Return a description of the compile-time properties of the current plugin. | |
| FILE * | open_file (const char *path, const char *mode) |
| Open the specified file for reading or writing. | |
| int | post_curl (influx_v2_client_t *c,...) |
| Post a line to InfluxDB via HTTP. | |
| int | post_http (influx_client_t *c,...) |
| Post a line to InfluxDB via HTTP. | |
| int | post_http_send_line (influx_client_t *c, char *buf, int len) |
| Post a line to InfluxDB via HTTP. | |
| void | print_table () |
| Print the object to description table. | |
| size_t | read_header () |
| Read header information. | |
| int | read_trace () |
| Read the trace from the trace_file and put it in the trace global variable. | |
| char * | root_name (const char *path) |
| Return the root file name from the given path. | |
| int | send_udp (influx_client_t *c,...) |
| Send a line to InfluxDB via UDP. | |
| int | send_udp_line (influx_client_t *c, char *line, int len) |
| Send a line to InfluxDB via UDP. | |
| void | usage () |
| Print a usage message. | |
Variables | |
| static const char * | trace_event_names [] |
| String description of event types. | |
Functions for tracing.
This group contains functions for tracing. Tracing is described in the Lingua Franca handbook.
| #define _LF_TRACE_FAILURE | ( | trace_file | ) |
#include <trace_util.h>
Macro to use when access to trace file fails.
| #define BUFFER_SIZE 1024 |
#include <trace_util.h>
Buffer size for reading object descriptions.
| typedef struct influx_client_t influx_client_t |
#include <influxdb.h>
InfluxDB client.
| typedef struct influx_v2_client_t influx_v2_client_t |
#include <influxdb.h>
InfluxDB v2 client.
| typedef struct object_description_t object_description_t |
#include <trace.h>
Struct for table of pointers to a description of the object.
| enum _lf_trace_object_t |
#include <trace.h>
Identifier for what is in the object table.
| enum trace_event_t |
#include <trace_types.h>
Trace event types.
If you update this, be sure to update the string representation below. Also, create a tracepoint function for each event type.
| int format_line | ( | char ** | buf, |
| int * | len, | ||
| size_t | used, | ||
| ... ) |
#include <influxdb.h>
Format a line for InfluxDB.
| buf | Returned pointer to the formatted line. |
| len | Returned length of the formatted line. |
| used | Number of bytes used in the formatted line. |
| ... | Formatting arguments. |
| char * get_object_description | ( | void * | reactor, |
| int * | index ) |
#include <trace_util.h>
Get the description of the object pointed to by the specified pointer.
For example, this can be the name of a reactor (pointer points to the self struct) or a user-defined string. If there is no such pointer in the symbol table, return NULL. If the index argument is non-null, then put the index of the entry in the table into the int pointed to or -1 if none was found.
| reactor | The pointer to to an object, e.g. a self struct. |
| index | An optional pointer into which to write the index. |
| char * get_trigger_name | ( | void * | trigger, |
| int * | index ) |
#include <trace_util.h>
Get the trigger name for the specified pointer.
If there is no such trigger, return NULL. If the index argument is non-null, then put the index of the trigger in the table into the int pointed to or -1 if none was found.
| trigger | The pointer to a trigger struct. |
| index | An optional pointer into which to write the index. |
| void lf_tracing_flush | ( | ) |
#include <trace.h>
Flush all in-memory trace buffers to disk without shutting tracing down.
Worker threads only write to disk when a per-thread buffer is full, so the records from the end of an execution otherwise remain in memory until shutdown. Call this after worker threads have joined so those remaining records are written before the process exits.
This function is optional for trace plugins. The runtime provides a weak no-op default so plugins that do not buffer records (or that predate this API) continue to link. The default .lft implementation provides a strong definition.
| void lf_tracing_global_init | ( | char * | process_name, |
| char * | process_names, | ||
| int | process_id, | ||
| int | max_num_local_threads ) |
#include <trace.h>
Initialize the tracing module.
Calling other API functions before calling this procedure is undefined behavior.
| process_name | The name of the current federate, or a placeholder if this is not a federate. |
| process_names | The names of all federates, separated by commas, or NULL if that information is not available. |
| process_id | The ID of the current federate, or -1 if this is the RTI. 0 if unfederated. |
| max_num_local_threads | An upper bound on the number of threads created by this process. |
| void lf_tracing_global_shutdown | ( | ) |
#include <trace.h>
Shut down the tracing module.
Calling other API functions after calling this procedure is undefined behavior.
| void lf_tracing_register_trace_event | ( | object_description_t | description | ) |
#include <trace.h>
Register a kind of trace event.
This should be called before tracepoints are reached.
| description | A description of some trace events which may be received in the future. This may be invoked after many tracepoints have already been recorded but should be invoked early. |
| void lf_tracing_set_start_time | ( | int64_t | start_time | ) |
#include <trace.h>
Give the tracing module access to the start time.
This may be invoked after many tracepoints have already been recorded but should be invoked early.
| void lf_tracing_tracepoint | ( | int | worker, |
| trace_record_nodeps_t * | tr ) |
#include <trace.h>
Submit a tracepoint from the given worker to the tracing module.
| const version_t * lf_version_tracing | ( | ) |
#include <trace.h>
Return a description of the compile-time properties of the current plugin.
| FILE * open_file | ( | const char * | path, |
| const char * | mode ) |
#include <trace_util.h>
Open the specified file for reading or writing.
This function records the file for closing at termination.
| path | The path to the file. |
| mode | "r" for reading and "w" for writing. |
| int post_curl | ( | influx_v2_client_t * | c, |
| ... ) |
#include <influxdb.h>
Post a line to InfluxDB via HTTP.
| c | InfluxDB v2 client. |
| ... | Formatting arguments. |
| int post_http | ( | influx_client_t * | c, |
| ... ) |
#include <influxdb.h>
Post a line to InfluxDB via HTTP.
| c | InfluxDB client. |
| ... | Formatting arguments. |
| int post_http_send_line | ( | influx_client_t * | c, |
| char * | buf, | ||
| int | len ) |
#include <influxdb.h>
Post a line to InfluxDB via HTTP.
| c | InfluxDB client. |
| buf | Pointer to the line to post. |
| len | Length of the line to post. |
| void print_table | ( | ) |
#include <trace_util.h>
Print the object to description table.
| size_t read_header | ( | ) |
#include <trace_util.h>
Read header information.
| int read_trace | ( | ) |
#include <trace_util.h>
Read the trace from the trace_file and put it in the trace global variable.
| char * root_name | ( | const char * | path | ) |
#include <trace_util.h>
Return the root file name from the given path.
Given a path to a file, this function returns a dynamically allocated string (which you must free) that points to the root filename without the preceding path and without the file extension.
| path | The path including the full filename. |
| int send_udp | ( | influx_client_t * | c, |
| ... ) |
#include <influxdb.h>
Send a line to InfluxDB via UDP.
| c | InfluxDB client. |
| ... | Formatting arguments. |
| int send_udp_line | ( | influx_client_t * | c, |
| char * | line, | ||
| int | len ) |
#include <influxdb.h>
Send a line to InfluxDB via UDP.
| c | InfluxDB client. |
| line | Pointer to the line to send. |
| len | Length of the line to send. |
| void usage | ( | ) |
#include <trace_util.h>
Print a usage message.
|
static |
#include <trace_types.h>
String description of event types.