#include "xbt/sysdep.h"
#include "xbt/dynar.h"
#include "surf/surf.h"
+#include "simgrid/sg_config.h"
#include "xbt/ex.h"
#include "xbt/log.h"
#include "xbt/str.h"
surf_init(argc, argv);
- xbt_cfg_setdefault_string(_surf_cfg_set, "workstation/model",
+ xbt_cfg_setdefault_string(_sg_cfg_set, "workstation/model",
"ptask_L07");
#ifdef HAVE_TRACING
unsigned int iter, depcnt;
static int first_time = 1;
- if (first_time) {
- XBT_VERB("Starting simulation...");
+ if (first_time) {
+ XBT_VERB("Starting simulation...");
- surf_presolve(); /* Takes traces into account */
- first_time = 0;
- }
+ surf_presolve(); /* Takes traces into account */
+ first_time = 0;
+ }
+ XBT_VERB("Run simulation for %f seconds", how_long);
sd_global->watch_point_reached = 0;
xbt_swag_reset(sd_global->return_set);
/* main loop */
elapsed_time = 0.0;
while (elapsed_time >= 0.0 &&
- (how_long < 0.0 || total_time < how_long) &&
+ (how_long < 0.0 || 0.00001 < (how_long -total_time)) &&
!sd_global->watch_point_reached) {
surf_model_t model = NULL;
/* dumb variables */
XBT_DEBUG("Total time: %f", total_time);
- elapsed_time = surf_solve(how_long > 0 ? surf_get_clock() + how_long : -1.0);
+ elapsed_time = surf_solve(how_long > 0 ? surf_get_clock() + how_long - total_time: -1.0);
XBT_DEBUG("surf_solve() returns %f", elapsed_time);
if (elapsed_time > 0.0)
total_time += elapsed_time;