Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] s/NULL/nullptr/
[simgrid.git] / src / mc / mc_request.cpp
1 /* Copyright (c) 2008-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include <cassert>
8
9 #include <xbt/log.h>
10 #include <xbt/str.h>
11 #include <xbt/sysdep.h>
12 #include <xbt/dynar.h>
13 #include <xbt/misc.h>
14
15 #include "src/mc/mc_request.h"
16 #include "src/mc/mc_safety.h"
17 #include "src/mc/mc_private.h"
18 #include "src/mc/mc_smx.h"
19 #include "src/mc/mc_xbt.hpp"
20
21 using simgrid::mc::remote;
22
23 extern "C" {
24
25 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_request, mc,
26                                 "Logging specific to MC (request)");
27
28 static char *pointer_to_string(void *pointer);
29 static char *buff_size_to_string(size_t size);
30
31 static inline
32 smx_synchro_t MC_get_comm(smx_simcall_t r)
33 {
34   switch (r->call ) {
35   case SIMCALL_COMM_WAIT:
36     return simcall_comm_wait__get__comm(r);
37   case SIMCALL_COMM_TEST:
38     return simcall_comm_test__get__comm(r);
39   default:
40     return nullptr;
41   }
42 }
43
44 static inline
45 smx_rdv_t MC_get_rdv(smx_simcall_t r)
46 {
47   switch(r->call) {
48   case SIMCALL_COMM_ISEND:
49     return simcall_comm_isend__get__rdv(r);
50   case SIMCALL_COMM_IRECV:
51     return simcall_comm_irecv__get__rdv(r);
52   default:
53     return nullptr;
54   }
55 }
56
57 // Does half the job
58 static inline
59 int MC_request_depend_asymmetric(smx_simcall_t r1, smx_simcall_t r2)
60 {
61   if (r1->call == SIMCALL_COMM_ISEND && r2->call == SIMCALL_COMM_IRECV)
62     return FALSE;
63
64   if (r1->call == SIMCALL_COMM_IRECV && r2->call == SIMCALL_COMM_ISEND)
65     return FALSE;
66
67   // Those are internal requests, we do not need indirection
68   // because those objects are copies:
69   smx_synchro_t synchro1 = MC_get_comm(r1);
70   smx_synchro_t synchro2 = MC_get_comm(r2);
71
72   if ((r1->call == SIMCALL_COMM_ISEND || r1->call == SIMCALL_COMM_IRECV)
73       && r2->call == SIMCALL_COMM_WAIT) {
74
75     smx_rdv_t rdv = MC_get_rdv(r1);
76
77     if (rdv != synchro2->comm.rdv_cpy
78         && simcall_comm_wait__get__timeout(r2) <= 0)
79       return FALSE;
80
81     if ((r1->issuer != synchro2->comm.src_proc)
82         && (r1->issuer != synchro2->comm.dst_proc)
83         && simcall_comm_wait__get__timeout(r2) <= 0)
84       return FALSE;
85
86     if ((r1->call == SIMCALL_COMM_ISEND)
87         && (synchro2->comm.type == SIMIX_COMM_SEND)
88         && (synchro2->comm.src_buff !=
89             simcall_comm_isend__get__src_buff(r1))
90         && simcall_comm_wait__get__timeout(r2) <= 0)
91       return FALSE;
92
93     if ((r1->call == SIMCALL_COMM_IRECV)
94         && (synchro2->comm.type == SIMIX_COMM_RECEIVE)
95         && (synchro2->comm.dst_buff != simcall_comm_irecv__get__dst_buff(r1))
96         && simcall_comm_wait__get__timeout(r2) <= 0)
97       return FALSE;
98   }
99
100   /* FIXME: the following rule assumes that the result of the
101    * isend/irecv call is not stored in a buffer used in the
102    * test call. */
103   /*if(   (r1->call == SIMCALL_COMM_ISEND || r1->call == SIMCALL_COMM_IRECV)
104      &&  r2->call == SIMCALL_COMM_TEST)
105      return FALSE; */
106
107   if (r1->call == SIMCALL_COMM_WAIT
108       && (r2->call == SIMCALL_COMM_WAIT || r2->call == SIMCALL_COMM_TEST)
109       && (synchro1->comm.src_proc == nullptr || synchro1->comm.dst_proc == NULL))
110     return FALSE;
111
112   if (r1->call == SIMCALL_COMM_TEST &&
113       (simcall_comm_test__get__comm(r1) == nullptr
114        || synchro1->comm.src_buff == nullptr
115        || synchro1->comm.dst_buff == nullptr))
116     return FALSE;
117
118   if (r1->call == SIMCALL_COMM_TEST && r2->call == SIMCALL_COMM_WAIT
119       && synchro1->comm.src_buff == synchro2->comm.src_buff
120       && synchro1->comm.dst_buff == synchro2->comm.dst_buff)
121     return FALSE;
122
123   if (r1->call == SIMCALL_COMM_WAIT && r2->call == SIMCALL_COMM_TEST
124       && synchro1->comm.src_buff != nullptr
125       && synchro1->comm.dst_buff != nullptr
126       && synchro2->comm.src_buff != nullptr
127       && synchro2->comm.dst_buff != nullptr
128       && synchro1->comm.dst_buff != synchro2->comm.src_buff
129       && synchro1->comm.dst_buff != synchro2->comm.dst_buff
130       && synchro2->comm.dst_buff != synchro1->comm.src_buff)
131     return FALSE;
132
133   return TRUE;
134 }
135
136 // Those are MC_state_get_internal_request(state)
137 int MC_request_depend(smx_simcall_t r1, smx_simcall_t r2)
138 {
139   if (mc_reduce_kind == e_mc_reduce_none)
140     return TRUE;
141
142   if (r1->issuer == r2->issuer)
143     return FALSE;
144
145   /* Wait with timeout transitions are not considered by the independance theorem, thus we consider them as dependant with all other transitions */
146   if ((r1->call == SIMCALL_COMM_WAIT && simcall_comm_wait__get__timeout(r1) > 0)
147       || (r2->call == SIMCALL_COMM_WAIT
148           && simcall_comm_wait__get__timeout(r2) > 0))
149     return TRUE;
150
151   if (r1->call != r2->call)
152     return MC_request_depend_asymmetric(r1, r2)
153       && MC_request_depend_asymmetric(r2, r1);
154
155   // Those are internal requests, we do not need indirection
156   // because those objects are copies:
157   smx_synchro_t synchro1 = MC_get_comm(r1);
158   smx_synchro_t synchro2 = MC_get_comm(r2);
159
160   switch(r1->call) {
161   case SIMCALL_COMM_ISEND:
162     return simcall_comm_isend__get__rdv(r1) == simcall_comm_isend__get__rdv(r2);
163   case SIMCALL_COMM_IRECV:
164     return simcall_comm_irecv__get__rdv(r1) == simcall_comm_irecv__get__rdv(r2);
165   case SIMCALL_COMM_WAIT:
166     if (synchro1->comm.src_buff == synchro2->comm.src_buff
167         && synchro1->comm.dst_buff == synchro2->comm.dst_buff)
168       return FALSE;
169     else if (synchro1->comm.src_buff != nullptr
170         && synchro1->comm.dst_buff != nullptr
171         && synchro2->comm.src_buff != nullptr
172         && synchro2->comm.dst_buff != nullptr
173         && synchro1->comm.dst_buff != synchro2->comm.src_buff
174         && synchro1->comm.dst_buff != synchro2->comm.dst_buff
175         && synchro2->comm.dst_buff != synchro1->comm.src_buff)
176       return FALSE;
177     else
178       return TRUE;
179   default:
180     return TRUE;
181   }
182 }
183
184 static char *pointer_to_string(void *pointer)
185 {
186
187   if (XBT_LOG_ISENABLED(mc_request, xbt_log_priority_verbose))
188     return bprintf("%p", pointer);
189
190   return xbt_strdup("(verbose only)");
191 }
192
193 static char *buff_size_to_string(size_t buff_size)
194 {
195
196   if (XBT_LOG_ISENABLED(mc_request, xbt_log_priority_verbose))
197     return bprintf("%zu", buff_size);
198
199   return xbt_strdup("(verbose only)");
200 }
201
202
203 char *MC_request_to_string(smx_simcall_t req, int value, e_mc_request_type_t request_type)
204 {
205   bool use_remote_comm = true;
206   switch(request_type) {
207   case MC_REQUEST_SIMIX:
208     use_remote_comm = true;
209     break;
210   case MC_REQUEST_EXECUTED:
211   case MC_REQUEST_INTERNAL:
212     use_remote_comm = false;
213     break;
214   }
215
216   const char* type = nullptr;
217   char *args = nullptr;
218
219   smx_process_t issuer = MC_smx_simcall_get_issuer(req);
220
221   switch (req->call) {
222
223   case SIMCALL_COMM_ISEND: {
224     type = "iSend";
225     char* p = pointer_to_string(simcall_comm_isend__get__src_buff(req));
226     char* bs = buff_size_to_string(simcall_comm_isend__get__src_buff_size(req));
227     if (issuer->host)
228       args =
229           bprintf("src=(%lu)%s (%s), buff=%s, size=%s", issuer->pid,
230                   MC_smx_process_get_host_name(issuer),
231                   MC_smx_process_get_name(issuer),
232                   p, bs);
233     else
234       args =
235           bprintf("src=(%lu)%s, buff=%s, size=%s", issuer->pid,
236                   MC_smx_process_get_name(issuer), p, bs);
237     xbt_free(bs);
238     xbt_free(p);
239     break;
240   }
241
242   case SIMCALL_COMM_IRECV: {
243     size_t* remote_size = simcall_comm_irecv__get__dst_buff_size(req);
244
245     // size_t size = size_pointer ? *size_pointer : 0;
246     size_t size = 0;
247     if (remote_size)
248       mc_model_checker->process().read_bytes(&size, sizeof(size),
249         remote(remote_size));
250
251     type = "iRecv";
252     char* p = pointer_to_string(simcall_comm_irecv__get__dst_buff(req));
253     char* bs = buff_size_to_string(size);
254     if (issuer->host)
255       args =
256           bprintf("dst=(%lu)%s (%s), buff=%s, size=%s", issuer->pid,
257                   MC_smx_process_get_host_name(issuer),
258                   MC_smx_process_get_name(issuer),
259                   p, bs);
260     else
261       args =
262           bprintf("dst=(%lu)%s, buff=%s, size=%s", issuer->pid,
263                   MC_smx_process_get_name(issuer),
264                   p, bs);
265     xbt_free(bs);
266     xbt_free(p);
267     break;
268   }
269
270   case SIMCALL_COMM_WAIT: {
271     smx_synchro_t remote_act = simcall_comm_wait__get__comm(req);
272     char* p;
273     if (value == -1) {
274       type = "WaitTimeout";
275       p = pointer_to_string(remote_act);
276       args = bprintf("comm=%s", p);
277     } else {
278       type = "Wait";
279       p = pointer_to_string(remote_act);
280
281       s_smx_synchro_t synchro;
282       smx_synchro_t act;
283       if (use_remote_comm) {
284         mc_model_checker->process().read_bytes(&synchro,
285           sizeof(synchro), remote(remote_act));
286         act = &synchro;
287       } else
288         act = remote_act;
289
290       smx_process_t src_proc = MC_smx_resolve_process(act->comm.src_proc);
291       smx_process_t dst_proc = MC_smx_resolve_process(act->comm.dst_proc);
292       args = bprintf("comm=%s [(%lu)%s (%s)-> (%lu)%s (%s)]", p,
293                      src_proc ? src_proc->pid : 0,
294                      src_proc ? MC_smx_process_get_host_name(src_proc) : "",
295                      src_proc ? MC_smx_process_get_name(src_proc) : "",
296                      dst_proc ? dst_proc->pid : 0,
297                      dst_proc ? MC_smx_process_get_host_name(dst_proc) : "",
298                      dst_proc ? MC_smx_process_get_name(dst_proc) : "");
299     }
300     xbt_free(p);
301     break;
302   }
303
304   case SIMCALL_COMM_TEST: {
305     smx_synchro_t remote_act = simcall_comm_test__get__comm(req);
306     s_smx_synchro_t synchro;
307       smx_synchro_t act;
308       if (use_remote_comm) {
309         mc_model_checker->process().read_bytes(&synchro,
310           sizeof(synchro), remote(remote_act));
311         act = &synchro;
312       } else
313         act = remote_act;
314
315     char* p;
316     if (act->comm.src_proc == nullptr || act->comm.dst_proc == NULL) {
317       type = "Test FALSE";
318       p = pointer_to_string(remote_act);
319       args = bprintf("comm=%s", p);
320     } else {
321       type = "Test TRUE";
322       p = pointer_to_string(remote_act);
323
324       smx_process_t src_proc = MC_smx_resolve_process(act->comm.src_proc);
325       smx_process_t dst_proc = MC_smx_resolve_process(act->comm.dst_proc);
326       args = bprintf("comm=%s [(%lu)%s (%s) -> (%lu)%s (%s)]", p,
327                      src_proc->pid,
328                      MC_smx_process_get_name(src_proc),
329                      MC_smx_process_get_host_name(src_proc),
330                      dst_proc->pid,
331                      MC_smx_process_get_name(dst_proc),
332                      MC_smx_process_get_host_name(dst_proc));
333     }
334     xbt_free(p);
335     break;
336   }
337
338   case SIMCALL_COMM_WAITANY: {
339     type = "WaitAny";
340     s_xbt_dynar_t comms;
341     mc_model_checker->process().read_bytes(
342       &comms, sizeof(comms), remote(simcall_comm_waitany__get__comms(req)));
343     if (!xbt_dynar_is_empty(&comms)) {
344       smx_synchro_t remote_sync;
345       read_element(mc_model_checker->process(),
346         &remote_sync, remote(simcall_comm_waitany__get__comms(req)), value,
347         sizeof(remote_sync));
348       char* p = pointer_to_string(remote_sync);
349       args = bprintf("comm=%s (%d of %lu)",
350         p, value + 1, xbt_dynar_length(&comms));
351       xbt_free(p);
352     } else {
353       args = bprintf("comm at idx %d", value);
354     }
355     break;
356   }
357
358   case SIMCALL_COMM_TESTANY:
359     if (value == -1) {
360       type = "TestAny FALSE";
361       args = xbt_strdup("-");
362     } else {
363       type = "TestAny";
364       args =
365           bprintf("(%d of %zu)", value + 1,
366                   read_length(mc_model_checker->process(),
367                     simcall_comm_testany__get__comms(req)));
368     }
369     break;
370
371   case SIMCALL_MUTEX_TRYLOCK:
372   case SIMCALL_MUTEX_LOCK: {
373     if (req->call == SIMCALL_MUTEX_LOCK)
374       type = "Mutex LOCK";
375     else
376       type = "Mutex TRYLOCK";
377
378     s_smx_mutex_t mutex;
379     mc_model_checker->process().read_bytes(&mutex, sizeof(mutex),
380       remote(
381         req->call == SIMCALL_MUTEX_LOCK
382         ? simcall_mutex_lock__get__mutex(req)
383         : simcall_mutex_trylock__get__mutex(req)
384       ));
385     s_xbt_swag_t mutex_sleeping;
386     mc_model_checker->process().read_bytes(&mutex_sleeping, sizeof(mutex_sleeping),
387       remote(mutex.sleeping));
388
389     args = bprintf("locked = %d, owner = %d, sleeping = %d",
390       mutex.locked,
391       mutex.owner != nullptr ? (int) MC_smx_resolve_process(mutex.owner)->pid : -1,
392       mutex_sleeping.count);
393     break;
394   }
395
396   case SIMCALL_MC_SNAPSHOT:
397     type = "MC_SNAPSHOT";
398     args = nullptr;
399     break;
400
401   case SIMCALL_MC_COMPARE_SNAPSHOTS:
402     type = "MC_COMPARE_SNAPSHOTS";
403     args = nullptr;
404     break;
405
406   case SIMCALL_MC_RANDOM:
407     type = "MC_RANDOM";
408     args = bprintf("%d", value);
409     break;
410
411   default:
412     THROW_UNIMPLEMENTED;
413   }
414
415   char* str;
416   if (args != nullptr) {
417     str =
418         bprintf("[(%lu)%s (%s)] %s(%s)", issuer->pid,
419                 MC_smx_process_get_host_name(issuer),
420                 MC_smx_process_get_name(issuer),
421                 type, args);
422   } else {
423     str =
424         bprintf("[(%lu)%s (%s)] %s ", issuer->pid,
425                 MC_smx_process_get_host_name(issuer),
426                 MC_smx_process_get_name(issuer),
427                 type);
428   }
429   xbt_free(args);
430   return str;
431 }
432
433 unsigned int MC_request_testany_fail(smx_simcall_t req)
434 {
435   // Remote xbt_dynar_foreach on simcall_comm_testany__get__comms(req).
436
437   // Read the dynar:
438   s_xbt_dynar_t comms;
439   mc_model_checker->process().read_bytes(
440     &comms, sizeof(comms), remote(simcall_comm_testany__get__comms(req)));
441
442   // Read ther dynar buffer:
443   size_t buffer_size = comms.elmsize * comms.used;
444   char buffer[buffer_size];
445   mc_model_checker->process().read_bytes(
446     buffer, buffer_size, remote(comms.data));
447
448   // Iterate over the elements:
449   assert(comms.elmsize == sizeof(smx_synchro_t));
450   unsigned cursor;
451   for (cursor=0; cursor != comms.used; ++cursor) {
452
453     // Get the element:
454     smx_synchro_t remote_action = nullptr;
455     memcpy(&remote_action, buffer + comms.elmsize * cursor, sizeof(remote_action));
456
457     // Dereference the pointer:
458     s_smx_synchro_t action;
459     mc_model_checker->process().read_bytes(
460       &action, sizeof(action), remote(remote_action));
461
462     // Finally so something useful about it:
463     if (action.comm.src_proc && action.comm.dst_proc)
464       return FALSE;
465   }
466
467   return TRUE;
468 }
469
470 int MC_request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx)
471 {
472   smx_synchro_t remote_act = nullptr;
473   switch (req->call) {
474
475   case SIMCALL_COMM_WAIT:
476     /* FIXME: check also that src and dst processes are not suspended */
477     remote_act = simcall_comm_wait__get__comm(req);
478     break;
479
480   case SIMCALL_COMM_WAITANY: {
481     read_element(
482       mc_model_checker->process(), &remote_act,
483       remote(simcall_comm_waitany__get__comms(req)),
484       idx, sizeof(remote_act));
485     }
486     break;
487
488   case SIMCALL_COMM_TESTANY: {
489     read_element(
490       mc_model_checker->process(), &remote_act,
491       remote(simcall_comm_testany__get__comms(req)),
492       idx, sizeof(remote_act));
493     }
494     break;
495
496   default:
497     return TRUE;
498   }
499
500   s_smx_synchro_t synchro;
501   mc_model_checker->process().read_bytes(
502     &synchro, sizeof(synchro), remote(remote_act));
503   return synchro.comm.src_proc && synchro.comm.dst_proc;
504 }
505
506 int MC_process_is_enabled(smx_process_t process)
507 {
508   return MC_request_is_enabled(&process->simcall);
509 }
510
511 char *MC_request_get_dot_output(smx_simcall_t req, int value)
512 {
513   char *label = nullptr;
514
515   const smx_process_t issuer = MC_smx_simcall_get_issuer(req);
516
517   switch (req->call) {
518   case SIMCALL_COMM_ISEND:
519     if (issuer->host)
520       label =
521           bprintf("[(%lu)%s] iSend", issuer->pid,
522                   MC_smx_process_get_host_name(issuer));
523     else
524       label = bprintf("[(%lu)] iSend", issuer->pid);
525     break;
526
527   case SIMCALL_COMM_IRECV:
528     if (issuer->host)
529       label =
530           bprintf("[(%lu)%s] iRecv", issuer->pid,
531                   MC_smx_process_get_host_name(issuer));
532     else
533       label = bprintf("[(%lu)] iRecv", issuer->pid);
534     break;
535
536   case SIMCALL_COMM_WAIT: {
537     if (value == -1) {
538       if (issuer->host)
539         label =
540             bprintf("[(%lu)%s] WaitTimeout", issuer->pid,
541                     MC_smx_process_get_host_name(issuer));
542       else
543         label = bprintf("[(%lu)] WaitTimeout", issuer->pid);
544     } else {
545       smx_synchro_t remote_act = simcall_comm_wait__get__comm(req);
546       s_smx_synchro_t synchro;
547       mc_model_checker->process().read_bytes(&synchro,
548         sizeof(synchro), remote(remote_act));
549
550       smx_process_t src_proc = MC_smx_resolve_process(synchro.comm.src_proc);
551       smx_process_t dst_proc = MC_smx_resolve_process(synchro.comm.dst_proc);
552       if (issuer->host)
553         label =
554             bprintf("[(%lu)%s] Wait [(%lu)->(%lu)]", issuer->pid,
555                     MC_smx_process_get_host_name(issuer),
556                     src_proc ? src_proc->pid : 0,
557                     dst_proc ? dst_proc->pid : 0);
558       else
559         label =
560             bprintf("[(%lu)] Wait [(%lu)->(%lu)]", issuer->pid,
561                     src_proc ? src_proc->pid : 0,
562                     dst_proc ? dst_proc->pid : 0);
563     }
564     break;
565   }
566
567   case SIMCALL_COMM_TEST: {
568     smx_synchro_t remote_act = simcall_comm_test__get__comm(req);
569     s_smx_synchro_t synchro;
570     mc_model_checker->process().read_bytes(&synchro,
571       sizeof(synchro), remote(remote_act));
572     if (synchro.comm.src_proc == nullptr || synchro.comm.dst_proc == NULL) {
573       if (issuer->host)
574         label =
575             bprintf("[(%lu)%s] Test FALSE", issuer->pid,
576                     MC_smx_process_get_host_name(issuer));
577       else
578         label = bprintf("[(%lu)] Test FALSE", issuer->pid);
579     } else {
580       if (issuer->host)
581         label =
582             bprintf("[(%lu)%s] Test TRUE", issuer->pid,
583                     MC_smx_process_get_host_name(issuer));
584       else
585         label = bprintf("[(%lu)] Test TRUE", issuer->pid);
586     }
587     break;
588   }
589
590   case SIMCALL_COMM_WAITANY: {
591     unsigned long comms_size = read_length(
592       mc_model_checker->process(), remote(simcall_comm_waitany__get__comms(req)));
593     if (issuer->host)
594       label =
595           bprintf("[(%lu)%s] WaitAny [%d of %lu]", issuer->pid,
596                   MC_smx_process_get_host_name(issuer), value + 1,
597                   comms_size);
598     else
599       label =
600           bprintf("[(%lu)] WaitAny [%d of %lu]", issuer->pid, value + 1,
601                   comms_size);
602     break;
603   }
604
605   case SIMCALL_COMM_TESTANY:
606     if (value == -1) {
607       if (issuer->host)
608         label =
609             bprintf("[(%lu)%s] TestAny FALSE", issuer->pid,
610                     MC_smx_process_get_host_name(issuer));
611       else
612         label = bprintf("[(%lu)] TestAny FALSE", issuer->pid);
613     } else {
614       if (issuer->host)
615         label =
616             bprintf("[(%lu)%s] TestAny TRUE [%d of %lu]", issuer->pid,
617                     MC_smx_process_get_host_name(issuer), value + 1,
618                     xbt_dynar_length(simcall_comm_testany__get__comms(req)));
619       else
620         label =
621             bprintf("[(%lu)] TestAny TRUE [%d of %lu]", issuer->pid,
622                     value + 1,
623                     xbt_dynar_length(simcall_comm_testany__get__comms(req)));
624     }
625     break;
626
627   case SIMCALL_MUTEX_TRYLOCK:
628     label = bprintf("[(%lu)] Mutex TRYLOCK", issuer->pid);
629     break;
630
631   case SIMCALL_MUTEX_LOCK:
632     label = bprintf("[(%lu)] Mutex LOCK", issuer->pid);
633     break;
634
635   case SIMCALL_MC_RANDOM:
636     if (issuer->host)
637       label =
638           bprintf("[(%lu)%s] MC_RANDOM (%d)", issuer->pid,
639                   MC_smx_process_get_host_name(issuer), value);
640     else
641       label = bprintf("[(%lu)] MC_RANDOM (%d)", issuer->pid, value);
642     break;
643
644   case SIMCALL_MC_SNAPSHOT:
645     if (issuer->host)
646       label =
647           bprintf("[(%lu)%s] MC_SNAPSHOT", issuer->pid,
648                   MC_smx_process_get_host_name(issuer));
649     else
650       label = bprintf("[(%lu)] MC_SNAPSHOT", issuer->pid);
651     break;
652
653   case SIMCALL_MC_COMPARE_SNAPSHOTS:
654     if (issuer->host)
655       label =
656           bprintf("[(%lu)%s] MC_COMPARE_SNAPSHOTS", issuer->pid,
657                   MC_smx_process_get_host_name(issuer));
658     else
659       label = bprintf("[(%lu)] MC_COMPARE_SNAPSHOTS", issuer->pid);
660     break;
661
662   default:
663     THROW_UNIMPLEMENTED;
664   }
665
666   char* str =
667       bprintf("label = \"%s\", color = %s, fontcolor = %s", label,
668               colors[issuer->pid - 1], colors[issuer->pid - 1]);
669   xbt_free(label);
670   return str;
671
672 }
673
674 }