- char* buffer;
- size_t size;
- FILE* file = open_memstream(&buffer, &size);
-
- xbt_fifo_item_t item;
- for (item = start; item; item = xbt_fifo_get_prev_item(item)) {
-
- // Find (pid, value):
- mc_state_t state = (mc_state_t) xbt_fifo_get_item_content(item);
- int value = 0;
- smx_simcall_t saved_req = MC_state_get_executed_request(state, &value);
- const smx_process_t issuer = MC_smx_simcall_get_issuer(saved_req);
- const int pid = issuer->pid;
-
- // Serialization the (pid, value) pair:
- const char* sep = (item!=start) ? ";" : "";
- if (value)
- fprintf(file, "%s%u/%u", sep, pid, value);
- else
- fprintf(file, "%s%u", sep, pid);
+std::string traceToString(simgrid::mc::RecordTrace const& trace)
+{
+ std::ostringstream stream;
+ for (auto i = trace.begin(); i != trace.end(); ++i) {
+ if (i != trace.begin())
+ stream << ';';
+ stream << i->pid;
+ if (i->argument)
+ stream << '/' << i->argument;