1 /* Copyright (c) 2010-2019. 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 "src/simdag/simdag_private.hpp"
9 #include "simgrid/s4u/Engine.hpp"
10 #include "simgrid/s4u/NetZone.hpp"
12 #if SIMGRID_HAVE_JEDULE
14 XBT_LOG_NEW_CATEGORY(jedule, "Logging specific to Jedule");
15 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(jed_sd, jedule, "Logging specific to Jedule SD binding");
19 void jedule_log_sd_event(SD_task_t task)
21 xbt_assert(task != nullptr);
23 simgrid::jedule::Event event(std::string(SD_task_get_name(task)), SD_task_get_start_time(task),
24 SD_task_get_finish_time(task), "SD");
25 event.add_resources(*task->allocation);
26 my_jedule->event_set_.emplace_back(std::move(event));
31 sg_netzone_t root_comp = simgrid::s4u::Engine::get_instance()->get_netzone_root();
32 XBT_DEBUG("root name %s\n", root_comp->get_cname());
34 my_jedule = new simgrid::jedule::Jedule(root_comp->get_name());
35 my_jedule->root_container_.create_hierarchy(root_comp);
43 void jedule_sd_dump(const char * filename)
48 fname = bprintf("%s.jed", xbt_binary_name);
50 fname = xbt_strdup(filename);
53 FILE *fh = fopen(fname, "w");
55 my_jedule->write_output(fh);