-/* Copyright (c) 2004, 2005, 2007, 2009, 2010. The SimGrid Team.
+/* Copyright (c) 2004-2005, 2007, 2009-2014. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
}
xbt_assert(periodicity >= 0,
- "Invalid periodicity %lg (must be positive)", periodicity);
+ "Invalid periodicity %g (must be positive)", periodicity);
trace = xbt_new0(s_tmgr_trace_t, 1);
trace->type = e_trace_list;
if (last_event) {
if (last_event->delta > event.delta) {
xbt_die("%s:%d: Invalid trace: Events must be sorted, "
- "but time %lg > time %lg.\n%s",
+ "but time %g > time %g.\n%s",
id, linecount, last_event->delta, event.delta, input);
}
last_event->delta = event.delta - last_event->delta;
+ } else {
+ if(event.delta > 0.0){
+ s_tmgr_event_t first_event;
+ first_event.delta=event.delta;
+ first_event.value=-1.0;
+ xbt_dynar_push(trace->s_list.event_list, &first_event);
+ }
}
xbt_dynar_push(trace->s_list.event_list, &event);
last_event =
}
f = surf_fopen(filename, "r");
- xbt_assert(f != NULL, "Cannot open file '%s' (path=%s)", filename,
- xbt_str_join(surf_path, ":"));
+ if (f == NULL)
+ xbt_die("Cannot open file '%s' (path=%s)", filename,
+ xbt_str_join(surf_path, ":"));
tstr = xbt_str_from_file(f);
fclose(f);
trace_event->idx++;
} else if (event->delta > 0) { /* Last element, checking for periodicity */
xbt_heap_push(h->heap, trace_event, event_date + event->delta);
- trace_event->idx = 0;
+ trace_event->idx = 1; /* not 0 as the first event is a placeholder to handle when events really start */
} else { /* We don't need this trace_event anymore */
trace_event->free_me = 1;
}