1 /* Copyright (c) 2010-2015. 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"
10 #include "src/surf/surf_private.h"
11 #include "surf/surf.h"
13 #include "simgrid/jedule/jedule_sd_binding.h"
14 #include "simgrid/simdag.h"
15 #include "simgrid/s4u/As.hpp"
16 #include "simgrid/s4u/engine.hpp"
19 #include "simgrid/forward.h"
21 #include "simgrid/jedule/jedule_events.hpp"
22 #include "simgrid/jedule/jedule_output.hpp"
23 #include "simgrid/jedule/jedule_platform.hpp"
24 #include "../../simdag/simdag_private.hpp"
28 XBT_LOG_NEW_CATEGORY(jedule, "Logging specific to Jedule");
29 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(jed_sd, jedule, "Logging specific to Jedule SD binding");
33 void jedule_log_sd_event(SD_task_t task)
35 xbt_assert(task != nullptr);
38 new simgrid::jedule::Event(std::string(SD_task_get_name(task)), task->start_time, task->finish_time,"SD");
39 event->addResources(task->allocation);
40 jedule_store_event(event);
43 void jedule_setup_platform()
45 jed_create_jedule(&my_jedule);
47 AS_t root_comp = simgrid::s4u::Engine::instance()->rootAs();
48 XBT_DEBUG("root name %s\n", root_comp->name());
50 jed_container_t root_container = new simgrid::jedule::Container(std::string(root_comp->name()));
51 my_jedule->root_container = root_container;
53 root_container->createHierarchy(root_comp);
56 void jedule_sd_cleanup()
58 jedule_cleanup_output();
66 void jedule_sd_exit(void)
69 jed_free_jedule(my_jedule);
74 void jedule_sd_dump(const char * filename)
79 fname = bprintf("%s.jed", xbt_binary_name);
81 fname = xbt_strdup(filename);
84 FILE *fh = fopen(fname, "w");
86 write_jedule_output(fh, my_jedule, jedule_event_list);