- }
-
- if ((f = surf_fopen(filename, "r")) == NULL) {
- xbt_assert1(0, "Cannot open file '%s'", filename);
- }
-
- trace = xbt_new0(s_tmgr_trace_t, 1);
- trace->event_list = xbt_dynar_new(sizeof(s_tmgr_event_t), NULL);
-
- while (fgets(line, 256, f)) {
- linecount++;
- if ((line[0] == '#') || (line[0] == '\n') || (line[0] == '%'))
- continue;
-
- if (sscanf(line, "PERIODICITY " "%lg" "\n", &(periodicity))
- == 1) {
- if (periodicity <= 0) {
- xbt_assert2(0,
- "%s,%d: Syntax error. Periodicity has to be positive",
- filename, linecount);
- }
- continue;
- }
-
- if (sscanf
- (line, "%lg" " " "%lg" "\n", &event.delta, &event.value) != 2) {
- xbt_assert2(0, "%s,%d: Syntax error", filename, linecount);
- }
-
- if (last_event) {
- if ((last_event->delta = event.delta - last_event->delta) <= 0) {
- xbt_assert2(0,
- "%s,%d: Invalid trace value, events have to be sorted",
- filename, linecount);
- }