Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Dig through git history, and update copyright lines.
[simgrid.git] / teshsuite / simdag / network / p2p / test_latency3.c
1 /* Latency tests                                                            */
2
3 /* Copyright (c) 2007, 2009-2011. The SimGrid Team.
4  * All rights reserved.                                                     */
5
6 /* This program is free software; you can redistribute it and/or modify it
7  * under the terms of the license (GNU LGPL) which comes with this package. */
8
9 #include <stdio.h>
10 #include <stdlib.h>
11
12 #include "simdag/simdag.h"
13
14 /**
15  * bw and latency test 3
16  * same intention as test 2
17  * sending 2 x 1 bytes at the same time 
18  * this time in opposite direction
19  * 
20  */
21
22 int main(int argc, char **argv)
23 {
24   double time;
25   SD_task_t root;
26   SD_task_t task1;
27   SD_task_t task2;
28   double communication_amount1[] = { 0.0, 1.0, 0.0, 0.0 };
29   double communication_amount2[] = { 0.0, 0.0, 1.0, 0.0 };
30   double no_cost1[] = { 0.0 };
31   double no_cost[] = { 0.0, 0.0 };
32   xbt_dynar_t ret;
33
34   SD_init(&argc, argv);
35   SD_create_environment(argv[1]);
36
37   root = SD_task_create("Root", NULL, 1.0);
38   task1 = SD_task_create("Comm 1", NULL, 1.0);
39   task2 = SD_task_create("Comm 2", NULL, 1.0);
40
41   SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost1,
42                    no_cost1, -1.0);
43   SD_task_schedule(task1, 2, SD_workstation_get_list(), no_cost,
44                    communication_amount1, -1.0);
45   SD_task_schedule(task2, 2, SD_workstation_get_list(), no_cost,
46                    communication_amount2, -1.0);
47
48   SD_task_dependency_add(NULL, NULL, root, task1);
49   SD_task_dependency_add(NULL, NULL, root, task2);
50
51   ret = SD_simulate(-1.0);
52   xbt_dynar_free(&ret);
53
54   time = SD_get_clock();
55
56   printf("%g\n", time);
57   fflush(stdout);
58
59   SD_task_destroy(root);
60   SD_task_destroy(task1);
61   SD_task_destroy(task2);
62
63   SD_exit();
64
65   return 0;
66 }