Logo AND Algorithmique Numérique Distribuée

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