1 /* Copyright (c) 2008-2015. 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 "simgrid/simdag.h"
11 int main(int argc, char **argv)
13 /* SD initialization */
16 sg_host_t *workstations;
20 int route_size, i, j, k;
27 setvbuf(stdout, NULL, _IOLBF, 0);
32 /* creation of the environment */
33 SD_create_environment(argv[1]);
34 printf("Workstation number: %zu, link number: %d\n",
35 sg_host_count(), sg_link_count());
37 workstations = sg_host_list();
39 if (!strcmp(argv[2], "ONE_LINK")) {
42 name1 = sg_host_get_name(w1);
43 name2 = sg_host_get_name(w2);
45 printf("Route between %s and %s\n", name1, name2);
46 route = SD_route_get_list(w1, w2);
47 route_size = SD_route_get_size(w1, w2);
48 printf("Route size %d\n", route_size);
49 for (i = 0; i < route_size; i++) {
50 printf(" Link %s: latency = %f, bandwidth = %f\n",
51 sg_link_name(route[i]),
52 sg_link_latency(route[i]),
53 sg_link_bandwidth(route[i]));
55 printf("Route latency = %f, route bandwidth = %f\n",
56 SD_route_get_latency(w1, w2),
57 SD_route_get_bandwidth(w1, w2));
60 if (!strcmp(argv[2], "FULL_LINK")) {
61 list_size = sg_host_count();
62 for (i = 0; i < list_size; i++) {
64 name1 = sg_host_get_name(w1);
65 for (j = 0; j < list_size; j++) {
67 name2 = sg_host_get_name(w2);
68 printf("Route between %s and %s\n", name1, name2);
69 route = SD_route_get_list(w1, w2);
70 route_size = SD_route_get_size(w1, w2);
71 printf(" Route size %d\n", route_size);
72 for (k = 0; k < route_size; k++) {
73 printf(" Link %s: latency = %f, bandwidth = %f\n",
74 sg_link_name(route[k]),
75 sg_link_latency(route[k]),
76 sg_link_bandwidth(route[k]));
78 printf(" Route latency = %f, route bandwidth = %f\n",
79 SD_route_get_latency(w1, w2),
80 SD_route_get_bandwidth(w1, w2));
85 if (!strcmp(argv[2], "PROP")) {
86 printf("SG_TEST_mem: %s\n",
87 sg_host_get_property_value(sg_host_by_name("host1"),
91 xbt_free(workstations);