X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/aa27ecff47c7397cf34c1adf7b803bfe5b669538..3f4f5e63dadc0023c0a02a08af8e9e9801b38e8e:/tools/graphicator/graphicator.cpp diff --git a/tools/graphicator/graphicator.cpp b/tools/graphicator/graphicator.cpp index 9d90d2b52f..368892bd08 100644 --- a/tools/graphicator/graphicator.cpp +++ b/tools/graphicator/graphicator.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2008-2020. The SimGrid Team. +/* Copyright (c) 2008-2023. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -6,18 +6,27 @@ #include "simgrid/instr.h" #include "simgrid/s4u.hpp" -#include "xbt/graph.h" int main(int argc, char** argv) { simgrid::s4u::Engine e(&argc, argv); - - xbt_assert(argc == 3, "Usage: %s ", argv[0]); + xbt_assert(argc == 3, "Usage: %s ", argv[0]); e.load_platform(argv[1]); - int status = TRACE_platform_graph_export_graphviz(argv[2]); + e.seal_platform(); - xbt_assert(status != 0, "%s expects --cfg=tracing:yes --cfg=tracing/platform:yes", argv[0]); - e.run(); /* useless, except for correctly cleaning memory */ + const std::string outputfile(argv[2]); + const std::string extension = outputfile.substr(outputfile.find_last_of(".") + 1); + if(extension == "csv") { + printf("Dumping to CSV file\n"); + simgrid::instr::platform_graph_export_csv(outputfile); + } + else if(extension == "dot") { + printf("Dumping to DOT file\n"); + simgrid::instr::platform_graph_export_graphviz(outputfile); + } + else { + xbt_die("Unknown output file format, please use '.dot' or .csv' extension"); + } return 0; }