Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : wait with timeout is always dependant with another transition
[simgrid.git] / src / mc / mc_request.c
1 /* Copyright (c) 2008-2013. 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 "mc_private.h"
8
9 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_request, mc,
10                                 "Logging specific to MC (request)");
11
12 static char* pointer_to_string(void* pointer);
13 static char* buff_size_to_string(size_t size);
14
15 int MC_request_depend(smx_simcall_t r1, smx_simcall_t r2) {
16   if(mc_reduce_kind == e_mc_reduce_none)
17     return TRUE;
18
19   if (r1->issuer == r2->issuer)
20     return FALSE;
21
22   /* Wait with timeout transitions are not considered by the independance theorem, thus we consider them as dependant with all other transitions */
23   if((r1->call == SIMCALL_COMM_WAIT && simcall_comm_wait__get__timeout(r1) > 0) || (r2->call == SIMCALL_COMM_WAIT && simcall_comm_wait__get__timeout(r2) > 0))
24     return TRUE;
25
26   if(r1->call == SIMCALL_COMM_ISEND && r2->call == SIMCALL_COMM_IRECV)
27     return FALSE;
28
29   if(r1->call == SIMCALL_COMM_IRECV && r2->call == SIMCALL_COMM_ISEND)
30     return FALSE;
31
32   if((r1->call == SIMCALL_COMM_ISEND || r1->call == SIMCALL_COMM_IRECV)
33      &&  r2->call == SIMCALL_COMM_WAIT){
34
35     smx_rdv_t rdv = r1->call == SIMCALL_COMM_ISEND ? simcall_comm_isend__get__rdv(r1) : simcall_comm_irecv__get__rdv(r1);
36
37     if(rdv != simcall_comm_wait__get__comm(r2)->comm.rdv_cpy && simcall_comm_wait__get__timeout(r2) <= 0)
38       return FALSE;
39
40     if((r1->issuer != simcall_comm_wait__get__comm(r2)->comm.src_proc) && (r1->issuer != simcall_comm_wait__get__comm(r2)->comm.dst_proc) && simcall_comm_wait__get__timeout(r2) <= 0)
41       return FALSE;
42
43     if((r1->call == SIMCALL_COMM_ISEND) && (simcall_comm_wait__get__comm(r2)->comm.type == SIMIX_COMM_SEND) 
44        && (simcall_comm_wait__get__comm(r2)->comm.src_buff != simcall_comm_isend__get__src_buff(r1)) && simcall_comm_wait__get__timeout(r2) <= 0)
45       return FALSE;
46
47     if((r1->call == SIMCALL_COMM_IRECV) && (simcall_comm_wait__get__comm(r2)->comm.type == SIMIX_COMM_RECEIVE) 
48        && (simcall_comm_wait__get__comm(r2)->comm.dst_buff != simcall_comm_irecv__get__dst_buff(r1)) && simcall_comm_wait__get__timeout(r2) <= 0)
49       return FALSE;
50   }
51
52   if((r2->call == SIMCALL_COMM_ISEND || r2->call == SIMCALL_COMM_IRECV)
53         &&  r1->call == SIMCALL_COMM_WAIT){
54
55     smx_rdv_t rdv = r2->call == SIMCALL_COMM_ISEND ? simcall_comm_isend__get__rdv(r2) : simcall_comm_irecv__get__rdv(r2);
56
57     if(rdv != simcall_comm_wait__get__comm(r1)->comm.rdv_cpy && simcall_comm_wait__get__timeout(r1) <= 0)
58       return FALSE;
59
60     if((r2->issuer != simcall_comm_wait__get__comm(r1)->comm.src_proc) && (r2->issuer != simcall_comm_wait__get__comm(r1)->comm.dst_proc) && simcall_comm_wait__get__timeout(r1) <= 0)
61         return FALSE;  
62
63     if((r2->call == SIMCALL_COMM_ISEND) && (simcall_comm_wait__get__comm(r1)->comm.type == SIMIX_COMM_SEND) 
64        && (simcall_comm_wait__get__comm(r1)->comm.src_buff != simcall_comm_isend__get__src_buff(r2)) && simcall_comm_wait__get__timeout(r1) <= 0)
65       return FALSE;
66
67     if((r2->call == SIMCALL_COMM_IRECV) && (simcall_comm_wait__get__comm(r1)->comm.type == SIMIX_COMM_RECEIVE) 
68        && (simcall_comm_wait__get__comm(r1)->comm.dst_buff != simcall_comm_irecv__get__dst_buff(r2)) && simcall_comm_wait__get__timeout(r1) <= 0)
69       return FALSE;
70   }
71
72   /* FIXME: the following rule assumes that the result of the
73    * isend/irecv call is not stored in a buffer used in the
74    * test call. */
75   /*if(   (r1->call == SIMCALL_COMM_ISEND || r1->call == SIMCALL_COMM_IRECV)
76         &&  r2->call == SIMCALL_COMM_TEST)
77         return FALSE;*/
78
79   /* FIXME: the following rule assumes that the result of the
80    * isend/irecv call is not stored in a buffer used in the
81    * test call.*/
82   /*if(   (r2->call == SIMCALL_COMM_ISEND || r2->call == SIMCALL_COMM_IRECV)
83         && r1->call == SIMCALL_COMM_TEST)
84         return FALSE;*/
85
86   if(r1->call == SIMCALL_COMM_ISEND && r2->call == SIMCALL_COMM_ISEND
87      && simcall_comm_isend__get__rdv(r1) != simcall_comm_isend__get__rdv(r2))
88     return FALSE;
89
90   if(r1->call == SIMCALL_COMM_IRECV && r2->call == SIMCALL_COMM_IRECV
91      && simcall_comm_irecv__get__rdv(r1) != simcall_comm_irecv__get__rdv(r2))
92     return FALSE;
93
94   if(r1->call == SIMCALL_COMM_WAIT && (r2->call == SIMCALL_COMM_WAIT || r2->call == SIMCALL_COMM_TEST)
95      && (simcall_comm_wait__get__comm(r1)->comm.src_proc == NULL
96          || simcall_comm_wait__get__comm(r1)->comm.dst_proc == NULL))
97     return FALSE;
98
99   if(r2->call == SIMCALL_COMM_WAIT && (r1->call == SIMCALL_COMM_WAIT || r1->call == SIMCALL_COMM_TEST)
100      && (simcall_comm_wait__get__comm(r2)->comm.src_proc == NULL
101          || simcall_comm_wait__get__comm(r2)->comm.dst_proc == NULL))
102     return FALSE;
103
104   if(r1->call == SIMCALL_COMM_WAIT && r2->call == SIMCALL_COMM_WAIT
105      && simcall_comm_wait__get__comm(r1)->comm.src_buff == simcall_comm_wait__get__comm(r2)->comm.src_buff
106      && simcall_comm_wait__get__comm(r1)->comm.dst_buff == simcall_comm_wait__get__comm(r2)->comm.dst_buff)
107     return FALSE;
108
109   if (r1->call == SIMCALL_COMM_WAIT && r2->call == SIMCALL_COMM_WAIT
110       && simcall_comm_wait__get__comm(r1)->comm.src_buff != NULL
111       && simcall_comm_wait__get__comm(r1)->comm.dst_buff != NULL
112       && simcall_comm_wait__get__comm(r2)->comm.src_buff != NULL
113       && simcall_comm_wait__get__comm(r2)->comm.dst_buff != NULL
114       && simcall_comm_wait__get__comm(r1)->comm.dst_buff != simcall_comm_wait__get__comm(r2)->comm.src_buff
115       && simcall_comm_wait__get__comm(r1)->comm.dst_buff != simcall_comm_wait__get__comm(r2)->comm.dst_buff
116       && simcall_comm_wait__get__comm(r2)->comm.dst_buff != simcall_comm_wait__get__comm(r1)->comm.src_buff)
117     return FALSE;
118
119   if(r1->call == SIMCALL_COMM_TEST &&
120      (simcall_comm_test__get__comm(r1) == NULL
121       || simcall_comm_test__get__comm(r1)->comm.src_buff == NULL
122       || simcall_comm_test__get__comm(r1)->comm.dst_buff == NULL))
123     return FALSE;
124
125   if(r2->call == SIMCALL_COMM_TEST &&
126      (simcall_comm_test__get__comm(r2) == NULL
127       || simcall_comm_test__get__comm(r2)->comm.src_buff == NULL
128       || simcall_comm_test__get__comm(r2)->comm.dst_buff == NULL))
129     return FALSE;
130
131   if(r1->call == SIMCALL_COMM_TEST && r2->call == SIMCALL_COMM_WAIT
132      && simcall_comm_test__get__comm(r1)->comm.src_buff == simcall_comm_wait__get__comm(r2)->comm.src_buff
133      && simcall_comm_test__get__comm(r1)->comm.dst_buff == simcall_comm_wait__get__comm(r2)->comm.dst_buff)
134     return FALSE;
135
136   if(r1->call == SIMCALL_COMM_WAIT && r2->call == SIMCALL_COMM_TEST
137      && simcall_comm_wait__get__comm(r1)->comm.src_buff == simcall_comm_test__get__comm(r2)->comm.src_buff
138      && simcall_comm_wait__get__comm(r1)->comm.dst_buff == simcall_comm_test__get__comm(r2)->comm.dst_buff)
139     return FALSE;
140
141   if (r1->call == SIMCALL_COMM_WAIT && r2->call == SIMCALL_COMM_TEST
142       && simcall_comm_wait__get__comm(r1)->comm.src_buff != NULL
143       && simcall_comm_wait__get__comm(r1)->comm.dst_buff != NULL
144       && simcall_comm_test__get__comm(r2)->comm.src_buff != NULL
145       && simcall_comm_test__get__comm(r2)->comm.dst_buff != NULL
146       && simcall_comm_wait__get__comm(r1)->comm.dst_buff != simcall_comm_test__get__comm(r2)->comm.src_buff
147       && simcall_comm_wait__get__comm(r1)->comm.dst_buff != simcall_comm_test__get__comm(r2)->comm.dst_buff
148       && simcall_comm_test__get__comm(r2)->comm.dst_buff != simcall_comm_wait__get__comm(r1)->comm.src_buff)
149     return FALSE;
150
151   if (r1->call == SIMCALL_COMM_TEST && r2->call == SIMCALL_COMM_WAIT
152       && simcall_comm_test__get__comm(r1)->comm.src_buff != NULL
153       && simcall_comm_test__get__comm(r1)->comm.dst_buff != NULL
154       && simcall_comm_wait__get__comm(r2)->comm.src_buff != NULL
155       && simcall_comm_wait__get__comm(r2)->comm.dst_buff != NULL
156       && simcall_comm_test__get__comm(r1)->comm.dst_buff != simcall_comm_wait__get__comm(r2)->comm.src_buff
157       && simcall_comm_test__get__comm(r1)->comm.dst_buff != simcall_comm_wait__get__comm(r2)->comm.dst_buff
158       && simcall_comm_wait__get__comm(r2)->comm.dst_buff != simcall_comm_test__get__comm(r1)->comm.src_buff)
159     return FALSE;
160
161
162   return TRUE;
163 }
164
165 static char* pointer_to_string(void* pointer) {
166
167   if (XBT_LOG_ISENABLED(mc_request, xbt_log_priority_verbose))
168     return bprintf("%p", pointer);
169
170   return xbt_strdup("(verbose only)");
171 }
172
173 static char* buff_size_to_string(size_t buff_size) {
174
175   if (XBT_LOG_ISENABLED(mc_request, xbt_log_priority_verbose))
176     return bprintf("%zu", buff_size);
177
178   return xbt_strdup("(verbose only)");
179 }
180
181
182 char *MC_request_to_string(smx_simcall_t req, int value)
183 {
184   char *type = NULL, *args = NULL, *str = NULL, *p = NULL, *bs = NULL;
185   smx_action_t act = NULL;
186   size_t size = 0;
187
188   switch(req->call){
189     case SIMCALL_COMM_ISEND:
190     type = xbt_strdup("iSend");
191     p = pointer_to_string(simcall_comm_isend__get__src_buff(req));
192     bs = buff_size_to_string(simcall_comm_isend__get__src_buff_size(req));
193     if(req->issuer->smx_host)
194       args = bprintf("src=(%lu)%s (%s), buff=%s, size=%s", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host), req->issuer->name, p, bs);
195     else
196       args = bprintf("src=(%lu)%s, buff=%s, size=%s", req->issuer->pid, req->issuer->name, p, bs);
197     break;
198   case SIMCALL_COMM_IRECV:
199     size = simcall_comm_irecv__get__dst_buff_size(req) ? *simcall_comm_irecv__get__dst_buff_size(req) : 0;
200     type = xbt_strdup("iRecv");
201     p = pointer_to_string(simcall_comm_irecv__get__dst_buff(req)); 
202     bs = buff_size_to_string(size);
203     if(req->issuer->smx_host)
204       args = bprintf("dst=(%lu)%s (%s), buff=%s, size=%s", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host), req->issuer->name, p, bs);
205     else
206       args = bprintf("dst=(%lu)%s, buff=%s, size=%s", req->issuer->pid, req->issuer->name, p, bs);
207     break;
208   case SIMCALL_COMM_WAIT:
209     act = simcall_comm_wait__get__comm(req);
210     if(value == -1){
211       type = xbt_strdup("WaitTimeout");
212       p = pointer_to_string(act);
213       args = bprintf("comm=%s", p);
214     }else{
215       type = xbt_strdup("Wait");
216       p = pointer_to_string(act);
217       args  = bprintf("comm=%s [(%lu)%s (%s)-> (%lu)%s (%s)]", p,
218                       act->comm.src_proc ? act->comm.src_proc->pid : 0,
219                       act->comm.src_proc ? MSG_host_get_name(act->comm.src_proc->smx_host) : "",
220                       act->comm.src_proc ? act->comm.src_proc->name : "",
221                       act->comm.dst_proc ? act->comm.dst_proc->pid : 0,
222                       act->comm.dst_proc ? MSG_host_get_name(act->comm.dst_proc->smx_host) : "",
223                       act->comm.dst_proc ? act->comm.dst_proc->name : "");
224     }
225     break;
226   case SIMCALL_COMM_TEST:
227     act = simcall_comm_test__get__comm(req);
228     if(act->comm.src_proc == NULL || act->comm.dst_proc == NULL){
229       type = xbt_strdup("Test FALSE");
230       p = pointer_to_string(act);
231       args = bprintf("comm=%s", p);
232     }else{
233       type = xbt_strdup("Test TRUE");
234       p = pointer_to_string(act);
235       args  = bprintf("comm=%s [(%lu)%s (%s) -> (%lu)%s (%s)]", p,
236                       act->comm.src_proc->pid, act->comm.src_proc->name, MSG_host_get_name(act->comm.src_proc->smx_host),
237                       act->comm.dst_proc->pid, act->comm.dst_proc->name, MSG_host_get_name(act->comm.dst_proc->smx_host));
238     }
239     break;
240
241   case SIMCALL_COMM_WAITANY:
242     type = xbt_strdup("WaitAny");
243     if(!xbt_dynar_is_empty(simcall_comm_waitany__get__comms(req))){
244       p = pointer_to_string(xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), value, smx_action_t));
245       args = bprintf("comm=%s (%d of %lu)", p, 
246                      value+1, xbt_dynar_length(simcall_comm_waitany__get__comms(req)));
247     }else{
248       args = bprintf("comm at idx %d", value);
249     }
250     break;
251
252   case SIMCALL_COMM_TESTANY:
253     if(value == -1){
254       type = xbt_strdup("TestAny FALSE");
255       args = xbt_strdup("-");
256     }else{
257       type = xbt_strdup("TestAny");
258       args = bprintf("(%d of %lu)", value+1, xbt_dynar_length(simcall_comm_testany__get__comms(req)));
259     }
260     break;
261
262   case SIMCALL_MC_SNAPSHOT:
263     type = xbt_strdup("MC_SNAPSHOT");
264     args = '\0';
265     break;
266
267   case SIMCALL_MC_COMPARE_SNAPSHOTS:
268     type = xbt_strdup("MC_COMPARE_SNAPSHOTS");
269     args = '\0';
270     break;
271
272   case SIMCALL_MC_RANDOM:
273     type = xbt_strdup("MC_RANDOM");
274     args = bprintf("%d", value);
275     break;
276
277   default:
278     THROW_UNIMPLEMENTED;
279   }
280
281   if(args != NULL){
282     str = bprintf("[(%lu)%s (%s)] %s(%s) (%d)", req->issuer->pid , MSG_host_get_name(req->issuer->smx_host), req->issuer->name, type, args, req->call);
283   }else{
284     str = bprintf("[(%lu)%s (%s)] %s (%d) ", req->issuer->pid , MSG_host_get_name(req->issuer->smx_host), req->issuer->name, type, req->call);
285   }
286
287   xbt_free(args);
288   xbt_free(type);
289   xbt_free(p);
290   xbt_free(bs);
291   return str;
292 }
293
294 unsigned int MC_request_testany_fail(smx_simcall_t req)
295 {
296   unsigned int cursor;
297   smx_action_t action;
298
299   xbt_dynar_foreach(simcall_comm_testany__get__comms(req), cursor, action){
300     if(action->comm.src_proc && action->comm.dst_proc)
301       return FALSE;
302   }
303
304   return TRUE;
305 }
306
307 int MC_request_is_visible(smx_simcall_t req)
308 {
309   return req->call == SIMCALL_COMM_ISEND
310     || req->call == SIMCALL_COMM_IRECV
311     || req->call == SIMCALL_COMM_WAIT
312     || req->call == SIMCALL_COMM_WAITANY
313     || req->call == SIMCALL_COMM_TEST
314     || req->call == SIMCALL_COMM_TESTANY
315     || req->call == SIMCALL_MC_RANDOM
316     || req->call == SIMCALL_MC_SNAPSHOT
317     || req->call == SIMCALL_MC_COMPARE_SNAPSHOTS;
318 }
319
320 int MC_request_is_enabled(smx_simcall_t req)
321 {
322   unsigned int index = 0;
323   smx_action_t act;
324
325   switch (req->call) {
326
327   case SIMCALL_COMM_WAIT:
328     /* FIXME: check also that src and dst processes are not suspended */
329
330     /* If it has a timeout it will be always be enabled, because even if the
331      * communication is not ready, it can timeout and won't block.
332      * On the other hand if it hasn't a timeout, check if the comm is ready.*/
333     if(simcall_comm_wait__get__timeout(req) >= 0){
334       if(_sg_mc_timeout == 1){
335         return TRUE;
336       }else{
337         act = simcall_comm_wait__get__comm(req);
338         return (act->comm.src_proc && act->comm.dst_proc);
339       }
340     }else{
341       act = simcall_comm_wait__get__comm(req);
342       return (act->comm.src_proc && act->comm.dst_proc);
343     }
344     break;
345
346   case SIMCALL_COMM_WAITANY:
347     /* Check if it has at least one communication ready */
348     xbt_dynar_foreach(simcall_comm_waitany__get__comms(req), index, act) {
349       if (act->comm.src_proc && act->comm.dst_proc){
350         return TRUE;
351       }
352     }
353     return FALSE;
354     break;
355
356   default:
357     /* The rest of the request are always enabled */
358     return TRUE;
359   }
360 }
361
362 int MC_request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx)
363 {
364   smx_action_t act;
365
366   switch (req->call) {
367
368   case SIMCALL_COMM_WAIT:
369     /* FIXME: check also that src and dst processes are not suspended */
370     act = simcall_comm_wait__get__comm(req);
371     return (act->comm.src_proc && act->comm.dst_proc);
372     break;
373
374   case SIMCALL_COMM_WAITANY:
375     act = xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), idx, smx_action_t);
376     return (act->comm.src_proc && act->comm.dst_proc);
377     break;
378
379   case SIMCALL_COMM_TESTANY:
380     act = xbt_dynar_get_as(simcall_comm_testany__get__comms(req), idx, smx_action_t);
381     return (act->comm.src_proc && act->comm.dst_proc);
382     break;
383
384   default:
385     return TRUE;
386   }
387 }
388
389 int MC_process_is_enabled(smx_process_t process)
390 {
391   if (process->simcall.call != SIMCALL_NONE && MC_request_is_enabled(&process->simcall))
392     return TRUE;
393
394   return FALSE;
395 }
396
397 char *MC_request_get_dot_output(smx_simcall_t req, int value){
398
399   char *str = NULL, *label = NULL;
400   smx_action_t act = NULL;
401
402   switch(req->call){
403   case SIMCALL_COMM_ISEND:
404     if(req->issuer->smx_host)
405       label = bprintf("[(%lu)%s] iSend", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
406     else
407       label = bprintf("[(%lu)] iSend", req->issuer->pid);
408     break;
409     
410   case SIMCALL_COMM_IRECV:
411     if(req->issuer->smx_host)
412       label = bprintf("[(%lu)%s] iRecv", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
413     else
414       label = bprintf("[(%lu)] iRecv", req->issuer->pid);
415     break;
416     
417   case SIMCALL_COMM_WAIT:
418     act = simcall_comm_wait__get__comm(req);
419     if(value == -1){
420       if(req->issuer->smx_host)
421         label = bprintf("[(%lu)%s] WaitTimeout", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
422       else
423         label = bprintf("[(%lu)] WaitTimeout", req->issuer->pid);
424     }else{
425       if(req->issuer->smx_host)
426         label = bprintf("[(%lu)%s] Wait [(%lu)->(%lu)]", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host), act->comm.src_proc ? act->comm.src_proc->pid : 0, act->comm.dst_proc ? act->comm.dst_proc->pid : 0);
427       else
428         label = bprintf("[(%lu)] Wait [(%lu)->(%lu)]", req->issuer->pid, act->comm.src_proc ? act->comm.src_proc->pid : 0, act->comm.dst_proc ? act->comm.dst_proc->pid : 0);
429     }
430     break;
431     
432   case SIMCALL_COMM_TEST:
433     act = simcall_comm_test__get__comm(req);
434     if(act->comm.src_proc == NULL || act->comm.dst_proc == NULL){
435       if(req->issuer->smx_host)
436         label = bprintf("[(%lu)%s] Test FALSE", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
437       else
438         label = bprintf("[(%lu)] Test FALSE", req->issuer->pid);
439     }else{
440       if(req->issuer->smx_host)
441         label = bprintf("[(%lu)%s] Test TRUE", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
442       else
443         label = bprintf("[(%lu)] Test TRUE", req->issuer->pid);
444     }
445     break;
446
447   case SIMCALL_COMM_WAITANY:
448     if(req->issuer->smx_host)
449       label = bprintf("[(%lu)%s] WaitAny [%d of %lu]", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host), value+1, xbt_dynar_length(simcall_comm_waitany__get__comms(req)));
450     else
451       label = bprintf("[(%lu)] WaitAny [%d of %lu]", req->issuer->pid, value+1, xbt_dynar_length(simcall_comm_waitany__get__comms(req)));
452     break;
453     
454   case SIMCALL_COMM_TESTANY:
455     if(value == -1){
456       if(req->issuer->smx_host)
457         label = bprintf("[(%lu)%s] TestAny FALSE", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
458       else
459         label = bprintf("[(%lu)] TestAny FALSE", req->issuer->pid);
460     }else{
461       if(req->issuer->smx_host)
462         label = bprintf("[(%lu)%s] TestAny TRUE [%d of %lu]", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host), value+1, xbt_dynar_length(simcall_comm_testany__get__comms(req)));
463       else
464         label = bprintf("[(%lu)] TestAny TRUE [%d of %lu]", req->issuer->pid, value+1, xbt_dynar_length(simcall_comm_testany__get__comms(req)));
465     }
466     break;
467
468   case SIMCALL_MC_RANDOM:
469     if(req->issuer->smx_host)
470       label = bprintf("[(%lu)%s] MC_RANDOM (%d)", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host), value);
471     else
472       label = bprintf("[(%lu)] MC_RANDOM (%d)", req->issuer->pid, value);
473     break;
474
475   case SIMCALL_MC_SNAPSHOT:
476     if(req->issuer->smx_host)
477       label = bprintf("[(%lu)%s] MC_SNAPSHOT", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
478     else
479       label = bprintf("[(%lu)] MC_SNAPSHOT", req->issuer->pid);
480     break;
481
482   case SIMCALL_MC_COMPARE_SNAPSHOTS:
483     if(req->issuer->smx_host)
484       label = bprintf("[(%lu)%s] MC_COMPARE_SNAPSHOTS", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
485     else
486       label = bprintf("[(%lu)] MC_COMPARE_SNAPSHOTS", req->issuer->pid);
487     break;
488
489   default:
490     THROW_UNIMPLEMENTED;
491   }
492
493   str = bprintf("label = \"%s\", color = %s, fontcolor = %s", label, colors[req->issuer->pid-1], colors[req->issuer->pid-1]);
494   xbt_free(label);
495   return str;
496
497 }