diff --git a/core/reactor.c b/core/reactor.c index abc4f41d1..6e2fd24a1 100644 --- a/core/reactor.c +++ b/core/reactor.c @@ -164,6 +164,7 @@ int _lf_do_step(environment_t* env) { // Deadline violation has occurred. violation = true; // Invoke the local handler, if there is one. + tracepoint_reaction_starts(env, reaction, 0); reaction_function_t handler = reaction->deadline_violation_handler; if (handler != NULL) { (*handler)(reaction->self); @@ -171,6 +172,7 @@ int _lf_do_step(environment_t* env) { // triggered reactions into the queue. schedule_output_reactions(env, reaction, 0); } + tracepoint_reaction_ends(env, reaction, 0); } } diff --git a/core/reactor_common.c b/core/reactor_common.c index 26a489bec..83922735e 100644 --- a/core/reactor_common.c +++ b/core/reactor_common.c @@ -824,6 +824,7 @@ void schedule_output_reactions(environment_t* env, reaction_t* reaction, int wor violation = true; // Invoke the local handler, if there is one. reaction_function_t handler = downstream_to_execute_now->deadline_violation_handler; + tracepoint_reaction_starts(env, downstream_to_execute_now, worker); if (handler != NULL) { // Assume the mutex is still not held. (*handler)(downstream_to_execute_now->self); @@ -832,6 +833,7 @@ void schedule_output_reactions(environment_t* env, reaction_t* reaction, int wor // triggered reactions into the queue or execute them directly if possible. schedule_output_reactions(env, downstream_to_execute_now, worker); } + tracepoint_reaction_ends(env, downstream_to_execute_now, worker); } } if (!violation) { diff --git a/core/threaded/reactor_threaded.c b/core/threaded/reactor_threaded.c index 14d84fd14..93dede985 100644 --- a/core/threaded/reactor_threaded.c +++ b/core/threaded/reactor_threaded.c @@ -729,6 +729,7 @@ bool _lf_worker_handle_deadline_violation_for_reaction(environment_t* env, int w tracepoint_reaction_deadline_missed(env, reaction, worker_number); violation_occurred = true; // Invoke the local handler, if there is one. + tracepoint_reaction_starts(env, reaction, worker_number); reaction_function_t handler = reaction->deadline_violation_handler; if (handler != NULL) { LF_PRINT_LOG("Worker %d: Deadline violation. Invoking deadline handler.", worker_number); @@ -739,6 +740,7 @@ bool _lf_worker_handle_deadline_violation_for_reaction(environment_t* env, int w schedule_output_reactions(env, reaction, worker_number); // Remove the reaction from the executing queue. } + tracepoint_reaction_ends(env, reaction, worker_number); } } return violation_occurred; diff --git a/include/core/tracepoint.h b/include/core/tracepoint.h index cfa1fb956..4a8a5bc79 100644 --- a/include/core/tracepoint.h +++ b/include/core/tracepoint.h @@ -103,7 +103,8 @@ int register_user_trace_event(void* self, char* description); * @param worker The thread number of the worker thread or 0 for single-threaded execution. */ #define tracepoint_reaction_starts(env, reaction, worker) \ - call_tracepoint(reaction_starts, reaction->self, env->current_tag, worker, worker, reaction->number, NULL, NULL, 0) + call_tracepoint(reaction_starts, reaction->self, env->current_tag, worker, worker, reaction->number, NULL, NULL, \ + reaction->deadline) /** * Trace the end of a reaction execution. @@ -112,7 +113,8 @@ int register_user_trace_event(void* self, char* description); * @param worker The thread number of the worker thread or 0 for single-threaded execution. */ #define tracepoint_reaction_ends(env, reaction, worker) \ - call_tracepoint(reaction_ends, reaction->self, env->current_tag, worker, worker, reaction->number, NULL, NULL, 0) + call_tracepoint(reaction_ends, reaction->self, env->current_tag, worker, worker, reaction->number, NULL, NULL, \ + reaction->deadline) /** * Trace a call to schedule.