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"
9 #include "src/surf/surf_private.h"
10 #include "surf/surf.h"
12 #include "simgrid/jedule/jedule_sd_binding.h"
13 #include "simgrid/simdag.h"
14 #include "simgrid/s4u/As.hpp"
15 #include "simgrid/s4u/engine.hpp"
18 #include "simgrid/forward.h"
20 #include "simgrid/jedule/jedule.hpp"
21 #include "simgrid/jedule/jedule_events.hpp"
22 #include "simgrid/jedule/jedule_platform.hpp"
23 #include "../../simdag/simdag_private.hpp"
27 XBT_LOG_NEW_CATEGORY(jedule, "Logging specific to Jedule");
28 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(jed_sd, jedule, "Logging specific to Jedule SD binding");
32 void jedule_log_sd_event(SD_task_t task)
34 xbt_assert(task != nullptr);
37 new simgrid::jedule::Event(std::string(SD_task_get_name(task)), task->start_time, task->finish_time,"SD");
38 event->addResources(task->allocation);
39 my_jedule->event_set.push_back(event);
42 void jedule_setup_platform()
44 AS_t root_comp = simgrid::s4u::Engine::instance()->rootAs();
45 XBT_DEBUG("root name %s\n", root_comp->name());
47 my_jedule = new simgrid::jedule::Jedule();
49 jed_container_t root_container = new simgrid::jedule::Container(std::string(root_comp->name()));
50 root_container->createHierarchy(root_comp);
51 my_jedule->root_container = root_container;
54 void jedule_sd_cleanup()
56 my_jedule->cleanupOutput();
63 void jedule_sd_exit(void)
68 void jedule_sd_dump(const char * filename)
73 fname = bprintf("%s.jed", xbt_binary_name);
75 fname = xbt_strdup(filename);
78 FILE *fh = fopen(fname, "w");
80 my_jedule->writeOutput(fh);