X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/cf74de4a878beaa5177d7ea2fc4e11b550240559..7919ec739fbc2f1740eb88055a390b9a871b659d:/src/instr/jedule/jedule_sd_binding.cpp diff --git a/src/instr/jedule/jedule_sd_binding.cpp b/src/instr/jedule/jedule_sd_binding.cpp index c321a598b6..70292bc12d 100644 --- a/src/instr/jedule/jedule_sd_binding.cpp +++ b/src/instr/jedule/jedule_sd_binding.cpp @@ -1,29 +1,15 @@ -/* Copyright (c) 2010-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2010-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "xbt/asserts.h" -#include "xbt/dynar.h" +#include "simgrid/jedule/jedule.hpp" +#include "src/simdag/simdag_private.hpp" -#include "src/surf/surf_private.h" -#include "surf/surf.h" +#include "simgrid/s4u/Engine.hpp" +#include "simgrid/s4u/NetZone.hpp" -#include "simgrid/jedule/jedule_sd_binding.h" -#include "simgrid/simdag.h" -#include "simgrid/s4u/As.hpp" -#include "simgrid/s4u/engine.hpp" - -#include -#include "simgrid/forward.h" - -#include "simgrid/jedule/jedule_events.hpp" -#include "simgrid/jedule/jedule_output.hpp" -#include "simgrid/jedule/jedule_platform.hpp" -#include "../../simdag/simdag_private.hpp" - -#if HAVE_JEDULE +#if SIMGRID_HAVE_JEDULE XBT_LOG_NEW_CATEGORY(jedule, "Logging specific to Jedule"); XBT_LOG_NEW_DEFAULT_SUBCATEGORY(jed_sd, jedule, "Logging specific to Jedule SD binding"); @@ -34,60 +20,45 @@ void jedule_log_sd_event(SD_task_t task) { xbt_assert(task != nullptr); - jed_event_t event = - new simgrid::jedule::Event(std::string(SD_task_get_name(task)), task->start_time, task->finish_time,"SD"); + jed_event_t event = new simgrid::jedule::Event(std::string(SD_task_get_name(task)), + SD_task_get_start_time(task), SD_task_get_finish_time(task), "SD"); event->addResources(task->allocation); - jedule_store_event(event); + my_jedule->event_set.push_back(event); } -void jedule_setup_platform() +void jedule_sd_init() { - jed_create_jedule(&my_jedule); + sg_netzone_t root_comp = simgrid::s4u::Engine::get_instance()->get_netzone_root(); + XBT_DEBUG("root name %s\n", root_comp->get_cname()); - AS_t root_comp = simgrid::s4u::Engine::instance()->rootAs(); - XBT_DEBUG("root name %s\n", root_comp->name()); - - jed_container_t root_container = new simgrid::jedule::Container(std::string(root_comp->name())); - my_jedule->root_container = root_container; + my_jedule = new simgrid::jedule::Jedule(); + jed_container_t root_container = new simgrid::jedule::Container(std::string(root_comp->get_cname())); root_container->createHierarchy(root_comp); + my_jedule->root_container = root_container; } -void jedule_sd_cleanup() -{ - jedule_cleanup_output(); -} - -void jedule_sd_init() -{ - jedule_init_output(); -} - -void jedule_sd_exit(void) +void jedule_sd_exit() { - if (my_jedule) { - jed_free_jedule(my_jedule); - my_jedule = nullptr; - } + delete my_jedule; } void jedule_sd_dump(const char * filename) { if (my_jedule) { char *fname; - FILE *fh; - if (!filename) { + if (not filename) { fname = bprintf("%s.jed", xbt_binary_name); } else { fname = xbt_strdup(filename); } - fh = fopen(fname, "w"); + FILE *fh = fopen(fname, "w"); - write_jedule_output(fh, my_jedule, jedule_event_list, nullptr); + my_jedule->writeOutput(fh); fclose(fh); - free(fname); + xbt_free(fname); } } #endif