/* Clean IO before the run */
fflush(stdout);
fflush(stderr);
+ SIMIX_init();
while (SIMIX_solve(actions_done, actions_failed) != -1.0) {
while ( (action = xbt_fifo_pop(actions_failed)) ) {
/* src/gras_config.h.in. Generated from configure.ac by autoheader. */
+/* Arguments passed to the configure script */
+#undef AC_CONFIGURE_ARGS
+
/* Path to the addr2line tool */
#undef ADDR2LINE
XBT_PUBLIC(void) SIMIX_launch_application(const char *file);
XBT_PUBLIC(double) SIMIX_get_clock(void);
+XBT_PUBLIC(void) SIMIX_init(void);
XBT_PUBLIC(double) SIMIX_solve(xbt_fifo_t actions_done, xbt_fifo_t actions_failed);
/* Timer functions */
*/
XBT_PUBLIC(void) surf_init(int *argc, char **argv); /* initialize common structures */
+/** \brief Finish simulation initialization
+ * \ingroup SURF_simulation
+ *
+ * This function must be called before the first call to surf_solve()
+ */
+XBT_PUBLIC(void) surf_presolve(void);
+
/** \brief Performs a part of the simulation
* \ingroup SURF_simulation
* \return the elapsed time, or -1.0 if no event could be executed
/* Clean IO before the run */
fflush(stdout);
fflush(stderr);
+ SIMIX_init();
//surf_solve(); /* Takes traces into account. Returns 0.0 */
/* xbt_fifo_size(msg_global->process_to_run) */
changed_tasks[0] = NULL;
if (first_time) {
- surf_solve(); /* Takes traces into account. Returns 0.0 */
+ surf_presolve(); /* Takes traces into account */
first_time = 0;
}
return surf_get_clock();
}
+/**
+ * \brief Finish the simulation initialization
+ *
+ * Must be called before the first call to SIMIX_solve()
+ */
+void SIMIX_init(void) {
+ surf_presolve();
+}
+
/**
* \brief Does a turn of the simulation
*
unsigned int iter;
double elapsed_time = 0.0;
static int state_modifications = 1;
- static int first = 1;
xbt_context_empty_trash();
if (xbt_swag_size(simix_global->process_to_run) && (elapsed_time > 0)) {
DEBUG0("**************************************************");
}
- if (first) {
- surf_solve(); /* Takes traces into account. Returns 0.0 */
- first = 0;
- }
+
while ((process = xbt_swag_extract(simix_global->process_to_run))) {
DEBUG2("Scheduling %s on %s",
process->name, process->simdata->smx_host->name);
/* Clean IO before the run */
fflush(stdout);
fflush(stderr);
+ SIMIX_init();
while (SIMIX_solve(actions_done, actions_failed) != -1.0) {
while ((action = xbt_fifo_pop(actions_failed))) {
xbt_exit();
}
-double surf_solve(void)
-{
- static int first_run = 1;
-
- double min = -1.0;
+void surf_presolve(void) {
double next_event_date = -1.0;
- double model_next_action_end = -1.0;
+ tmgr_trace_event_t event = NULL;
double value = -1.0;
surf_model_object_t model_obj = NULL;
surf_model_t model = NULL;
- tmgr_trace_event_t event = NULL;
unsigned int iter;
-
- if (first_run) {
+
DEBUG0
("First Run! Let's \"purge\" events and put models in the right state");
while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
xbt_dynar_foreach(model_list, iter, model) {
model->common_private->update_actions_state(NOW, 0.0);
}
- first_run = 0;
- return 0.0;
- }
+}
+
+double surf_solve(void)
+{
+ double min = -1.0;
+ double next_event_date = -1.0;
+ double model_next_action_end = -1.0;
+ double value = -1.0;
+ surf_model_object_t model_obj = NULL;
+ surf_model_t model = NULL;
+ tmgr_trace_event_t event = NULL;
+ unsigned int iter;
min = -1.0;