reactor-c 1.0
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
tracepoint.h File Reference

Definitions of tracepoint functions for use with the C code generator and any other code generator that uses the C infrastructure (such as the Python code generator). More...

#include "lf_types.h"
#include <stdio.h>
#include "net_common.h"
#include "trace_types.h"
#include "trace.h"

Go to the source code of this file.

Data Structures

struct  trace_record_t
 A trace record that gets written in binary to the trace file in the default implementation. More...

Macros

#define tracepoint_reaction_deadline_missed(env, reaction, worker)
 Trace the occurrence of a deadline miss.
#define tracepoint_reaction_ends(env, reaction, worker)
 Trace the end of a reaction execution.
#define tracepoint_reaction_starts(env, reaction, worker)
 Trace the start of a reaction execution.
#define tracepoint_scheduler_advancing_time_ends(env)
 Trace the end of the scheduler waiting for logical time to advance or an event to appear on the event queue.
#define tracepoint_scheduler_advancing_time_starts(env)
 Trace the start of the scheduler waiting for logical time to advance or an event to appear on the event queue.
#define tracepoint_worker_wait_ends(env, worker)
 Trace the end of a worker waiting for something to change on the event or reaction queue.
#define tracepoint_worker_wait_starts(env, worker)
 Trace the start of a worker waiting for something to change on the reaction queue.

Typedefs

typedef INTERNAL struct trace_record_t trace_record_t
 A trace record that gets written in binary to the trace file in the default implementation.

Functions

int _lf_register_trace_event (void *pointer1, void *pointer2, _lf_trace_object_t type, char *description)
 Register a trace object.
void call_tracepoint (int event_type, void *reactor, tag_t tag, int worker, int src_id, int dst_id, instant_t *physical_time, trigger_t *trigger, interval_t extra_delay)
 Pass the provided info to the tracing module.
void lf_tracing_check_version ()
 Check if the tracing library is compatible with the current version of the runtime.
int register_user_trace_event (void *self, char *description)
 Register a user trace event.
void tracepoint_federate_from_federate (trace_event_t event_type, int fed_id, int partner_id, tag_t *tag)
 Trace federate receiving a message from another federate.
void tracepoint_federate_from_rti (trace_event_t event_type, int fed_id, tag_t *tag)
 Trace federate receiving a message from the RTI.
void tracepoint_federate_to_federate (trace_event_t event_type, int fed_id, int partner_id, tag_t *tag)
 Trace federate sending a message to another federate.
void tracepoint_federate_to_rti (trace_event_t event_type, int fed_id, tag_t *tag)
 Trace federate sending a message to the RTI.
void tracepoint_rti_from_federate (trace_event_t event_type, int fed_id, tag_t *tag)
 Trace RTI receiving a message from a federate.
void tracepoint_rti_to_federate (trace_event_t event_type, int fed_id, tag_t *tag)
 Trace RTI sending a message to a federate.
void tracepoint_schedule (environment_t *env, trigger_t *trigger, interval_t extra_delay)
 Trace a call to schedule.
void tracepoint_user_event (void *self, char *description)
 Trace a user-defined event.
void tracepoint_user_value (void *self, char *description, long long value)
 Trace a user-defined event with a value.

Detailed Description

Definitions of tracepoint functions for use with the C code generator and any other code generator that uses the C infrastructure (such as the Python code generator).

Author
Edward A. Lee
Peter Donovan

See: https://www.lf-lang.org/docs/handbook/tracing?target=c

The trace file is named trace.lft and is a binary file with the following format:

Header:

  • instant_t: The start time. This is both the starting physical time and the starting logical time.
  • int: Size N of the table mapping pointers to descriptions. This is followed by N records each of which has:
  • A pointer value (the key).
  • A null-terminated string (the description).

Traces: A sequence of traces, each of which begins with an int giving the length of the trace followed by binary representations of the trace_record struct written using fwrite().