Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Dump dotty info for verification
[simgrid.git] / examples / simdag / dax / dax_test.c
1 /* simple test trying to load a DAX file.                                   */
2
3 /* Copyright (c) 2009 Da SimGrid Team. All rights reserved.                 */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8 #include <stdlib.h>
9 #include <stdio.h>
10 #include "simdag/simdag.h"
11 #include "xbt/log.h"
12
13 XBT_LOG_NEW_DEFAULT_CATEGORY(test,
14                              "Logging specific to this SimDag example");
15
16
17 int main(int argc, char **argv) {
18   xbt_dynar_t dax;
19   unsigned int cursor;
20   SD_task_t task;
21
22   /* initialisation of SD */
23   SD_init(&argc, argv);
24
25   /* Check our arguments */
26   if (argc < 3) {
27     INFO1("Usage: %s platform_file dax_file", argv[0]);
28     INFO1("example: %s ../sd_platform.xml Montage_50.xml", argv[0]);
29     exit(1);
30   }
31
32   /* creation of the environment */
33   SD_create_environment(argv[1]);
34
35   /* load the DAX file */
36   dax=SD_daxload(argv[2]);
37
38   /* Display all the tasks */
39   xbt_dynar_foreach(dax,cursor,task) {
40     SD_task_dump(task);
41   }
42
43   FILE *out = fopen("dax.dot","w");
44   fprintf(out,"digraph A {\n");
45   xbt_dynar_foreach(dax,cursor,task) {
46     SD_task_dotty(task,out);
47   }
48   fprintf(out,"}\n");
49   fclose(out);
50
51   /* exit */
52   SD_exit();
53   return 1;
54 }