- } else { // Should have got my trace file in argument
- xbt_assert0(argc>=2,
- "No simulation-wide trace file provided to MSG_action_trace_run(), "
- "and no process-wide trace file provided in deployment file. Aborting."
- );
-
- char *line = NULL;
- size_t line_len = 0;
- FILE *fp = fopen(argv[1], "r");
- xbt_assert2(fp != NULL, "Cannot open %s: %s", argv[1], strerror(errno));
-
- ssize_t read;
- // Read lines and execute them until I reach the end of file
- while ((read = getline(&line, &line_len, fp)) != -1) {
- // cleanup and split the string I just read
- char *comment = strchr(line, '#');
- if (comment != NULL)
- *comment = '\0';
- xbt_str_trim(line, NULL);
- if (line[0] == '\0')
- continue;
- evt = xbt_str_split_quoted(line);
-
- char *evtname = xbt_dynar_get_as(evt, 0, char *);
- if (!strcmp(argv[0],evtname)) {
+ } else { // Should have got my trace file in argument
+ xbt_assert(argc >= 2,
+ "No '%s' agent function provided, no simulation-wide trace file provided to MSG_action_trace_run(), "
+ "and no process-wide trace file provided in deployment file. Aborting.",
+ argv[0]
+ );
+ xbt_replay_trace_reader_t reader = xbt_replay_trace_reader_new(argv[1]);
+ while ((evt=xbt_replay_trace_reader_get(reader))) {
+ if (!strcmp(argv[0],evt[0])) {