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 #include "simgrid/jedule/jedule.hpp"
7 #include "simgrid/s4u/Engine.hpp"
8 #include "simgrid/s4u/NetZone.hpp"
9 #include "src/simdag/simdag_private.hpp"
11 #if SIMGRID_HAVE_JEDULE
13 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(jed_sd, sd, "Jedule SimDag binding");
17 void jedule_log_sd_event(const_SD_task_t task)
19 xbt_assert(task != nullptr);
21 simgrid::jedule::Event event(std::string(SD_task_get_name(task)), SD_task_get_start_time(task),
22 SD_task_get_finish_time(task), "SD");
23 event.add_resources(*task->allocation);
24 my_jedule->add_event(event);
29 const_sg_netzone_t root_comp = simgrid::s4u::Engine::get_instance()->get_netzone_root();
30 XBT_DEBUG("root name %s\n", root_comp->get_cname());
32 my_jedule = new simgrid::jedule::Jedule(root_comp->get_name());
40 void jedule_sd_dump(const char * filename)
45 fname = simgrid::xbt::binary_name + ".jed";
50 FILE* fh = fopen(fname.c_str(), "w");
51 xbt_assert(fh != nullptr, "Failed to open file: %s", fname.c_str());
53 my_jedule->write_output(fh);