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"
10 #include "surf/surf_private.h"
12 extern routing_global_t global_routing;
14 int main(int argc, char **argv)
16 /* initialisation of SD */
18 SD_workstation_t w1, w2;
19 const SD_workstation_t *workstations;
20 const SD_link_t *route;
28 /* creation of the environment */
29 SD_create_environment(argv[1]);
30 printf("Workstation number: %d, link number: %d\n",
31 SD_workstation_get_number(), SD_link_get_number());
35 if(!strcmp(argv[2],"ONE_LINK"))
37 workstations = SD_workstation_get_list();
40 name1 = SD_workstation_get_name(w1);
41 name2 = SD_workstation_get_name(w2);
43 printf("Route between %s and %s\n", name1, name2);
44 route = SD_route_get_list(w1, w2);
45 route_size = SD_route_get_size(w1, w2);
46 printf("Route size %d\n", route_size);
47 for (i = 0; i < route_size; i++) {
48 printf(" Link %s: latency = %f, bandwidth = %f\n",
49 SD_link_get_name(route[i]), SD_link_get_current_latency(route[i]),
50 SD_link_get_current_bandwidth(route[i]));
52 printf("Route latency = %f, route bandwidth = %f\n",
53 SD_route_get_current_latency(w1, w2),
54 SD_route_get_current_bandwidth(w1, w2));
56 printf("%s is router : %d\n",name1,global_routing->is_router(name1));
58 if(!strcmp(argv[2],"FULL_LINK"))
60 workstations = SD_workstation_get_list();
61 list_size = SD_workstation_get_number();
62 for(i = 0; i < list_size; i++)
64 for(j = 0 ; j < list_size; j++)
68 name1 = SD_workstation_get_name(w1);
69 name2 = SD_workstation_get_name(w2);
70 printf("Route between %s and %s\n", name1, name2);
71 route = SD_route_get_list(w1, w2);
72 route_size = SD_route_get_size(w1, w2);
73 printf("\tRoute size %d\n", route_size);
74 for (k = 0; k < route_size; k++) {
75 printf("\tLink %s: latency = %f, bandwidth = %f\n",
76 SD_link_get_name(route[k]), SD_link_get_current_latency(route[k]),
77 SD_link_get_current_bandwidth(route[k]));
79 printf("\tRoute latency = %f, route bandwidth = %f\n",
80 SD_route_get_current_latency(w1, w2),
81 SD_route_get_current_bandwidth(w1, w2));