1 /* Copyright (c) 2010-2016. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "xbt/asserts.h"
8 #include "simgrid/jedule/jedule_sd_binding.h"
10 #include "simgrid/forward.h"
12 #include "../../simdag/simdag_private.hpp"
13 #include "simgrid/jedule/jedule.hpp"
14 #include "simgrid/s4u/NetZone.hpp"
15 #include "simgrid/s4u/engine.hpp"
19 XBT_LOG_NEW_CATEGORY(jedule, "Logging specific to Jedule");
20 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(jed_sd, jedule, "Logging specific to Jedule SD binding");
24 void jedule_log_sd_event(SD_task_t task)
26 xbt_assert(task != nullptr);
28 jed_event_t event = new simgrid::jedule::Event(std::string(SD_task_get_name(task)),
29 SD_task_get_start_time(task), SD_task_get_finish_time(task), "SD");
30 event->addResources(task->allocation);
31 my_jedule->event_set.push_back(event);
36 sg_netzone_t root_comp = simgrid::s4u::Engine::instance()->netRoot();
37 XBT_DEBUG("root name %s\n", root_comp->name());
39 my_jedule = new simgrid::jedule::Jedule();
41 jed_container_t root_container = new simgrid::jedule::Container(std::string(root_comp->name()));
42 root_container->createHierarchy(root_comp);
43 my_jedule->root_container = root_container;
46 void jedule_sd_exit(void)
51 void jedule_sd_dump(const char * filename)
56 fname = bprintf("%s.jed", xbt_binary_name);
58 fname = xbt_strdup(filename);
61 FILE *fh = fopen(fname, "w");
63 my_jedule->writeOutput(fh);