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;
25 /* creation of the environment */
26 SD_create_environment(argv[1]);
27 printf("Workstation number: %zu, link number: %d\n",
28 sg_host_count(), sg_link_count());
30 workstations = sg_host_list();
32 if (!strcmp(argv[2], "ONE_LINK")) {
35 name1 = sg_host_get_name(w1);
36 name2 = sg_host_get_name(w2);
38 printf("Route between %s and %s\n", name1, name2);
39 route = SD_route_get_list(w1, w2);
40 route_size = SD_route_get_size(w1, w2);
41 printf("Route size %d\n", route_size);
42 for (i = 0; i < route_size; i++) {
43 printf(" Link %s: latency = %f, bandwidth = %f\n",
44 sg_link_name(route[i]),
45 sg_link_latency(route[i]),
46 sg_link_bandwidth(route[i]));
48 printf("Route latency = %f, route bandwidth = %f\n",
49 SD_route_get_latency(w1, w2),
50 SD_route_get_bandwidth(w1, w2));
53 if (!strcmp(argv[2], "FULL_LINK")) {
54 list_size = sg_host_count();
55 for (i = 0; i < list_size; i++) {
57 name1 = sg_host_get_name(w1);
58 for (j = 0; j < list_size; j++) {
60 name2 = sg_host_get_name(w2);
61 printf("Route between %s and %s\n", name1, name2);
62 route = SD_route_get_list(w1, w2);
63 route_size = SD_route_get_size(w1, w2);
64 printf(" Route size %d\n", route_size);
65 for (k = 0; k < route_size; k++) {
66 printf(" Link %s: latency = %f, bandwidth = %f\n",
67 sg_link_name(route[k]),
68 sg_link_latency(route[k]),
69 sg_link_bandwidth(route[k]));
71 printf(" Route latency = %f, route bandwidth = %f\n",
72 SD_route_get_latency(w1, w2),
73 SD_route_get_bandwidth(w1, w2));
78 if (!strcmp(argv[2], "PROP")) {
79 printf("SG_TEST_mem: %s\n",
80 sg_host_get_property_value(sg_host_by_name("host1"),
84 xbt_free(workstations);