Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rewrite the SURFXML_START_TAG and SURFXML_END_TAG.
[simgrid.git] / teshsuite / simdag / platforms / basic_parsing_test.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 #include <stdio.h>
8 #include <stdlib.h>
9 #include "simdag/simdag.h"
10
11 int main(int argc, char **argv)
12 {
13   /* initialisation of SD */
14
15   SD_workstation_t w1, w2;
16   const SD_workstation_t *workstations;
17   const SD_link_t *route;
18   const char *name1;
19   const char *name2;
20   int route_size,i;
21
22   SD_init(&argc, argv);
23
24   /* creation of the environment */
25   SD_create_environment(argv[1]);
26
27   printf("\n\nWorkstation number: %d, link number: %d\n\n",
28          SD_workstation_get_number(), SD_link_get_number());
29
30   workstations = SD_workstation_get_list();
31   w1 = workstations[0];
32   w2 = workstations[1];
33   name1 = SD_workstation_get_name(w1);
34   name2 = SD_workstation_get_name(w2);
35
36   printf("Route between %s and %s\n", name1, name2);
37   route = SD_route_get_list(w1, w2);
38   route_size = SD_route_get_size(w1, w2);
39   for (i = 0; i < route_size; i++) {
40           printf("   Link %s: latency = %f, bandwidth = %f\n",
41           SD_link_get_name(route[i]), SD_link_get_current_latency(route[i]),
42           SD_link_get_current_bandwidth(route[i]));
43   }
44   printf("Route latency = %f, route bandwidth = %fn",
45         SD_route_get_current_latency(w1, w2),
46         SD_route_get_current_bandwidth(w1, w2));
47
48   SD_exit();
49   return 0;
50 }