ROOT-Sim core  3.0.0-rc.2
A General-Purpose Multi-threaded Parallel/Distributed Simulation Library
common.h
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include <arch/timer.h>
12 #include <lp/lp.h>
13 #include <lp/msg.h>
14 #include <log/log.h>
15 #include <log/stats.h>
16 
17 static inline void common_msg_process(const struct lp_ctx *lp, const struct lp_msg *msg)
18 {
20  global_config.dispatcher(msg->dest, msg->dest_t, msg->m_type, msg->pl, msg->pl_size, lp->state_pointer);
23 }
struct simulation_configuration global_config
The global configuration of the simulation, passed by the model.
Definition: init.c:27
Logging library.
LP construction functions.
Message management functions.
void stats_take(enum stats_thread_type this_stat, uint_fast64_t c)
Sum a sample to a statistics value.
Definition: stats.c:328
Statistics module.
@ STATS_MSG_PROCESSED_TIME
The time spent inside the model dispatcher function.
Definition: stats.h:39
@ STATS_MSG_PROCESSED
The count of processed messages.
Definition: stats.h:37
A complete LP context.
Definition: lp.h:22
void * state_pointer
The pointer set by the model with the SetState() API call.
Definition: lp.h:28
A model simulation message.
Definition: msg.h:59
uint32_t m_type
The message type, a user controlled field.
Definition: msg.h:81
unsigned char pl[MSG_PAYLOAD_BASE_SIZE]
The initial part of the payload.
Definition: msg.h:85
simtime_t dest_t
The intended destination logical time of this message.
Definition: msg.h:65
lp_id_t dest
The id of the recipient LP.
Definition: msg.h:63
uint32_t pl_size
The message payload size.
Definition: msg.h:83
ProcessEvent_t dispatcher
Function pointer to the dispatching function.
Definition: ROOT-Sim.h:234
Timers.
static timer_uint timer_hr_value(timer_uint start)
Compute a time interval measure using a previous timer_uint value.
Definition: timer.h:114
uint_fast64_t timer_uint
Definition: timer.h:19
static timer_uint timer_hr_new(void)
Start a high resolution, CPU dependent time interval measure.
Definition: timer.h:102