1 /* Copyright (c) 2010-2020. 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 source code simply loads the platform. This is only useful to play
7 * with the tracing module. See the tesh file to see how to generate the
11 #include "simgrid/instr.h"
12 #include "simgrid/s4u.hpp"
23 auto mbox = simgrid::s4u::Mailbox::by_name("master_mailbox");
24 for (int i = 0; i < 10; i++) {
27 task = {"task_compute", "compute", 10000000, 0};
29 task = {"task_request", "request", 10, 10};
31 task = {"task_data", "data", 10, 10000000};
32 mbox->put(new Task(task), task.bytes);
34 Task finalize = {"finalize", "finalize", 0, 1000};
35 mbox->put(new Task(finalize), finalize.bytes);
40 auto mbox = simgrid::s4u::Mailbox::by_name("master_mailbox");
42 const auto* task = mbox->get<Task>();
43 if (task->name == "finalize") {
47 // creating task and setting its category
48 simgrid::s4u::this_actor::exec_init(task->flops)
49 ->set_name(task->name)
50 ->set_tracing_category(task->category)
56 int main(int argc, char* argv[])
58 simgrid::s4u::Engine e(&argc, argv);
59 xbt_assert(argc > 1, "Usage: %s platform_file\n \tExample: %s small_platform.xml\n", argv[0], argv[0]);
61 e.load_platform(argv[1]);
63 // declaring user categories with RGB colors
64 TRACE_category_with_color("compute", "1 0 0"); // red
65 TRACE_category_with_color("request", "0 1 0"); // green
66 TRACE_category_with_color("data", "0 0 1"); // blue
67 TRACE_category_with_color("finalize", "0 0 0"); // black
69 simgrid::s4u::Actor::create("master", simgrid::s4u::Host::by_name("Tremblay"), master);
70 simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Fafard"), worker);