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 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 auto task = mbox->get_unique<Task>();
43 if (task->name == "finalize") {
46 // creating task and setting its category
47 simgrid::s4u::this_actor::exec_init(task->flops)
48 ->set_name(task->name)
49 ->set_tracing_category(task->category)
54 int main(int argc, char* argv[])
56 simgrid::s4u::Engine e(&argc, argv);
57 xbt_assert(argc > 1, "Usage: %s platform_file\n \tExample: %s small_platform.xml\n", argv[0], argv[0]);
59 e.load_platform(argv[1]);
61 // declaring user categories with RGB colors
62 TRACE_category_with_color("compute", "1 0 0"); // red
63 TRACE_category_with_color("request", "0 1 0"); // green
64 TRACE_category_with_color("data", "0 0 1"); // blue
65 TRACE_category_with_color("finalize", "0 0 0"); // black
67 simgrid::s4u::Actor::create("master", simgrid::s4u::Host::by_name("Tremblay"), master);
68 simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Fafard"), worker);