- 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);
- }
- }
- xbt_dynar_push(trace->event_list, &event);
- last_event = xbt_dynar_get_ptr(trace->event_list,
- xbt_dynar_length(trace->event_list) - 1);
- }
-
- if (periodicity > 0) {
- if (last_event)
- last_event->delta = periodicity;
- }
-
- if (!trace_list)
- trace_list = xbt_dict_new();
-
- xbt_dict_set(trace_list, filename, (void *) trace, _tmgr_trace_free);
-