 |
The ROme OpTimistic Simulator
3.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
|
Go to the documentation of this file.
26 #if LOG_DEBUG >= LOG_LEVEL
40 #if LOG_DEBUG >= LOG_LEVEL
45 void serial_model_init(
void)
71 for (uint64_t i = 0; i <
n_lps; ++i) {
74 #if LOG_DEBUG >= LOG_LEVEL
86 for (uint64_t i = 0; i <
n_lps; ++i) {
95 msg_allocator_free(array_get_at(queue, i));
102 msg_allocator_fini();
112 uint64_t to_terminate =
n_lps;
114 while (
likely(!heap_is_empty(queue))) {
115 const struct lp_msg *cur_msg = heap_min(queue);
119 #if LOG_DEBUG >= LOG_LEVEL
124 "LP %u got two consecutive events with same timestamp %lf",
130 current_evt_time = cur_msg->
dest_t;
133 stats_time_start(STATS_MSG_PROCESSED);
144 stats_time_take(STATS_MSG_PROCESSED);
150 to_terminate += 1 - ((int)can_end * 2);
153 stats_on_gvt(cur_msg->
dest_t);
159 stats_on_gvt(cur_msg->
dest_t);
173 unsigned event_type,
const void *payload,
unsigned payload_size)
175 #if LOG_DEBUG >= LOG_LEVEL
180 struct lp_msg *msg = msg_allocator_pack(
181 receiver, timestamp, event_type, payload, payload_size);
209 struct lib_ctx *lib_ctx_get(
void)
void stats_init(void)
Initializes the stats subsystem in the current thread.
double simtime_t
The type used to represent logical time in the simulation.
#define heap_fini(self)
Finalizes an heap.
Model library main header.
#define LOG_DEBUG
The logging level reserved to useful debug messages.
static struct s_lp_ctx * s_current_lp
The context of the currently processed LP.
uint_fast32_t m_type
The message type, a user controlled field.
static struct s_lp_ctx * s_lps
The array of all the simulation LP contexts.
bool terminating
The last evaluation of the termination predicate for this LP.
lp_id_t n_lps
The total number of LPs in the simulation.
simtime_t last_evt_time
The logical time of the last processed event by this LP.
static binary_heap(struct lp_msg *)
The messages queue of the serial runtime.
void * mm_alloc(size_t mem_size)
A version of the stdlib malloc() used internally.
simtime_t termination_time
The target termination logical time.
void stats_global_fini(void)
Finalizes the stats subsystem in the node.
A model simulation message.
unsigned gvt_period
The gvt period expressed in microseconds.
void ProcessEvent(lp_id_t me, simtime_t now, unsigned event_type, const void *content, unsigned size, void *state)
The total number of threads running in the node.
Memory management functions for messages.
Message management functions.
lp_id_t dest
The id of the recipient LP.
void serial_simulation(void)
Handles a full serial simulation runs.
#define heap_insert(self, cmp_f, elem)
Inserts an element into the heap.
The LP context for the serial runtime.
#define log_log(lvl,...)
Produces a log.
struct lib_ctx lib_ctx
The context for the model development libraries.
static void serial_simulation_init(void)
Initializes the serial simulation environment.
uint_fast32_t array_count_t
The type used to handle dynamic arrays count of elements and capacity.
static void serial_simulation_run(void)
Runs the serial simulation.
static void serial_simulation_fini(void)
Finalizes the serial simulation environment.
void mm_free(void *ptr)
A version of the stdlib free() used internally.
#define LOG_INFO
The logging level reserved to useful runtime messages.
Sequential simlation engine.
#define likely(exp)
Optimize the branch as likely taken.
unsigned char pl[48]
The initial part of the payload.
#define array_count(self)
Gets the count of contained element in a dynamic array.
uint64_t lp_id_t
Used to uniquely identify LPs in the simulation.
Core ROOT-Sim functionalities.
uint_fast32_t pl_size
The message payload size.
#define heap_extract(self, cmp_f)
Extracts an element from the heap.
#define unlikely(exp)
Optimize the branch as likely not taken.
struct simulation_configuration global_config
The configuration filled in by init_args_parse()
void stats_global_init(void)
Initializes the stats subsystem in the node.
timer_uint timer_value(timer_uint start)
Computes a time interval measure using a previous timer_uint value.
#define heap_init(self)
Initializes an empty heap.
void stats_global_time_take(enum stats_global_time this_stat)
Initializes the internal timer used to take accurate measurements.
simtime_t dest_t
The intended destination logical time of this message.
#define log_can_log(lvl)
Checks if a logging level is being processed.
timer_uint timer_new(void)
Gets a new starting point for an time interval measure.