1 /* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved. */
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. */
6 /* This example shows how to simulate a non-linear resource sharing for
12 #include <simgrid/kernel/ProfileBuilder.hpp>
13 #include <simgrid/s4u.hpp>
19 //#include "../../src/kernel/activity/ActivityImpl.hpp"
21 namespace sg4 = simgrid::s4u;
22 namespace pr = simgrid::kernel::profile;
24 XBT_LOG_NEW_DEFAULT_CATEGORY(comm_fault_scenarios, "Messages specific for this s4u example");
26 /*************************************************************************************************/
28 // Constants for platform configuration
30 constexpr double HostComputePower = 1e9; // FLOPs
31 constexpr double LinkBandwidth = 1e9; // Bytes/second
32 constexpr double LinkLatency = 1e-6; // Seconds
34 // Constants for application behaviour
36 constexpr uint64_t MsgSize = LinkBandwidth / 2;
38 /*************************************************************************************************/
52 enum class Action { SLEEP, PUT, GET, START, WAIT, DIE, END };
54 static const char* to_string(const Action x)
77 double rel_time; // Time relative to Scenario startTime
78 enum { STATE, ACTION } type;
79 enum { LNK, SND, RCV } entity;
90 std::vector<Step> steps;
94 static std::string to_string(const Scenario& s)
98 ss <<"#"<< s.index << "[" << s.start_time << "s," << s.start_time + s.duration << "s[: (";
100 case CommType::EAGER_SYNC:
103 case CommType::EAGER_ASYNC:
106 case CommType::EAGER_INIT:
109 case CommType::RDV_SYNC:
112 case CommType::RDV_ASYNC:
115 case CommType::RDV_INIT:
118 case CommType::ONESIDE_SYNC:
119 ss << "ONESIDE_SYNC";
121 case CommType::ONESIDE_ASYNC:
122 ss << "ONESIDE_ASYNC";
124 case CommType::ONESIDE_INIT:
125 ss << "ONESIDE_INIT";
128 ss << ") Expected: S:" << to_string(s.snd_expected) << " R:" << to_string(s.rcv_expected) << " Steps: ";
129 for (const Step& step : s.steps) {
130 ss << "+" << step.rel_time << "s:";
131 switch (step.entity) {
143 if (step.type == Step::STATE) {
150 ss << "." << to_string(step.action_type);
155 return ss.str().c_str();
158 std::vector<Scenario> scenarios;
160 sg4::Mailbox* mbox_eager = nullptr;
161 sg4::Mailbox* mbox_rdv = nullptr;
166 static size_t scenario;
169 sg4::Host* other_host;
171 sg4::CommPtr do_put(CommType type, double& send_value)
174 case CommType::EAGER_SYNC:
175 mbox_eager->put(&send_value, MsgSize);
177 case CommType::EAGER_ASYNC:
178 return mbox_eager->put_async(&send_value, MsgSize);
179 case CommType::EAGER_INIT:
180 return mbox_eager->put_init(&send_value, MsgSize);
181 case CommType::RDV_SYNC:
182 mbox_rdv->put(&send_value, MsgSize);
184 case CommType::RDV_ASYNC:
185 return mbox_rdv->put_async(&send_value, MsgSize);
186 case CommType::RDV_INIT:
187 return mbox_rdv->put_init(&send_value, MsgSize);
188 case CommType::ONESIDE_SYNC:
189 sg4::Comm::sendto(sg4::this_actor::get_host(), other_host, MsgSize);
191 case CommType::ONESIDE_ASYNC:
192 return sg4::Comm::sendto_async(sg4::this_actor::get_host(), other_host, MsgSize);
193 case CommType::ONESIDE_INIT:
194 return sg4::Comm::sendto_init()->set_payload_size(MsgSize);
195 // FIXME: how to set hosts? sg4::this_actor::get_host(),other_host
200 void send_message(const Scenario& s)
203 sg4::CommPtr comm = nullptr;
204 // CommType type=s.type;
205 Action expected = s.snd_expected;
206 double end_time = s.start_time + s.duration;
207 // double curr_rel_time=0;
208 send_value = end_time;
209 size_t step_index = 0;
211 sg4::this_actor::sleep_until(s.start_time);
212 for (; step_index < s.steps.size(); step_index++) {
213 const Step& step = s.steps[step_index];
214 if (step.entity != Step::SND || step.type != Step::ACTION)
218 sg4::this_actor::sleep_until(s.start_time + step.rel_time);
219 } catch (std::exception& e) {
220 XBT_DEBUG("During Sleep, failed to send message because of a %s exception (%s)", typeid(e).name(), e.what());
224 // Check if the other host is still OK.
225 if (not other_host->is_on())
228 // Perform the action
230 switch (step.action_type) {
232 comm=do_put(s.type, send_value);
241 xbt_die("Not a valid action for SND");
243 } catch (std::exception& e) {
244 XBT_DEBUG("During %s, failed to send message because of a %s exception (%s)", to_string(step.action_type),
245 typeid(e).name(), e.what());
249 //xbt_assert(comm->get_impl()->get_refcount()==1);
253 sg4::this_actor::sleep_until(end_time);
254 } catch (std::exception& e) {
255 XBT_DEBUG("During Sleep, failed to send message because of a %s exception (%s)", typeid(e).name(), e.what());
258 Action outcome = Action::END;
259 std::string scenario_string = to_string(s);
260 if (step_index < s.steps.size()) {
261 const Step& step = s.steps[step_index];
262 assert(step.entity == Step::SND && step.type == Step::ACTION);
263 outcome = step.action_type;
266 if (outcome != expected) {
267 XBT_ERROR("Expected %s but got %s in %s", to_string(expected), to_string(outcome), scenario_string.c_str());
269 XBT_INFO("OK: %s", scenario_string.c_str());
271 sg4::this_actor::sleep_until(end_time);
273 xbt_assert(not mbox_eager->listen(), "Mailbox should not have ongoing communication!");
274 xbt_assert(not mbox_rdv->listen(), "Mailbox should not have ongoing communication!");
279 explicit SendAgent(int id, sg4::Host* other_host) : id(id), other_host(other_host) {}
284 XBT_DEBUG("Host %i starts run %i and scenario %lu.", id, run, scenario);
285 while (scenario < scenarios.size()) {
286 Scenario& s = scenarios[scenario];
293 int SendAgent::run = 0;
294 size_t SendAgent::scenario = 0;
296 /*************************************************************************************************/
301 static size_t scenario;
304 sg4::Host* other_host;
306 sg4::CommPtr do_get(CommType type, double*& receive_ptr)
309 case CommType::EAGER_SYNC:
310 receive_ptr = mbox_eager->get<double>();
312 case CommType::EAGER_ASYNC:
313 return mbox_eager->get_async(&receive_ptr);
314 case CommType::EAGER_INIT:
315 return mbox_eager->get_init()->set_dst_data((void**)(&receive_ptr));
317 case CommType::RDV_SYNC:
318 receive_ptr = mbox_rdv->get<double>();
320 case CommType::RDV_ASYNC:
321 return mbox_rdv->get_async(&receive_ptr);
322 case CommType::RDV_INIT:
323 return mbox_rdv->get_init()->set_dst_data((void**)(&receive_ptr));
325 case CommType::ONESIDE_SYNC:
326 case CommType::ONESIDE_ASYNC:
327 case CommType::ONESIDE_INIT:
328 xbt_die("No get in One Sided comunications!");
333 void receive_message(const Scenario& s)
335 sg4::CommPtr comm = nullptr;
336 CommType type = s.type;
337 Action expected = s.rcv_expected;
338 double end_time = s.start_time + s.duration;
339 // double curr_rel_time=0;
340 double* receive_ptr = nullptr;
341 size_t step_index = 0;
342 sg4::this_actor::sleep_until(s.start_time);
343 for (; step_index < s.steps.size(); step_index++) {
344 const Step& step = s.steps[step_index];
345 if (step.entity != Step::RCV || step.type != Step::ACTION)
349 sg4::this_actor::sleep_until(s.start_time + step.rel_time);
350 } catch (std::exception& e) {
351 XBT_DEBUG("During Sleep, failed to receive message because of a %s exception (%s)", typeid(e).name(), e.what());
355 // Check if the other host is still OK.
356 if (not other_host->is_on())
359 // Perform the action
361 switch (step.action_type) {
363 comm = do_get(type, receive_ptr);
372 xbt_die("Not a valid action for RCV");
374 } catch (std::exception& e) {
375 XBT_DEBUG("During %s, failed to receive message because of a %s exception (%s)", to_string(step.action_type),
376 typeid(e).name(), e.what());
382 sg4::this_actor::sleep_until(end_time - .1);
383 } catch (std::exception& e) {
384 XBT_DEBUG("During Sleep, failed to send message because of a %s exception (%s)", typeid(e).name(), e.what());
387 Action outcome = Action::END;
388 std::string scenario_string = to_string(s);
389 if (step_index < s.steps.size()) {
390 const Step& step = s.steps[step_index];
391 assert(step.entity == Step::RCV && step.type == Step::ACTION);
392 outcome = step.action_type;
393 } else if (receive_ptr == nullptr) {
394 XBT_ERROR("Received address is NULL in %s", scenario_string.c_str());
395 } else if (*receive_ptr != end_time) {
396 XBT_ERROR("Received value invalid: expected %f but got %f in %s", end_time, *receive_ptr,
397 scenario_string.c_str());
400 if (outcome != expected) {
401 XBT_ERROR("Expected %s but got %s in %s", to_string(expected), to_string(outcome), scenario_string.c_str());
403 XBT_INFO("OK: %s", scenario_string.c_str());
405 sg4::this_actor::sleep_until(end_time);
407 xbt_assert(not mbox_eager->listen(), "Mailbox should not have ongoing communication!");
408 xbt_assert(not mbox_rdv->listen(), "Mailbox should not have ongoing communication!");
413 explicit ReceiveAgent(int id, sg4::Host* other_host) : id(id), other_host(other_host) {}
418 XBT_DEBUG("Host %i starts run %i and scenario %lu.", id, run, scenario);
419 mbox_eager->set_receiver(sg4::Actor::self());
420 while (scenario < scenarios.size()) {
421 Scenario& s = scenarios[scenario];
428 int ReceiveAgent::run = 0;
429 size_t ReceiveAgent::scenario = 0;
431 /*************************************************************************************************/
433 static void on_host_state_change(sg4::Host const& host)
435 XBT_DEBUG("Host %s is now %s", host.get_cname(), host.is_on() ? "ON " : "OFF");
442 static void on_link_state_change(sg4::Link const& link)
444 XBT_DEBUG("Link %s is now %s", link.get_cname(), link.is_on() ? "ON " : "OFF");
447 static void addStateEvent(std::ostream& out, double date, bool isOn)
450 out << date << " 1\n";
452 out << date << " 0\n";
455 static int prepareScenario(CommType type, int& index, double& start_time, double duration, std::ostream& sndP, std::ostream& rcvP,
456 std::ostream& lnkP, Action snd_expected, Action rcv_expected, std::vector<Step> steps, std::vector<int> active_indices)
460 if(std::find(active_indices.begin(),active_indices.end(),index)!=active_indices.end()) {
461 // Update fault profiles
462 for (Step& step : steps) {
463 assert(step.rel_time < duration);
464 if (step.type != Step::STATE)
466 int val = step.new_state ? 1 : 0;
467 switch (step.entity) {
469 sndP << start_time + step.rel_time << " " << val << std::endl;
472 rcvP << start_time + step.rel_time << " " << val << std::endl;
475 lnkP << start_time + step.rel_time << " " << val << std::endl;
479 scenarios.push_back({type, start_time, duration, snd_expected, rcv_expected, steps, index});
483 start_time += duration;
487 /*************************************************************************************************/
489 // State profiles for the resources
490 std::string SndStateProfile;
491 std::string RcvStateProfile;
492 std::string LnkStateProfile;
494 /*************************************************************************************************/
496 double build_scenarios(std::vector<int>& active_indices );
498 int main(int argc, char* argv[])
501 sg4::Engine e(&argc, argv);
503 std::vector<int> active_indices;
504 //Parse index of tests that need to be run
506 int previous_index=-1;
507 bool is_range_last=false;
508 for(int i=1; i<argc; i++) {
509 if(not strcmp(argv[i],"-"))
512 int index=atoi(argv[i]);
513 xbt_assert(index>previous_index);
515 for(int j=previous_index+1;j<=index;j++)
516 active_indices.push_back(j);
518 active_indices.push_back(index);
520 previous_index=index;
524 double end_time = build_scenarios(active_indices);
526 XBT_INFO("Will run for %f seconds", end_time);
529 mbox_eager = e.mailbox_by_name_or_create("eager");
530 mbox_rdv = e.mailbox_by_name_or_create("rdv");
532 sg4::NetZone* zone = sg4::create_full_zone("Top");
534 pr::Profile* profile_sender = pr::ProfileBuilder::from_string("sender_profile", SndStateProfile, 0);
535 sg4::Host* sender_host = zone->create_host("senderHost", HostComputePower)->set_state_profile(profile_sender)->seal();
536 pr::Profile* profile_receiver = pr::ProfileBuilder::from_string("receiver_profile", RcvStateProfile, 0);
537 sg4::Host* receiver_host = zone->create_host("receiverHost", HostComputePower)->set_state_profile(profile_receiver)->seal();
539 sg4::ActorPtr sender = sg4::Actor::create("sender", sender_host, SendAgent(0, receiver_host));
540 sender->set_auto_restart(true);
542 sg4::ActorPtr receiver = sg4::Actor::create("receiver", receiver_host, ReceiveAgent(1, sender_host));
543 receiver->set_auto_restart(true);
545 pr::Profile* profile_link = pr::ProfileBuilder::from_string("link_profile", LnkStateProfile, 0);
547 zone->create_link("link", LinkBandwidth)->set_latency(LinkLatency)->set_state_profile(profile_link)->seal();
549 zone->add_route(sender_host->get_netpoint(), receiver_host->get_netpoint(), nullptr, nullptr,
550 {sg4::LinkInRoute{link}}, false);
553 sg4::Host::on_state_change.connect(on_host_state_change);
554 sg4::Link::on_state_change_cb(on_link_state_change);
556 e.run_until(end_time);
561 /*************************************************************************************************/
563 // A bunch of dirty macros to help readability (supposedly)
564 #define _MK(type, duration, snd_expected, rcv_expected, steps...) \
565 active+=prepareScenario(CommType::type, index, start_time, duration, sndP, rcvP, lnkP, Action::snd_expected, Action::rcv_expected, \
566 {steps}, active_indices )
568 #define LOFF(relTime) \
570 relTime, Step::STATE, Step::LNK, Action::END, false \
572 #define LON(relTime) \
574 relTime, Step::STATE, Step::LNK, Action::END, true \
577 #define SOFF(relTime) \
579 relTime, Step::STATE, Step::SND, Action::END, false \
581 #define SON(relTime) \
583 relTime, Step::STATE, Step::SND, Action::END, true \
585 #define SPUT(relTime) \
587 relTime, Step::ACTION, Step::SND, Action::PUT, false \
589 #define SWAT(relTime) \
591 relTime, Step::ACTION, Step::SND, Action::WAIT, false \
594 #define ROFF(relTime) \
596 relTime, Step::STATE, Step::RCV, Action::END, false \
598 #define RON(relTime) \
600 relTime, Step::STATE, Step::RCV, Action::END, true \
602 #define RGET(relTime) \
604 relTime, Step::ACTION, Step::RCV, Action::GET, false \
606 #define RWAT(relTime) \
608 relTime, Step::ACTION, Step::RCV, Action::WAIT, false \
611 double build_scenarios(std::vector<int>& active_indices )
614 // Build the set of simulation stages
615 std::stringstream sndP;
616 std::stringstream rcvP;
617 std::stringstream lnkP;
619 double start_time = 0;
623 // EAGER SYNC use cases
625 _MK(EAGER_SYNC, 1, END, END, SPUT(.2), RGET(.4));
626 _MK(EAGER_SYNC, 1, END, END, RGET(.2), SPUT(.4));
628 _MK(EAGER_SYNC, 2, PUT, DIE, ROFF(.1), SPUT(.2), RON(1));
629 _MK(EAGER_SYNC, 2, PUT, DIE, SPUT(.2), ROFF(.3), RON(1));
630 _MK(EAGER_SYNC, 2, PUT, DIE, SPUT(.2), RGET(.4), ROFF(.5), RON(1));
631 _MK(EAGER_SYNC, 2, PUT, DIE, RGET(.2), SPUT(.4), ROFF(.5), RON(1));
633 _MK(EAGER_SYNC, 2, DIE, GET, SPUT(.2), SOFF(.3), RGET(.4), SON(1));
634 _MK(EAGER_SYNC, 2, DIE, GET, SPUT(.2), RGET(.4), SOFF(.5), SON(1));
636 _MK(EAGER_SYNC, 2, PUT, GET, LOFF(.1), SPUT(.2), RGET(.4), LON(1));
637 _MK(EAGER_SYNC, 2, PUT, GET, SPUT(.2), LOFF(.3), RGET(.4), LON(1));
638 _MK(EAGER_SYNC, 2, PUT, GET, SPUT(.2), RGET(.4), LOFF(.5), LON(1));
639 _MK(EAGER_SYNC, 2, PUT, GET, LOFF(.1), RGET(.2), SPUT(.4), LON(1));
640 _MK(EAGER_SYNC, 2, PUT, GET, RGET(.2), LOFF(.3), SPUT(.4), LON(1));
641 _MK(EAGER_SYNC, 2, PUT, GET, RGET(.2), SPUT(.4), LOFF(.5), LON(1));
643 // EAGER ASYNC use cases
645 _MK(EAGER_ASYNC, 2, END, END, SPUT(.2), SWAT(.4), RGET(.6), RWAT(.8));
646 _MK(EAGER_ASYNC, 2, END, END, SPUT(.2), RGET(.4), SWAT(.6), RWAT(.8));
647 _MK(EAGER_ASYNC, 2, END, END, SPUT(.2), RGET(.4), RWAT(.6), SWAT(.8));
648 _MK(EAGER_ASYNC, 2, END, END, RGET(.2), SPUT(.4), SWAT(.6), RWAT(.8));
649 _MK(EAGER_ASYNC, 2, END, END, RGET(.2), SPUT(.4), RWAT(.6), SWAT(.8));
650 _MK(EAGER_ASYNC, 2, END, END, RGET(.2), RWAT(.4), SPUT(.6), SWAT(.8));
653 _MK(EAGER_ASYNC, 2, PUT, DIE, ROFF(.1), SPUT(.2), SWAT(.4), RON(1));
654 _MK(EAGER_ASYNC, 2, WAIT, DIE, SPUT(.2), ROFF(.3), SWAT(.4), RON(1));
655 _MK(EAGER_ASYNC, 2, PUT, DIE, RGET(.2), ROFF(.3), SPUT(.4), SWAT(.6), RON(1));
656 _MK(EAGER_ASYNC, 2, WAIT, DIE, SPUT(.2), SWAT(.4), ROFF(.5), RON(1));
657 _MK(EAGER_ASYNC, 2, WAIT, DIE, SPUT(.2), RGET(.4), ROFF(.5), SWAT(.6), RON(1));
658 _MK(EAGER_ASYNC, 2, WAIT, DIE, RGET(.2), SPUT(.4), ROFF(.5), SWAT(.6), RON(1));
659 _MK(EAGER_ASYNC, 2, PUT , DIE, RGET(.2), RWAT(.4), ROFF(.5), SPUT(.6), SWAT(.8), RON(1));
660 _MK(EAGER_ASYNC, 2, WAIT, DIE, SPUT(.2), SWAT(.4), RGET(.6), ROFF(.7), RON(1));
661 _MK(EAGER_ASYNC, 2, WAIT, DIE, SPUT(.2), RGET(.4), SWAT(.6), ROFF(.7), RON(1));
662 _MK(EAGER_ASYNC, 2, WAIT, DIE, SPUT(.2), RGET(.4), RWAT(.6), ROFF(.7), SWAT(.8), RON(1));
663 _MK(EAGER_ASYNC, 2, WAIT, DIE, RGET(.2), SPUT(.4), SWAT(.6), ROFF(.7), RON(1));
664 _MK(EAGER_ASYNC, 2, WAIT, DIE, RGET(.2), SPUT(.4), RWAT(.6), ROFF(.7), SWAT(.8), RON(1));
665 _MK(EAGER_ASYNC, 2, WAIT, DIE, RGET(.2), RWAT(.4), SPUT(.6), ROFF(.7), SWAT(.8), RON(1));
666 // Sender off (only cases where sender did put, because otherwise receiver cannot find out there was a fault)
667 _MK(EAGER_ASYNC, 2, DIE, GET, SPUT(.2), SOFF(.3), RGET(.4), RWAT(.6), SON(1));
668 _MK(EAGER_ASYNC, 2, DIE, WAIT, RGET(.2), SPUT(.4), SOFF(.5), RWAT(.6), SON(1));
669 _MK(EAGER_ASYNC, 2, DIE, WAIT, SPUT(.2), RGET(.4), SOFF(.5), RWAT(.6), SON(1));
670 _MK(EAGER_ASYNC, 2, DIE, GET, SPUT(.2), SWAT(.4), SOFF(.5), RGET(.6), RWAT(.8), SON(1));
671 _MK(EAGER_ASYNC, 2, DIE, WAIT, RGET(.2), RWAT(.4), SPUT(.6), SOFF(.7), SON(1));
672 _MK(EAGER_ASYNC, 2, DIE, WAIT, RGET(.2), SPUT(.4), RWAT(.6), SOFF(.7), SON(1));
673 _MK(EAGER_ASYNC, 2, DIE, WAIT, RGET(.2), SPUT(.4), SWAT(.6), SOFF(.7), RWAT(.8), SON(1));
674 _MK(EAGER_ASYNC, 2, DIE, WAIT, SPUT(.2), RGET(.4), RWAT(.6), SOFF(.7), SON(1));
675 _MK(EAGER_ASYNC, 2, DIE, WAIT, SPUT(.2), RGET(.4), SWAT(.6), SOFF(.7), RWAT(.8), SON(1));
676 _MK(EAGER_ASYNC, 2, DIE, WAIT, SPUT(.2), SWAT(.4), RGET(.6), SOFF(.7), RWAT(.8), SON(1));
678 _MK(EAGER_ASYNC, 2, WAIT, WAIT, LOFF(.1), SPUT(.2), SWAT(.4), RGET(.6), RWAT(.8), LON(1));
679 _MK(EAGER_ASYNC, 2, WAIT, WAIT, LOFF(.1), SPUT(.2), RGET(.4), SWAT(.6), RWAT(.8), LON(1));
680 _MK(EAGER_ASYNC, 2, WAIT, WAIT, LOFF(.1), SPUT(.2), RGET(.4), RWAT(.6), SWAT(.8), LON(1));
681 _MK(EAGER_ASYNC, 2, WAIT, WAIT, LOFF(.1), RGET(.2), SPUT(.4), SWAT(.6), RWAT(.8), LON(1));
682 _MK(EAGER_ASYNC, 2, WAIT, WAIT, LOFF(.1), RGET(.2), SPUT(.4), RWAT(.6), SWAT(.8), LON(1));
683 _MK(EAGER_ASYNC, 2, WAIT, WAIT, LOFF(.1), RGET(.2), RWAT(.4), SPUT(.6), SWAT(.8), LON(1));
684 _MK(EAGER_ASYNC, 2, WAIT, WAIT, SPUT(.2), LOFF(.3), SWAT(.4), RGET(.6), RWAT(.8), LON(1));
685 _MK(EAGER_ASYNC, 2, WAIT, WAIT, SPUT(.2), LOFF(.3), RGET(.4), SWAT(.6), RWAT(.8), LON(1));
686 _MK(EAGER_ASYNC, 2, WAIT, WAIT, SPUT(.2), LOFF(.3), RGET(.4), RWAT(.6), SWAT(.8), LON(1));
687 _MK(EAGER_ASYNC, 2, WAIT, WAIT, RGET(.2), LOFF(.3), SPUT(.4), SWAT(.6), RWAT(.8), LON(1));
688 _MK(EAGER_ASYNC, 2, WAIT, WAIT, RGET(.2), LOFF(.3), SPUT(.4), RWAT(.6), SWAT(.8), LON(1));
689 _MK(EAGER_ASYNC, 2, WAIT, WAIT, RGET(.2), LOFF(.3), RWAT(.4), SPUT(.6), SWAT(.8), LON(1));
690 _MK(EAGER_ASYNC, 2, WAIT, WAIT, SPUT(.2), SWAT(.4), LOFF(.5), RGET(.6), RWAT(.8), LON(1));
691 _MK(EAGER_ASYNC, 2, WAIT, WAIT, SPUT(.2), RGET(.4), LOFF(.5), SWAT(.6), RWAT(.8), LON(1));
692 _MK(EAGER_ASYNC, 2, WAIT, WAIT, SPUT(.2), RGET(.4), LOFF(.5), RWAT(.6), SWAT(.8), LON(1));
693 _MK(EAGER_ASYNC, 2, WAIT, WAIT, RGET(.2), SPUT(.4), LOFF(.5), SWAT(.6), RWAT(.8), LON(1));
694 _MK(EAGER_ASYNC, 2, WAIT, WAIT, RGET(.2), SPUT(.4), LOFF(.5), RWAT(.6), SWAT(.8), LON(1));
695 _MK(EAGER_ASYNC, 2, WAIT, WAIT, RGET(.2), RWAT(.4), LOFF(.5), SPUT(.6), SWAT(.8), LON(1));
696 _MK(EAGER_ASYNC, 2, WAIT, WAIT, SPUT(.2), SWAT(.4), RGET(.6), LOFF(.7), RWAT(.8), LON(1));
697 _MK(EAGER_ASYNC, 2, WAIT, WAIT, SPUT(.2), RGET(.4), SWAT(.6), LOFF(.7), RWAT(.8), LON(1));
698 _MK(EAGER_ASYNC, 2, WAIT, WAIT, SPUT(.2), RGET(.4), RWAT(.6), LOFF(.7), SWAT(.8), LON(1));
699 _MK(EAGER_ASYNC, 2, WAIT, WAIT, RGET(.2), SPUT(.4), SWAT(.6), LOFF(.7), RWAT(.8), LON(1));
700 _MK(EAGER_ASYNC, 2, WAIT, WAIT, RGET(.2), SPUT(.4), RWAT(.6), LOFF(.7), SWAT(.8), LON(1));
701 _MK(EAGER_ASYNC, 2, WAIT, WAIT, RGET(.2), RWAT(.4), SPUT(.6), LOFF(.7), SWAT(.8), LON(1));
703 // RDV SYNC use cases
706 _MK(RDV_SYNC, 1, END, END, SPUT(.2), RGET(.4));
707 _MK(RDV_SYNC, 1, END, END, RGET(.2), SPUT(.4));
710 _MK(RDV_SYNC, 2, PUT, DIE, ROFF(.1), SPUT(.2), RON(1));
711 _MK(RDV_SYNC, 2, PUT, DIE, SPUT(.2), ROFF(.3), RON(1));
712 _MK(RDV_SYNC, 2, PUT, DIE, SPUT(.2), RGET(.4), ROFF(.5), RON(1));
713 _MK(RDV_SYNC, 2, PUT, DIE, RGET(.2), SPUT(.4), ROFF(.5), RON(1));
715 _MK(RDV_SYNC, 2, DIE, GET, SPUT(.2), RGET(.4), SOFF(.5), SON(1));
717 _MK(RDV_SYNC, 2, PUT, GET, LOFF(.1), SPUT(.2), RGET(.4), LON(1));
718 _MK(RDV_SYNC, 2, PUT, GET, SPUT(.2), LOFF(.3), RGET(.4), LON(1));
719 _MK(RDV_SYNC, 2, PUT, GET, SPUT(.2), RGET(.4), LOFF(.5), LON(1));
720 _MK(RDV_SYNC, 2, PUT, GET, LOFF(.1), RGET(.2), SPUT(.4), LON(1));
721 _MK(RDV_SYNC, 2, PUT, GET, RGET(.2), LOFF(.3), SPUT(.4), LON(1));
722 _MK(RDV_SYNC, 2, PUT, GET, RGET(.2), SPUT(.4), LOFF(.5), LON(1));
724 // RDV ASYNC use cases
726 _MK(RDV_ASYNC, 2, END, END, SPUT(.2), SWAT(.4), RGET(.6), RWAT(.8));
727 _MK(RDV_ASYNC, 2, END, END, SPUT(.2), RGET(.4), SWAT(.6), RWAT(.8));
728 _MK(RDV_ASYNC, 2, END, END, SPUT(.2), RGET(.4), RWAT(.6), SWAT(.8));
729 _MK(RDV_ASYNC, 2, END, END, RGET(.2), SPUT(.4), SWAT(.6), RWAT(.8));
730 _MK(RDV_ASYNC, 2, END, END, RGET(.2), SPUT(.4), RWAT(.6), SWAT(.8));
731 _MK(RDV_ASYNC, 2, END, END, RGET(.2), RWAT(.4), SPUT(.6), SWAT(.8));
733 _MK(RDV_ASYNC, 2, PUT, DIE, ROFF(.1), SPUT(.2), SWAT(.4), RON(1));
734 _MK(RDV_ASYNC, 2, WAIT, DIE, SPUT(.2), ROFF(.3), SWAT(.4), RON(1));
735 _MK(RDV_ASYNC, 2, PUT, DIE, RGET(.2), ROFF(.3), SPUT(.4), SWAT(.6), RON(1));
736 _MK(RDV_ASYNC, 2, WAIT, DIE, SPUT(.2), SWAT(.4), ROFF(.5), RON(1));
737 _MK(RDV_ASYNC, 2, WAIT, DIE, SPUT(.2), RGET(.4), ROFF(.5), SWAT(.6), RON(1));
738 _MK(RDV_ASYNC, 2, WAIT, DIE, RGET(.2), SPUT(.4), ROFF(.5), SWAT(.6), RON(1));
739 _MK(RDV_ASYNC, 2, PUT , DIE, RGET(.2), RWAT(.4), ROFF(.5), SPUT(.6), SWAT(.8), RON(1));
740 _MK(RDV_ASYNC, 2, WAIT, DIE, SPUT(.2), SWAT(.4), RGET(.6), ROFF(.7), RON(1));
741 _MK(RDV_ASYNC, 2, WAIT, DIE, SPUT(.2), RGET(.4), SWAT(.6), ROFF(.7), RON(1));
742 _MK(RDV_ASYNC, 2, WAIT, DIE, SPUT(.2), RGET(.4), RWAT(.6), ROFF(.7), SWAT(.8), RON(1));
743 _MK(RDV_ASYNC, 2, WAIT, DIE, RGET(.2), SPUT(.4), SWAT(.6), ROFF(.7), RON(1));
744 _MK(RDV_ASYNC, 2, WAIT, DIE, RGET(.2), SPUT(.4), RWAT(.6), ROFF(.7), SWAT(.8), RON(1));
745 _MK(RDV_ASYNC, 2, WAIT, DIE, RGET(.2), RWAT(.4), SPUT(.6), ROFF(.7), SWAT(.8), RON(1));
746 // Sender off (only cases where sender did put, because otherwise receiver cannot find out there was a fault)
747 _MK(RDV_ASYNC, 2, DIE, GET, SPUT(.2), SOFF(.3), RGET(.4), RWAT(.6), SON(1));
748 _MK(RDV_ASYNC, 2, DIE, WAIT, RGET(.2), SPUT(.4), SOFF(.5), RWAT(.6), SON(1));
749 _MK(RDV_ASYNC, 2, DIE, WAIT, SPUT(.2), RGET(.4), SOFF(.5), RWAT(.6), SON(1));
750 _MK(RDV_ASYNC, 2, DIE, GET, SPUT(.2), SWAT(.4), SOFF(.5), RGET(.6), RWAT(.8), SON(1));
751 _MK(RDV_ASYNC, 2, DIE, WAIT, RGET(.2), RWAT(.4), SPUT(.6), SOFF(.7), SON(1));
752 _MK(RDV_ASYNC, 2, DIE, WAIT, RGET(.2), SPUT(.4), RWAT(.6), SOFF(.7), SON(1));
753 _MK(RDV_ASYNC, 2, DIE, WAIT, RGET(.2), SPUT(.4), SWAT(.6), SOFF(.7), RWAT(.8), SON(1));
754 _MK(RDV_ASYNC, 2, DIE, WAIT, SPUT(.2), RGET(.4), RWAT(.6), SOFF(.7), SON(1));
755 _MK(RDV_ASYNC, 2, DIE, WAIT, SPUT(.2), RGET(.4), SWAT(.6), SOFF(.7), RWAT(.8), SON(1));
756 _MK(RDV_ASYNC, 2, DIE, WAIT, SPUT(.2), SWAT(.4), RGET(.6), SOFF(.7), RWAT(.8), SON(1));
758 _MK(RDV_ASYNC, 2, WAIT, WAIT, LOFF(.1), SPUT(.2), SWAT(.4), RGET(.6), RWAT(.8), LON(1));
759 _MK(RDV_ASYNC, 2, WAIT, WAIT, LOFF(.1), SPUT(.2), RGET(.4), SWAT(.6), RWAT(.8), LON(1));
760 _MK(RDV_ASYNC, 2, WAIT, WAIT, LOFF(.1), SPUT(.2), RGET(.4), RWAT(.6), SWAT(.8), LON(1));
761 _MK(RDV_ASYNC, 2, WAIT, WAIT, LOFF(.1), RGET(.2), SPUT(.4), SWAT(.6), RWAT(.8), LON(1));
762 _MK(RDV_ASYNC, 2, WAIT, WAIT, LOFF(.1), RGET(.2), SPUT(.4), RWAT(.6), SWAT(.8), LON(1));
763 _MK(RDV_ASYNC, 2, WAIT, WAIT, LOFF(.1), RGET(.2), RWAT(.4), SPUT(.6), SWAT(.8), LON(1));
764 _MK(RDV_ASYNC, 2, WAIT, WAIT, SPUT(.2), LOFF(.3), SWAT(.4), RGET(.6), RWAT(.8), LON(1));
765 _MK(RDV_ASYNC, 2, WAIT, WAIT, SPUT(.2), LOFF(.3), RGET(.4), SWAT(.6), RWAT(.8), LON(1));
766 _MK(RDV_ASYNC, 2, WAIT, WAIT, SPUT(.2), LOFF(.3), RGET(.4), RWAT(.6), SWAT(.8), LON(1));
767 _MK(RDV_ASYNC, 2, WAIT, WAIT, RGET(.2), LOFF(.3), SPUT(.4), SWAT(.6), RWAT(.8), LON(1));
768 _MK(RDV_ASYNC, 2, WAIT, WAIT, RGET(.2), LOFF(.3), SPUT(.4), RWAT(.6), SWAT(.8), LON(1));
769 _MK(RDV_ASYNC, 2, WAIT, WAIT, RGET(.2), LOFF(.3), RWAT(.4), SPUT(.6), SWAT(.8), LON(1));
770 _MK(RDV_ASYNC, 2, WAIT, WAIT, SPUT(.2), SWAT(.4), LOFF(.5), RGET(.6), RWAT(.8), LON(1));
771 _MK(RDV_ASYNC, 2, WAIT, WAIT, SPUT(.2), RGET(.4), LOFF(.5), SWAT(.6), RWAT(.8), LON(1));
772 _MK(RDV_ASYNC, 2, WAIT, WAIT, SPUT(.2), RGET(.4), LOFF(.5), RWAT(.6), SWAT(.8), LON(1));
773 _MK(RDV_ASYNC, 2, WAIT, WAIT, RGET(.2), SPUT(.4), LOFF(.5), SWAT(.6), RWAT(.8), LON(1));
774 _MK(RDV_ASYNC, 2, WAIT, WAIT, RGET(.2), SPUT(.4), LOFF(.5), RWAT(.6), SWAT(.8), LON(1));
775 _MK(RDV_ASYNC, 2, WAIT, WAIT, RGET(.2), RWAT(.4), LOFF(.5), SPUT(.6), SWAT(.8), LON(1));
776 _MK(RDV_ASYNC, 2, WAIT, WAIT, SPUT(.2), SWAT(.4), RGET(.6), LOFF(.7), RWAT(.8), LON(1));
777 _MK(RDV_ASYNC, 2, WAIT, WAIT, SPUT(.2), RGET(.4), SWAT(.6), LOFF(.7), RWAT(.8), LON(1));
778 _MK(RDV_ASYNC, 2, WAIT, WAIT, SPUT(.2), RGET(.4), RWAT(.6), LOFF(.7), SWAT(.8), LON(1));
779 _MK(RDV_ASYNC, 2, WAIT, WAIT, RGET(.2), SPUT(.4), SWAT(.6), LOFF(.7), RWAT(.8), LON(1));
780 _MK(RDV_ASYNC, 2, WAIT, WAIT, RGET(.2), SPUT(.4), RWAT(.6), LOFF(.7), SWAT(.8), LON(1));
781 _MK(RDV_ASYNC, 2, WAIT, WAIT, RGET(.2), RWAT(.4), SPUT(.6), LOFF(.7), SWAT(.8), LON(1));
783 // ONESIDE SYNC use cases
786 _MK(ONESIDE_SYNC, 1, END, END, SPUT(.2));
788 _MK(ONESIDE_SYNC, 2, PUT, DIE, ROFF(.1), SPUT(.2), RON(1));
789 _MK(ONESIDE_SYNC, 2, PUT, DIE, SPUT(.2), ROFF(.3), RON(1));
791 _MK(ONESIDE_SYNC, 2, PUT, GET, LOFF(.1), SPUT(.2), LON(1));
792 _MK(ONESIDE_SYNC, 2, PUT, GET, SPUT(.2), LOFF(.3), LON(1));
794 // ONESIDE ASYNC use cases
796 _MK(ONESIDE_ASYNC, 2, END, END, SPUT(.2), SWAT(.4));
798 _MK(ONESIDE_ASYNC, 2, PUT, DIE, ROFF(.1), SPUT(.2), SWAT(.4), RON(1));
799 _MK(ONESIDE_ASYNC, 2, WAIT, DIE, SPUT(.2), ROFF(.3), SWAT(.4), RON(1));
800 _MK(ONESIDE_ASYNC, 2, WAIT, DIE, SPUT(.2), SWAT(.4), ROFF(.5), RON(1));
802 _MK(ONESIDE_ASYNC, 2, WAIT, WAIT, LOFF(.1), SPUT(.2), SWAT(.4), LON(1));
803 _MK(ONESIDE_ASYNC, 2, WAIT, WAIT, SPUT(.2), LOFF(.3), SWAT(.4), LON(1));
804 _MK(ONESIDE_ASYNC, 2, WAIT, WAIT, SPUT(.2), SWAT(.4), LOFF(.5), LON(1));
807 SndStateProfile = sndP.str();
808 RcvStateProfile = rcvP.str();
809 LnkStateProfile = lnkP.str();
811 XBT_INFO("Will execute %i active scenarios out of %i.",active,index);
812 return start_time + 1;