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");
25 for (int i = 0; i < 10; i++) {
28 task = {"task_compute", "compute", 10000000, 0};
30 task = {"task_request", "request", 10, 10};
32 task = {"task_data", "data", 10, 10000000};
33 mbox->put(new Task(task), task.bytes);
36 Task finalize = {"finalize", "finalize", 0, 1000};
37 mbox->put(new Task(finalize), finalize.bytes);
42 auto mbox = simgrid::s4u::Mailbox::by_name("master_mailbox");
44 const auto* task = static_cast<Task*>(mbox->get());
45 if (task->name == "finalize") {
49 // creating task and setting its category
50 simgrid::s4u::this_actor::exec_init(task->flops)
51 ->set_name(task->name)
52 ->set_tracing_category(task->category)
58 int main(int argc, char* argv[])
60 simgrid::s4u::Engine e(&argc, argv);
61 xbt_assert(argc > 1, "Usage: %s platform_file\n \tExample: %s small_platform.xml\n", argv[0], argv[0]);
63 e.load_platform(argv[1]);
65 // declaring user categories with RGB colors
66 TRACE_category_with_color("compute", "1 0 0"); // red
67 TRACE_category_with_color("request", "0 1 0"); // green
68 TRACE_category_with_color("data", "0 0 1"); // blue
69 TRACE_category_with_color("finalize", "0 0 0"); // black
71 simgrid::s4u::Actor::create("master", simgrid::s4u::Host::by_name("Tremblay"), master);
72 simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Fafard"), worker);