1 /* Copyright (c) 2008-2013. 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_platf_t routing_platf;
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;
23 int route_size, i, j, k;
30 setvbuf(stdout, NULL, _IOLBF, 0);
35 /* creation of the environment */
36 SD_create_environment(argv[1]);
37 printf("Workstation number: %d, link number: %d\n",
38 SD_workstation_get_number(), SD_link_get_number());
41 if (!strcmp(argv[2], "ONE_LINK")) {
42 workstations = SD_workstation_get_list();
45 name1 = SD_workstation_get_name(w1);
46 name2 = SD_workstation_get_name(w2);
48 printf("Route between %s and %s\n", name1, name2);
49 route = SD_route_get_list(w1, w2);
50 route_size = SD_route_get_size(w1, w2);
51 printf("Route size %d\n", route_size);
52 for (i = 0; i < route_size; i++) {
53 printf(" Link %s: latency = %f, bandwidth = %f\n",
54 SD_link_get_name(route[i]),
55 SD_link_get_current_latency(route[i]),
56 SD_link_get_current_bandwidth(route[i]));
58 printf("Route latency = %f, route bandwidth = %f\n",
59 SD_route_get_current_latency(w1, w2),
60 SD_route_get_current_bandwidth(w1, w2));
62 if (!strcmp(argv[2], "FULL_LINK")) {
63 workstations = SD_workstation_get_list();
64 list_size = SD_workstation_get_number();
65 for (i = 0; i < list_size; i++) {
67 name1 = SD_workstation_get_name(w1);
68 for (j = 0; j < list_size; j++) {
70 name2 = SD_workstation_get_name(w2);
71 printf("Route between %s and %s\n", name1, name2);
72 route = SD_route_get_list(w1, w2);
73 route_size = SD_route_get_size(w1, w2);
74 printf(" Route size %d\n", route_size);
75 for (k = 0; k < route_size; k++) {
76 printf(" Link %s: latency = %f, bandwidth = %f\n",
77 SD_link_get_name(route[k]),
78 SD_link_get_current_latency(route[k]),
79 SD_link_get_current_bandwidth(route[k]));
81 printf(" Route latency = %f, route bandwidth = %f\n",
82 SD_route_get_current_latency(w1, w2),
83 SD_route_get_current_bandwidth(w1, w2));
87 if (!strcmp(argv[2], "PROP")) {
88 printf("SG_TEST_mem: %s\n",
89 SD_workstation_get_property_value(SD_workstation_get_by_name("host1"),
92 printf("Author: %s\n", SD_as_router_get_property_value("AS0", "author"));
93 printf("AS1: %s\n", SD_as_router_get_property_value("AS1", "name"));
94 printf("AS2: %s\n", SD_as_router_get_property_value("AS2", "name"));