Logo AND Algorithmique Numérique Distribuée

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