Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'mc' into mc++
[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       if(act->comm.detached && act->comm.src_proc == NULL && act->comm.type == SIMIX_COMM_READY)
343         return (act->comm.dst_proc != NULL);
344       return (act->comm.src_proc && act->comm.dst_proc);
345     }
346     break;
347
348   case SIMCALL_COMM_WAITANY:
349     /* Check if it has at least one communication ready */
350     xbt_dynar_foreach(simcall_comm_waitany__get__comms(req), index, act) {
351       if (act->comm.src_proc && act->comm.dst_proc){
352         return TRUE;
353       }
354     }
355     return FALSE;
356     break;
357
358   default:
359     /* The rest of the request are always enabled */
360     return TRUE;
361   }
362 }
363
364 int MC_request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx)
365 {
366   smx_action_t act;
367
368   switch (req->call) {
369
370   case SIMCALL_COMM_WAIT:
371     /* FIXME: check also that src and dst processes are not suspended */
372     act = simcall_comm_wait__get__comm(req);
373     return (act->comm.src_proc && act->comm.dst_proc);
374     break;
375
376   case SIMCALL_COMM_WAITANY:
377     act = xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), idx, smx_action_t);
378     return (act->comm.src_proc && act->comm.dst_proc);
379     break;
380
381   case SIMCALL_COMM_TESTANY:
382     act = xbt_dynar_get_as(simcall_comm_testany__get__comms(req), idx, smx_action_t);
383     return (act->comm.src_proc && act->comm.dst_proc);
384     break;
385
386   default:
387     return TRUE;
388   }
389 }
390
391 int MC_process_is_enabled(smx_process_t process)
392 {
393   if (process->simcall.call != SIMCALL_NONE && MC_request_is_enabled(&process->simcall))
394     return TRUE;
395
396   return FALSE;
397 }
398
399 char *MC_request_get_dot_output(smx_simcall_t req, int value){
400
401   char *str = NULL, *label = NULL;
402   smx_action_t act = NULL;
403
404   switch(req->call){
405   case SIMCALL_COMM_ISEND:
406     if(req->issuer->smx_host)
407       label = bprintf("[(%lu)%s] iSend", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
408     else
409       label = bprintf("[(%lu)] iSend", req->issuer->pid);
410     break;
411     
412   case SIMCALL_COMM_IRECV:
413     if(req->issuer->smx_host)
414       label = bprintf("[(%lu)%s] iRecv", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
415     else
416       label = bprintf("[(%lu)] iRecv", req->issuer->pid);
417     break;
418     
419   case SIMCALL_COMM_WAIT:
420     act = simcall_comm_wait__get__comm(req);
421     if(value == -1){
422       if(req->issuer->smx_host)
423         label = bprintf("[(%lu)%s] WaitTimeout", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
424       else
425         label = bprintf("[(%lu)] WaitTimeout", req->issuer->pid);
426     }else{
427       if(req->issuer->smx_host)
428         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);
429       else
430         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);
431     }
432     break;
433     
434   case SIMCALL_COMM_TEST:
435     act = simcall_comm_test__get__comm(req);
436     if(act->comm.src_proc == NULL || act->comm.dst_proc == NULL){
437       if(req->issuer->smx_host)
438         label = bprintf("[(%lu)%s] Test FALSE", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
439       else
440         label = bprintf("[(%lu)] Test FALSE", req->issuer->pid);
441     }else{
442       if(req->issuer->smx_host)
443         label = bprintf("[(%lu)%s] Test TRUE", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
444       else
445         label = bprintf("[(%lu)] Test TRUE", req->issuer->pid);
446     }
447     break;
448
449   case SIMCALL_COMM_WAITANY:
450     if(req->issuer->smx_host)
451       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)));
452     else
453       label = bprintf("[(%lu)] WaitAny [%d of %lu]", req->issuer->pid, value+1, xbt_dynar_length(simcall_comm_waitany__get__comms(req)));
454     break;
455     
456   case SIMCALL_COMM_TESTANY:
457     if(value == -1){
458       if(req->issuer->smx_host)
459         label = bprintf("[(%lu)%s] TestAny FALSE", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
460       else
461         label = bprintf("[(%lu)] TestAny FALSE", req->issuer->pid);
462     }else{
463       if(req->issuer->smx_host)
464         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)));
465       else
466         label = bprintf("[(%lu)] TestAny TRUE [%d of %lu]", req->issuer->pid, value+1, xbt_dynar_length(simcall_comm_testany__get__comms(req)));
467     }
468     break;
469
470   case SIMCALL_MC_RANDOM:
471     if(req->issuer->smx_host)
472       label = bprintf("[(%lu)%s] MC_RANDOM (%d)", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host), value);
473     else
474       label = bprintf("[(%lu)] MC_RANDOM (%d)", req->issuer->pid, value);
475     break;
476
477   case SIMCALL_MC_SNAPSHOT:
478     if(req->issuer->smx_host)
479       label = bprintf("[(%lu)%s] MC_SNAPSHOT", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
480     else
481       label = bprintf("[(%lu)] MC_SNAPSHOT", req->issuer->pid);
482     break;
483
484   case SIMCALL_MC_COMPARE_SNAPSHOTS:
485     if(req->issuer->smx_host)
486       label = bprintf("[(%lu)%s] MC_COMPARE_SNAPSHOTS", req->issuer->pid, MSG_host_get_name(req->issuer->smx_host));
487     else
488       label = bprintf("[(%lu)] MC_COMPARE_SNAPSHOTS", req->issuer->pid);
489     break;
490
491   default:
492     THROW_UNIMPLEMENTED;
493   }
494
495   str = bprintf("label = \"%s\", color = %s, fontcolor = %s", label, colors[req->issuer->pid-1], colors[req->issuer->pid-1]);
496   xbt_free(label);
497   return str;
498
499 }