1 /* Copyright (c) 2010-2022. 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"
14 namespace sg4 = simgrid::s4u;
25 auto mbox = sg4::Mailbox::by_name("master_mailbox");
26 for (int i = 0; i < 10; i++) {
29 task = {"task_compute", "compute", 10000000, 0};
31 task = {"task_request", "request", 10, 10};
33 task = {"task_data", "data", 10, 10000000};
34 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 = sg4::Mailbox::by_name("master_mailbox");
44 auto task = mbox->get_unique<Task>();
45 if (task->name == "finalize") {
48 // creating task and setting its category
49 sg4::this_actor::exec_init(task->flops)->set_name(task->name)->set_tracing_category(task->category)->wait();
53 int main(int argc, char* argv[])
55 sg4::Engine e(&argc, argv);
56 xbt_assert(argc > 1, "Usage: %s platform_file\n \tExample: %s small_platform.xml\n", argv[0], argv[0]);
58 e.load_platform(argv[1]);
60 // declaring user categories with RGB colors
61 simgrid::instr::declare_tracing_category("compute", "1 0 0"); // red
62 simgrid::instr::declare_tracing_category("request", "0 1 0"); // green
63 simgrid::instr::declare_tracing_category("data", "0 0 1"); // blue
64 simgrid::instr::declare_tracing_category("finalize", "0 0 0"); // black
66 sg4::Actor::create("master", e.host_by_name("Tremblay"), master);
67 sg4::Actor::create("worker", e.host_by_name("Fafard"), worker);