Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Introduce a class mc::SimcallInspector, that allows MC to learn about the ongoing...
[simgrid.git] / src / mc / mc_request.cpp
1 /* Copyright (c) 2008-2019. The 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 "src/mc/mc_request.hpp"
7 #include "src/include/mc/mc.h"
8 #include "src/kernel/activity/CommImpl.hpp"
9 #include "src/kernel/activity/MutexImpl.hpp"
10 #include "src/mc/ModelChecker.hpp"
11 #include "src/mc/checker/SimcallInspector.hpp"
12 #include "src/mc/mc_smx.hpp"
13
14 using simgrid::mc::remote;
15
16 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_request, mc,
17                                 "Logging specific to MC (request)");
18
19 static char *pointer_to_string(void *pointer);
20 static char *buff_size_to_string(size_t size);
21
22 static inline simgrid::kernel::activity::CommImpl* MC_get_comm(smx_simcall_t r)
23 {
24   switch (r->call_) {
25     case SIMCALL_COMM_WAIT:
26       return static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(r));
27     case SIMCALL_COMM_TEST:
28       return static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_test__getraw__comm(r));
29     default:
30       return nullptr;
31   }
32 }
33
34 static inline
35 smx_mailbox_t MC_get_mbox(smx_simcall_t r)
36 {
37   switch (r->call_) {
38     case SIMCALL_COMM_ISEND:
39       return simcall_comm_isend__get__mbox(r);
40     case SIMCALL_COMM_IRECV:
41       return simcall_comm_irecv__get__mbox(r);
42     default:
43       return nullptr;
44   }
45 }
46
47 namespace simgrid {
48 namespace mc {
49
50 // Does half the job
51 static inline
52 bool request_depend_asymmetric(smx_simcall_t r1, smx_simcall_t r2)
53 {
54   if (r1->call_ == SIMCALL_COMM_ISEND && r2->call_ == SIMCALL_COMM_IRECV)
55     return false;
56
57   if (r1->call_ == SIMCALL_COMM_IRECV && r2->call_ == SIMCALL_COMM_ISEND)
58     return false;
59
60   // Those are internal requests, we do not need indirection
61   // because those objects are copies:
62   simgrid::kernel::activity::CommImpl* synchro1 = MC_get_comm(r1);
63   simgrid::kernel::activity::CommImpl* synchro2 = MC_get_comm(r2);
64
65   if ((r1->call_ == SIMCALL_COMM_ISEND || r1->call_ == SIMCALL_COMM_IRECV) && r2->call_ == SIMCALL_COMM_WAIT) {
66
67     smx_mailbox_t mbox = MC_get_mbox(r1);
68
69     if (mbox != synchro2->mbox_cpy
70         && simcall_comm_wait__get__timeout(r2) <= 0)
71       return false;
72
73     if ((r1->issuer_ != synchro2->src_actor_.get()) && (r1->issuer_ != synchro2->dst_actor_.get()) &&
74         simcall_comm_wait__get__timeout(r2) <= 0)
75       return false;
76
77     if ((r1->call_ == SIMCALL_COMM_ISEND) && (synchro2->type_ == kernel::activity::CommImpl::Type::SEND) &&
78         (synchro2->src_buff_ != simcall_comm_isend__get__src_buff(r1)) && simcall_comm_wait__get__timeout(r2) <= 0)
79       return false;
80
81     if ((r1->call_ == SIMCALL_COMM_IRECV) && (synchro2->type_ == kernel::activity::CommImpl::Type::RECEIVE) &&
82         (synchro2->dst_buff_ != simcall_comm_irecv__get__dst_buff(r1)) && simcall_comm_wait__get__timeout(r2) <= 0)
83       return false;
84   }
85
86   /* FIXME: the following rule assumes that the result of the
87    * isend/irecv call is not stored in a buffer used in the
88    * test call. */
89 #if 0
90   if((r1->call == SIMCALL_COMM_ISEND || r1->call == SIMCALL_COMM_IRECV)
91      &&  r2->call == SIMCALL_COMM_TEST)
92      return false;
93 #endif
94
95   if (r1->call_ == SIMCALL_COMM_WAIT && (r2->call_ == SIMCALL_COMM_WAIT || r2->call_ == SIMCALL_COMM_TEST) &&
96       (synchro1->src_actor_.get() == nullptr || synchro1->dst_actor_.get() == nullptr))
97     return false;
98
99   if (r1->call_ == SIMCALL_COMM_TEST &&
100       (simcall_comm_test__get__comm(r1) == nullptr || synchro1->src_buff_ == nullptr || synchro1->dst_buff_ == nullptr))
101     return false;
102
103   if (r1->call_ == SIMCALL_COMM_TEST && r2->call_ == SIMCALL_COMM_WAIT && synchro1->src_buff_ == synchro2->src_buff_ &&
104       synchro1->dst_buff_ == synchro2->dst_buff_)
105     return false;
106
107   if (r1->call_ == SIMCALL_COMM_WAIT && r2->call_ == SIMCALL_COMM_TEST && synchro1->src_buff_ != nullptr &&
108       synchro1->dst_buff_ != nullptr && synchro2->src_buff_ != nullptr && synchro2->dst_buff_ != nullptr &&
109       synchro1->dst_buff_ != synchro2->src_buff_ && synchro1->dst_buff_ != synchro2->dst_buff_ &&
110       synchro2->dst_buff_ != synchro1->src_buff_)
111     return false;
112
113   return true;
114 }
115
116 // Those are internal_req
117 bool request_depend(smx_simcall_t req1, smx_simcall_t req2)
118 {
119   if (req1->issuer_ == req2->issuer_)
120     return false;
121
122   /* Wait with timeout transitions are not considered by the independence theorem, thus we consider them as dependent with all other transitions */
123   if ((req1->call_ == SIMCALL_COMM_WAIT && simcall_comm_wait__get__timeout(req1) > 0) ||
124       (req2->call_ == SIMCALL_COMM_WAIT && simcall_comm_wait__get__timeout(req2) > 0))
125     return true;
126
127   if (req1->call_ != req2->call_)
128     return request_depend_asymmetric(req1, req2) && request_depend_asymmetric(req2, req1);
129
130   // Those are internal requests, we do not need indirection
131   // because those objects are copies:
132   simgrid::kernel::activity::CommImpl* synchro1 = MC_get_comm(req1);
133   simgrid::kernel::activity::CommImpl* synchro2 = MC_get_comm(req2);
134
135   switch (req1->call_) {
136     case SIMCALL_COMM_ISEND:
137       return simcall_comm_isend__get__mbox(req1) == simcall_comm_isend__get__mbox(req2);
138     case SIMCALL_COMM_IRECV:
139       return simcall_comm_irecv__get__mbox(req1) == simcall_comm_irecv__get__mbox(req2);
140     case SIMCALL_COMM_WAIT:
141       if (synchro1->src_buff_ == synchro2->src_buff_ && synchro1->dst_buff_ == synchro2->dst_buff_)
142         return false;
143       if (synchro1->src_buff_ != nullptr && synchro1->dst_buff_ != nullptr && synchro2->src_buff_ != nullptr &&
144           synchro2->dst_buff_ != nullptr && synchro1->dst_buff_ != synchro2->src_buff_ &&
145           synchro1->dst_buff_ != synchro2->dst_buff_ && synchro2->dst_buff_ != synchro1->src_buff_)
146         return false;
147       return true;
148     default:
149       return true;
150   }
151 }
152
153 }
154 }
155
156 static char *pointer_to_string(void *pointer)
157 {
158
159   if (XBT_LOG_ISENABLED(mc_request, xbt_log_priority_verbose))
160     return bprintf("%p", pointer);
161
162   return xbt_strdup("(verbose only)");
163 }
164
165 static char *buff_size_to_string(size_t buff_size)
166 {
167
168   if (XBT_LOG_ISENABLED(mc_request, xbt_log_priority_verbose))
169     return bprintf("%zu", buff_size);
170
171   return xbt_strdup("(verbose only)");
172 }
173
174
175 std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid::mc::RequestType request_type)
176 {
177   xbt_assert(mc_model_checker != nullptr, "Must be called from MCer");
178
179   if (req->inspector_ != nullptr)
180     return req->inspector_->to_string();
181
182   bool use_remote_comm = true;
183   switch(request_type) {
184   case simgrid::mc::RequestType::simix:
185     use_remote_comm = true;
186     break;
187   case simgrid::mc::RequestType::executed:
188   case simgrid::mc::RequestType::internal:
189     use_remote_comm = false;
190     break;
191   default:
192     THROW_IMPOSSIBLE;
193   }
194
195   const char* type = nullptr;
196   char *args = nullptr;
197
198   smx_actor_t issuer = MC_smx_simcall_get_issuer(req);
199
200   switch (req->call_) {
201
202     case SIMCALL_COMM_ISEND: {
203       type     = "iSend";
204       char* p  = pointer_to_string(simcall_comm_isend__get__src_buff(req));
205       char* bs = buff_size_to_string(simcall_comm_isend__get__src_buff_size(req));
206       if (issuer->get_host())
207         args = bprintf("src=(%ld)%s (%s), buff=%s, size=%s", issuer->get_pid(), MC_smx_actor_get_host_name(issuer),
208                        MC_smx_actor_get_name(issuer), p, bs);
209       else
210         args = bprintf("src=(%ld)%s, buff=%s, size=%s", issuer->get_pid(), MC_smx_actor_get_name(issuer), p, bs);
211       xbt_free(bs);
212       xbt_free(p);
213       break;
214     }
215
216     case SIMCALL_COMM_IRECV: {
217       size_t* remote_size = simcall_comm_irecv__get__dst_buff_size(req);
218       size_t size         = 0;
219       if (remote_size)
220         mc_model_checker->process().read_bytes(&size, sizeof(size), remote(remote_size));
221
222       type     = "iRecv";
223       char* p  = pointer_to_string(simcall_comm_irecv__get__dst_buff(req));
224       char* bs = buff_size_to_string(size);
225       if (issuer->get_host())
226         args = bprintf("dst=(%ld)%s (%s), buff=%s, size=%s", issuer->get_pid(), MC_smx_actor_get_host_name(issuer),
227                        MC_smx_actor_get_name(issuer), p, bs);
228       else
229         args = bprintf("dst=(%ld)%s, buff=%s, size=%s", issuer->get_pid(), MC_smx_actor_get_name(issuer), p, bs);
230       xbt_free(bs);
231       xbt_free(p);
232       break;
233     }
234
235     case SIMCALL_COMM_WAIT: {
236       simgrid::kernel::activity::CommImpl* remote_act =
237           static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(req));
238       char* p;
239       if (value == -1) {
240         type = "WaitTimeout";
241         p    = pointer_to_string(remote_act);
242         args = bprintf("comm=%s", p);
243       } else {
244         type = "Wait";
245         p    = pointer_to_string(remote_act);
246
247         simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_synchro;
248         simgrid::kernel::activity::CommImpl* act;
249         if (use_remote_comm) {
250           mc_model_checker->process().read(temp_synchro,
251                                            remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
252           act = temp_synchro.get_buffer();
253         } else
254           act = remote_act;
255
256         smx_actor_t src_proc = mc_model_checker->process().resolve_actor(simgrid::mc::remote(act->src_actor_.get()));
257         smx_actor_t dst_proc = mc_model_checker->process().resolve_actor(simgrid::mc::remote(act->dst_actor_.get()));
258         args                 = bprintf("comm=%s [(%ld)%s (%s)-> (%ld)%s (%s)]", p, src_proc ? src_proc->get_pid() : 0,
259                        src_proc ? MC_smx_actor_get_host_name(src_proc) : "",
260                        src_proc ? MC_smx_actor_get_name(src_proc) : "", dst_proc ? dst_proc->get_pid() : 0,
261                        dst_proc ? MC_smx_actor_get_host_name(dst_proc) : "",
262                        dst_proc ? MC_smx_actor_get_name(dst_proc) : "");
263       }
264       xbt_free(p);
265       break;
266     }
267
268     case SIMCALL_COMM_TEST: {
269       simgrid::kernel::activity::CommImpl* remote_act =
270           static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_test__getraw__comm(req));
271       simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_synchro;
272       simgrid::kernel::activity::CommImpl* act;
273       if (use_remote_comm) {
274         mc_model_checker->process().read(temp_synchro,
275                                          remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
276         act = temp_synchro.get_buffer();
277       } else
278         act = remote_act;
279
280       char* p;
281       if (act->src_actor_.get() == nullptr || act->dst_actor_.get() == nullptr) {
282         type = "Test FALSE";
283         p    = pointer_to_string(remote_act);
284         args = bprintf("comm=%s", p);
285       } else {
286         type = "Test TRUE";
287         p    = pointer_to_string(remote_act);
288
289         smx_actor_t src_proc = mc_model_checker->process().resolve_actor(simgrid::mc::remote(act->src_actor_.get()));
290         smx_actor_t dst_proc = mc_model_checker->process().resolve_actor(simgrid::mc::remote(act->dst_actor_.get()));
291         args                 = bprintf("comm=%s [(%ld)%s (%s) -> (%ld)%s (%s)]", p, src_proc->get_pid(),
292                        MC_smx_actor_get_name(src_proc), MC_smx_actor_get_host_name(src_proc), dst_proc->get_pid(),
293                        MC_smx_actor_get_name(dst_proc), MC_smx_actor_get_host_name(dst_proc));
294       }
295       xbt_free(p);
296       break;
297     }
298
299     case SIMCALL_COMM_WAITANY: {
300       type         = "WaitAny";
301       size_t count = simcall_comm_waitany__get__count(req);
302       if (count > 0) {
303         simgrid::kernel::activity::CommImpl* remote_sync;
304         remote_sync = mc_model_checker->process().read(remote(simcall_comm_waitany__get__comms(req) + value));
305         char* p     = pointer_to_string(remote_sync);
306         args        = bprintf("comm=%s (%d of %zu)", p, value + 1, count);
307         xbt_free(p);
308       } else
309         args = bprintf("comm at idx %d", value);
310       break;
311     }
312
313     case SIMCALL_COMM_TESTANY:
314       if (value == -1) {
315         type = "TestAny FALSE";
316         args = xbt_strdup("-");
317       } else {
318         type = "TestAny";
319         args = bprintf("(%d of %zu)", value + 1, simcall_comm_testany__get__count(req));
320       }
321       break;
322
323     case SIMCALL_MUTEX_TRYLOCK:
324     case SIMCALL_MUTEX_LOCK: {
325       if (req->call_ == SIMCALL_MUTEX_LOCK)
326         type = "Mutex LOCK";
327       else
328         type = "Mutex TRYLOCK";
329
330       simgrid::mc::Remote<simgrid::kernel::activity::MutexImpl> mutex;
331       mc_model_checker->process().read_bytes(mutex.get_buffer(), sizeof(mutex),
332                                              remote(req->call_ == SIMCALL_MUTEX_LOCK
333                                                         ? simcall_mutex_lock__get__mutex(req)
334                                                         : simcall_mutex_trylock__get__mutex(req)));
335       args = bprintf("locked = %d, owner = %d, sleeping = n/a", mutex.get_buffer()->is_locked(),
336                      mutex.get_buffer()->owner_ != nullptr
337                          ? (int)mc_model_checker->process()
338                                .resolve_actor(simgrid::mc::remote(mutex.get_buffer()->owner_))
339                                ->get_pid()
340                          : -1);
341       break;
342     }
343
344     case SIMCALL_MC_RANDOM:
345       type = "MC_RANDOM";
346       args = bprintf("%d", value);
347       break;
348
349     default:
350       type = SIMIX_simcall_name(req->call_);
351       args = bprintf("??");
352       break;
353   }
354
355   std::string str;
356   if (args != nullptr)
357     str = simgrid::xbt::string_printf("[(%ld)%s (%s)] %s(%s)", issuer->get_pid(), MC_smx_actor_get_host_name(issuer),
358                                       MC_smx_actor_get_name(issuer), type, args);
359   else
360     str = simgrid::xbt::string_printf("[(%ld)%s (%s)] %s ", issuer->get_pid(), MC_smx_actor_get_host_name(issuer),
361                                       MC_smx_actor_get_name(issuer), type);
362   xbt_free(args);
363   return str;
364 }
365
366 namespace simgrid {
367 namespace mc {
368
369 bool request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx)
370 {
371   simgrid::kernel::activity::CommImpl* remote_act = nullptr;
372   switch (req->call_) {
373
374     case SIMCALL_COMM_WAIT:
375       /* FIXME: check also that src and dst processes are not suspended */
376       remote_act = simcall_comm_wait__getraw__comm(req);
377       break;
378
379     case SIMCALL_COMM_WAITANY:
380       remote_act = mc_model_checker->process().read(remote(simcall_comm_testany__get__comms(req) + idx));
381       break;
382
383     case SIMCALL_COMM_TESTANY:
384       remote_act = mc_model_checker->process().read(remote(simcall_comm_testany__get__comms(req) + idx));
385       break;
386
387     default:
388       return true;
389   }
390
391   simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
392   mc_model_checker->process().read(temp_comm, remote(remote_act));
393   simgrid::kernel::activity::CommImpl* comm = temp_comm.get_buffer();
394   return comm->src_actor_.get() && comm->dst_actor_.get();
395 }
396
397
398 static const char* colors[] = {
399   "blue",
400   "red",
401   "green3",
402   "goldenrod",
403   "brown",
404   "purple",
405   "magenta",
406   "turquoise4",
407   "gray25",
408   "forestgreen",
409   "hotpink",
410   "lightblue",
411   "tan",
412 };
413
414 static inline const char* get_color(int id)
415 {
416   return colors[id % (sizeof(colors) / sizeof(colors[0])) ];
417 }
418
419 std::string request_get_dot_output(smx_simcall_t req, int value)
420 {
421   const smx_actor_t issuer = MC_smx_simcall_get_issuer(req);
422   const char* color        = get_color(issuer->get_pid() - 1);
423
424   if (req->inspector_ != nullptr)
425     return simgrid::xbt::string_printf("label = \"%s\", color = %s, fontcolor = %s",
426                                        req->inspector_->dot_label().c_str(), color, color);
427
428   std::string label;
429
430   switch (req->call_) {
431     case SIMCALL_COMM_ISEND:
432       if (issuer->get_host())
433         label = simgrid::xbt::string_printf("[(%ld)%s] iSend", issuer->get_pid(), MC_smx_actor_get_host_name(issuer));
434       else
435         label = bprintf("[(%ld)] iSend", issuer->get_pid());
436       break;
437
438     case SIMCALL_COMM_IRECV:
439       if (issuer->get_host())
440         label = simgrid::xbt::string_printf("[(%ld)%s] iRecv", issuer->get_pid(), MC_smx_actor_get_host_name(issuer));
441       else
442         label = simgrid::xbt::string_printf("[(%ld)] iRecv", issuer->get_pid());
443       break;
444
445     case SIMCALL_COMM_WAIT:
446       if (value == -1) {
447         if (issuer->get_host())
448           label = simgrid::xbt::string_printf("[(%ld)%s] WaitTimeout", issuer->get_pid(),
449                                               MC_smx_actor_get_host_name(issuer));
450         else
451           label = simgrid::xbt::string_printf("[(%ld)] WaitTimeout", issuer->get_pid());
452       } else {
453         simgrid::kernel::activity::ActivityImpl* remote_act = simcall_comm_wait__getraw__comm(req);
454         simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
455         mc_model_checker->process().read(temp_comm,
456                                          remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
457         simgrid::kernel::activity::CommImpl* comm = temp_comm.get_buffer();
458
459         smx_actor_t src_proc = mc_model_checker->process().resolve_actor(simgrid::mc::remote(comm->src_actor_.get()));
460         smx_actor_t dst_proc = mc_model_checker->process().resolve_actor(simgrid::mc::remote(comm->dst_actor_.get()));
461         if (issuer->get_host())
462           label = simgrid::xbt::string_printf("[(%ld)%s] Wait [(%ld)->(%ld)]", issuer->get_pid(),
463                                               MC_smx_actor_get_host_name(issuer), src_proc ? src_proc->get_pid() : 0,
464                                               dst_proc ? dst_proc->get_pid() : 0);
465         else
466           label = simgrid::xbt::string_printf("[(%ld)] Wait [(%ld)->(%ld)]", issuer->get_pid(),
467                                               src_proc ? src_proc->get_pid() : 0, dst_proc ? dst_proc->get_pid() : 0);
468       }
469       break;
470
471     case SIMCALL_COMM_TEST: {
472       simgrid::kernel::activity::ActivityImpl* remote_act = simcall_comm_test__getraw__comm(req);
473       simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
474       mc_model_checker->process().read(temp_comm,
475                                        remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
476       simgrid::kernel::activity::CommImpl* comm = temp_comm.get_buffer();
477       if (comm->src_actor_.get() == nullptr || comm->dst_actor_.get() == nullptr) {
478         if (issuer->get_host())
479           label = simgrid::xbt::string_printf("[(%ld)%s] Test FALSE", issuer->get_pid(),
480                                               MC_smx_actor_get_host_name(issuer));
481         else
482           label = bprintf("[(%ld)] Test FALSE", issuer->get_pid());
483       } else {
484         if (issuer->get_host())
485           label =
486               simgrid::xbt::string_printf("[(%ld)%s] Test TRUE", issuer->get_pid(), MC_smx_actor_get_host_name(issuer));
487         else
488           label = simgrid::xbt::string_printf("[(%ld)] Test TRUE", issuer->get_pid());
489       }
490       break;
491     }
492
493     case SIMCALL_COMM_WAITANY: {
494       size_t comms_size = simcall_comm_waitany__get__count(req);
495       if (issuer->get_host())
496         label = simgrid::xbt::string_printf("[(%ld)%s] WaitAny [%d of %zu]", issuer->get_pid(),
497                                             MC_smx_actor_get_host_name(issuer), value + 1, comms_size);
498       else
499         label = simgrid::xbt::string_printf("[(%ld)] WaitAny [%d of %zu]", issuer->get_pid(), value + 1, comms_size);
500       break;
501     }
502
503     case SIMCALL_COMM_TESTANY:
504       if (value == -1) {
505         if (issuer->get_host())
506           label = simgrid::xbt::string_printf("[(%ld)%s] TestAny FALSE", issuer->get_pid(),
507                                               MC_smx_actor_get_host_name(issuer));
508         else
509           label = simgrid::xbt::string_printf("[(%ld)] TestAny FALSE", issuer->get_pid());
510       } else {
511         if (issuer->get_host())
512           label = simgrid::xbt::string_printf("[(%ld)%s] TestAny TRUE [%d of %lu]", issuer->get_pid(),
513                                               MC_smx_actor_get_host_name(issuer), value + 1,
514                                               simcall_comm_testany__get__count(req));
515         else
516           label = simgrid::xbt::string_printf("[(%ld)] TestAny TRUE [%d of %lu]", issuer->get_pid(), value + 1,
517                                               simcall_comm_testany__get__count(req));
518       }
519       break;
520
521     case SIMCALL_MUTEX_TRYLOCK:
522       label = simgrid::xbt::string_printf("[(%ld)] Mutex TRYLOCK", issuer->get_pid());
523       break;
524
525     case SIMCALL_MUTEX_LOCK:
526       label = simgrid::xbt::string_printf("[(%ld)] Mutex LOCK", issuer->get_pid());
527       break;
528
529     case SIMCALL_MC_RANDOM:
530       if (issuer->get_host())
531         label = simgrid::xbt::string_printf("[(%ld)%s] MC_RANDOM (%d)", issuer->get_pid(),
532                                             MC_smx_actor_get_host_name(issuer), value);
533       else
534         label = simgrid::xbt::string_printf("[(%ld)] MC_RANDOM (%d)", issuer->get_pid(), value);
535       break;
536
537     default:
538       THROW_UNIMPLEMENTED;
539   }
540
541   return  simgrid::xbt::string_printf(
542         "label = \"%s\", color = %s, fontcolor = %s", label.c_str(),
543         color, color);
544 }
545
546 }
547 }