1 /* Copyright (c) 2008, 2009, 2010. The SimGrid Team.
2 * All rights reserved. */
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. */
9 #include "simdag/simdag.h"
11 int main(int argc, char **argv)
13 /* initialisation of SD */
15 SD_workstation_t w1, w2;
16 const SD_workstation_t *workstations;
17 const SD_link_t *route;
25 /* creation of the environment */
26 SD_create_environment(argv[1]);
27 printf("Workstation number: %d, link number: %d\n",
28 SD_workstation_get_number(), SD_link_get_number());
32 if(!strcmp(argv[2],"ONE_LINK"))
34 workstations = SD_workstation_get_list();
37 name1 = SD_workstation_get_name(w1);
38 name2 = SD_workstation_get_name(w2);
40 printf("Route between %s and %s\n", name1, name2);
41 route = SD_route_get_list(w1, w2);
42 route_size = SD_route_get_size(w1, w2);
43 printf("Route size %d\n", route_size);
44 for (i = 0; i < route_size; i++) {
45 printf(" Link %s: latency = %f, bandwidth = %f\n",
46 SD_link_get_name(route[i]), SD_link_get_current_latency(route[i]),
47 SD_link_get_current_bandwidth(route[i]));
49 printf("Route latency = %f, route bandwidth = %f\n",
50 SD_route_get_current_latency(w1, w2),
51 SD_route_get_current_bandwidth(w1, w2));
53 if(!strcmp(argv[2],"FULL_LINK"))
55 workstations = SD_workstation_get_list();
56 list_size = SD_workstation_get_number();
57 for(i = 0; i < list_size; i++)
59 for(j = 0 ; j < list_size; j++)
63 name1 = SD_workstation_get_name(w1);
64 name2 = SD_workstation_get_name(w2);
65 printf("Route between %s and %s\n", name1, name2);
66 route = SD_route_get_list(w1, w2);
67 route_size = SD_route_get_size(w1, w2);
68 printf("\tRoute size %d\n", route_size);
69 for (k = 0; k < route_size; k++) {
70 printf("\tLink %s: latency = %f, bandwidth = %f\n",
71 SD_link_get_name(route[k]), SD_link_get_current_latency(route[k]),
72 SD_link_get_current_bandwidth(route[k]));
74 printf("\tRoute latency = %f, route bandwidth = %f\n",
75 SD_route_get_current_latency(w1, w2),
76 SD_route_get_current_bandwidth(w1, w2));