Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
merge branches
[simgrid.git] / tools / graphicator / graphicator.c
1 /* Copyright (c) 2008, 2009, 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #ifndef _XBT_WIN32
8 #include <unistd.h>
9 #endif
10
11 #include "msg/msg.h"
12 #include "xbt/graph.h"
13
14 XBT_LOG_NEW_DEFAULT_CATEGORY(graphicator,
15                              "Graphicator Logging System");
16
17 int main(int argc, char **argv)
18 {
19 #ifdef HAVE_TRACING
20   MSG_global_init(&argc, argv);
21
22   if (argc < 3){
23     XBT_INFO("Usage: %s <platform_file.xml> <graphviz_file.dot>", argv[0]);
24     return 1;
25   }
26   char *platformFile = argv[1];
27   char *graphvizFile = argv[2];
28
29   MSG_create_environment(platformFile);
30
31   //creating the graph structure
32   xbt_graph_t graph = TRACE_platform_graph();
33   if (graph == NULL){
34     XBT_INFO ("%s expects --cfg=tracing:1 --cfg=tracing/platform:1", argv[0]);
35   }else{
36     TRACE_platform_graph_export_graphviz (graph, graphvizFile);
37     XBT_INFO ("Output is in file %s", graphvizFile);
38   }
39   MSG_clean();
40 #else
41   XBT_INFO ("works only if simgrid was compiled with tracing enabled.");
42 #endif
43   return 0;
44 }