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"
9 #include "simgrid/forward.h"
11 #include "simgrid/s4u/As.hpp"
12 #include "simgrid/s4u/engine.hpp"
13 #include "simgrid/jedule/jedule.hpp"
14 #include "../../simdag/simdag_private.hpp"
18 XBT_LOG_NEW_CATEGORY(jedule, "Logging specific to Jedule");
19 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(jed_sd, jedule, "Logging specific to Jedule SD binding");
23 void jedule_log_sd_event(SD_task_t task)
25 xbt_assert(task != nullptr);
27 jed_event_t event = new simgrid::jedule::Event(std::string(SD_task_get_name(task)),
28 SD_task_get_start_time(task), SD_task_get_finish_time(task), "SD");
29 event->addResources(task->allocation);
30 my_jedule->event_set.push_back(event);
35 AS_t root_comp = simgrid::s4u::Engine::instance()->rootAs();
36 XBT_DEBUG("root name %s\n", root_comp->name());
38 my_jedule = new simgrid::jedule::Jedule();
40 jed_container_t root_container = new simgrid::jedule::Container(std::string(root_comp->name()));
41 root_container->createHierarchy(root_comp);
42 my_jedule->root_container = root_container;
45 void jedule_sd_exit(void)
50 void jedule_sd_dump(const char * filename)
55 fname = bprintf("%s.jed", xbt_binary_name);
57 fname = xbt_strdup(filename);
60 FILE *fh = fopen(fname, "w");
62 my_jedule->writeOutput(fh);