57 bool take_snapshot =
false;
88 rootsim_error(
true,
"State saving mode not supported.");
97 new_state = rsalloc(
sizeof(*new_state));
111 memcpy(&new_state->numerical, &lp->numerical,
114 if(&topology_settings && topology_settings.write_enabled){
115 new_state->topology = rsalloc(topology_global.
chkp_size);
116 memcpy(new_state->topology, lp->
topology,
125 list_insert_tail(lp->queue_states, new_state);
129 return take_snapshot;
142 memcpy(&lp->numerical, &restore_state->numerical,
145 if(&topology_settings && topology_settings.write_enabled){
146 memcpy(lp->
topology, restore_state->topology,
153 #ifdef HAVE_CROSS_STATE 155 lp->wait_on_rendezvous = 0;
156 lp->wait_on_object = 0;
175 unsigned int events = 0;
176 unsigned short int old_state;
179 old_state = lp->
state;
180 lp->
state = LP_STATE_SILENT_EXEC;
183 if (evt == final_evt)
191 while (evt != NULL && evt != final_evt) {
193 if (
unlikely(!reprocess_control_msg(evt))) {
204 lp->
state = old_state;
223 msg_t *last_correct_event;
224 msg_t *last_restored_event;
225 unsigned int reprocessed_events;
229 rootsim_error(
false,
"I'm asked to roll back LP %d's execution, but rollback_bound is not set. Ignoring...\n",
237 statistics_post_data(lp, STAT_ROLLBACK, 1.0);
239 last_correct_event = lp->
bound;
244 restore_state =
list_tail(lp->queue_states);
245 while (restore_state != NULL && restore_state->
lvt > last_correct_event->timestamp) {
247 restore_state =
list_prev(restore_state);
252 list_delete_by_content(lp->queue_states, s);
255 RestoreState(lp, restore_state);
257 last_restored_event = restore_state->
last_event;
258 reprocessed_events =
silent_execution(lp, last_restored_event, last_correct_event);
259 statistics_post_data(lp, STAT_SILENT, (
double)reprocessed_events);
264 rollback_control_message(lp, last_correct_event->timestamp);
290 barrier_state =
list_tail(lp->queue_states);
293 while (barrier_state != NULL && barrier_state->
lvt >= simtime) {
294 barrier_state =
list_prev(barrier_state);
296 if (barrier_state == NULL) {
297 barrier_state =
list_head(lp->queue_states);
309 return barrier_state;
msg_t * bound
Pointer to the last correctly processed event.
unsigned int silent_execution(struct lp_struct *lp, msg_t *evt, msg_t *final_evt)
void force_LP_checkpoint(struct lp_struct *lp)
Structure for LP's state.
void log_delete(void *ckpt)
simtime_t lvt
Simulation time associated with the state log.
Core ROOT-Sim functionalities.
void set_checkpoint_mode(int ckpt_mode)
int checkpointing
Type of checkpointing scheme (e.g., PSS, CSS, ...)
unsigned char * abm_do_checkpoint(region_abm_t *region)
bool state_log_forced
If this variable is set, the next invocation to LogState() takes a new state log, independently of th...
unsigned int to_int
The GID numerical value.
The ROOT-Sim scheduler main module header.
short unsigned int state
Execution state.
__thread struct lp_struct * current
This is a per-thread variable pointing to the block state of the LP currently scheduled.
void log_restore(struct lp_struct *lp, state_t *state_queue_node)
void * log_state(struct lp_struct *lp)
double simtime_t
This defines the type with whom timestamps are represented.
simulation_configuration rootsim_config
This global variable holds the configuration for the current simulation.
unsigned int from_last_ckpt
Counts how many events executed from the last checkpoint (to support PSS)
void * base_pointer
This is a pointer used to keep track of changes to simulation states via SetState() ...
Memory Manager main header.
topology_t * topology
pointer to the topology struct
void rollback(struct lp_struct *lp)
msg_t * last_event
This log has been taken after the execution of this event.
void * log
A pointer to the actual log.
void activate_LP(struct lp_struct *next, msg_t *evt)
#define D_EQUAL(a, b)
Equality condition for doubles.
region_abm_t * region
pointer to the region struct
GID_t gid
Global ID of the LP.
state_t * find_time_barrier(struct lp_struct *lp, simtime_t simtime)
short unsigned int state
Current execution state of the LP.
LP_context_t context
LP execution state.
LP_context_t default_context
LP execution state when blocked during the execution of an event.
void send_antimessages(struct lp_struct *lp, simtime_t after_simtime)
Send all antimessages for a certain LP.
void abm_restore_checkpoint(unsigned char *data, region_abm_t *region)
void SetState(void *new_state)
void set_checkpoint_period(struct lp_struct *lp, int period)
unsigned int ckpt_period
This variable mainains the current checkpointing interval for the LP.
void * current_base_pointer
The current state base pointer (updated by SetState())
#define unlikely(exp)
Optimize the branch as likely not taken.
This structure describes the CPU context of a User-Level Thread.
bool LogState(struct lp_struct *lp)