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)
15 /* creation of the environment */
16 SD_create_environment(argv[1]);
17 printf("Workstation number: %zu, link number: %d\n", sg_host_count(), sg_link_count());
19 sg_host_t *workstations = sg_host_list();
21 if (!strcmp(argv[2], "ONE_LINK")) {
22 sg_host_t w1 = workstations[0];
23 sg_host_t w2 = workstations[1];
24 const char *name1 = sg_host_get_name(w1);
25 const char *name2 = sg_host_get_name(w2);
27 printf("Route between %s and %s\n", name1, name2);
28 SD_link_t *route = SD_route_get_list(w1, w2);
29 int route_size = SD_route_get_size(w1, w2);
30 printf("Route size %d\n", route_size);
31 for (int i = 0; i < route_size; i++)
32 printf(" Link %s: latency = %f, bandwidth = %f\n", sg_link_name(route[i]), sg_link_latency(route[i]), sg_link_bandwidth(route[i]));
33 printf("Route latency = %f, route bandwidth = %f\n", SD_route_get_latency(w1, w2), SD_route_get_bandwidth(w1, w2));
36 if (!strcmp(argv[2], "FULL_LINK")) {
37 int list_size = sg_host_count();
38 for (int i = 0; i < list_size; i++) {
39 sg_host_t w1 = workstations[i];
40 const char *name1 = sg_host_get_name(w1);
41 for (int j = 0; j < list_size; j++) {
42 sg_host_t w2 = workstations[j];
43 const char *name2 = sg_host_get_name(w2);
44 printf("Route between %s and %s\n", name1, name2);
45 SD_link_t *route = SD_route_get_list(w1, w2);
46 int route_size = SD_route_get_size(w1, w2);
47 printf(" Route size %d\n", route_size);
48 for (int k = 0; k < route_size; k++) {
49 printf(" Link %s: latency = %f, bandwidth = %f\n",
50 sg_link_name(route[k]), sg_link_latency(route[k]), sg_link_bandwidth(route[k]));
52 printf(" Route latency = %f, route bandwidth = %f\n", SD_route_get_latency(w1, w2), SD_route_get_bandwidth(w1, w2));
57 if (!strcmp(argv[2], "PROP"))
58 printf("SG_TEST_mem: %s\n", sg_host_get_property_value(sg_host_by_name("host1"), "SG_TEST_mem"));
60 xbt_free(workstations);