X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/31cf054e59a7555c0717d73cd918f24b26e3f1a4..3ebb95127bac9bc6d8ba66319f1db561e9a5c6c1:/src/instr/jedule/jedule.cpp diff --git a/src/instr/jedule/jedule.cpp b/src/instr/jedule/jedule.cpp new file mode 100644 index 0000000000..a687a255f2 --- /dev/null +++ b/src/instr/jedule/jedule.cpp @@ -0,0 +1,67 @@ +/* Copyright (c) 2010-2014. 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 "simgrid/host.h" + +#include +#include +#include + +#include "xbt/asserts.h" +#include "simgrid/jedule/jedule.hpp" + +#if HAVE_JEDULE + +namespace simgrid{ +namespace jedule { + +Jedule::~Jedule() { + delete this->root_container; + for (auto evt: this->event_set) + delete evt; + this->event_set.clear(); +} + +void Jedule::addMetaInfo(char *key, char *value) { + xbt_assert(key != nullptr); + xbt_assert(value != nullptr); + + this->meta_info.insert({key, value}); +} + +void Jedule::cleanupOutput() { + for (auto evt: this->event_set) + delete evt; + this->event_set.clear(); +} +void Jedule::writeOutput(FILE *file) { + if (!this->event_set.empty()){ + + fprintf(file, "\n"); + + if (!this->meta_info.empty()){ + fprintf(file, " \n"); + for (auto elm: this->meta_info) + fprintf(file, " \n",elm.first,elm.second); + fprintf(file, " \n"); + } + + fprintf(file, " \n"); + this->root_container->print(file); + fprintf(file, " \n"); + + fprintf(file, " \n"); + for (auto event :this->event_set) + event->print(file); + fprintf(file, " \n"); + + fprintf(file, "\n"); + } +} + +} +} +#endif