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_latency2.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 /*
16  * bw and latency test 2
17  * send 2 x 1 byte from 2 task in same direction 0 -> 1 
18  * 
19  */
20
21 int main(int argc, char **argv)
22 {
23   double time;
24   SD_task_t root;
25   SD_task_t task1;
26   SD_task_t task2;
27   double communication_amount1[] = { 0.0, 1.0, 0.0, 0.0 };
28   double communication_amount2[] = { 0.0, 1.0, 0.0, 0.0 };
29   double no_cost1[] = { 0.0 };
30   double no_cost[] = { 0.0, 0.0 };
31   xbt_dynar_t ret;
32
33   SD_init(&argc, argv);
34   SD_create_environment(argv[1]);
35
36   root = SD_task_create("Root", NULL, 1.0);
37   task1 = SD_task_create("Comm 1", NULL, 1.0);
38   task2 = SD_task_create("Comm 2", NULL, 1.0);
39
40   SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost1, no_cost1,
41                    -1.0);
42   SD_task_schedule(task1, 2, SD_workstation_get_list(), no_cost,
43                    communication_amount1, -1.0);
44   SD_task_schedule(task2, 2, SD_workstation_get_list(), no_cost,
45                    communication_amount2, -1.0);
46
47   SD_task_dependency_add(NULL, NULL, root, task1);
48   SD_task_dependency_add(NULL, NULL, root, task2);
49
50   ret = SD_simulate(-1.0);
51   xbt_dynar_free(&ret);
52
53   time = SD_get_clock();
54
55   printf("%g\n", time);
56   fflush(stdout);
57
58   SD_task_destroy(root);
59   SD_task_destroy(task1);
60   SD_task_destroy(task2);
61
62   SD_exit();
63
64   return 0;
65 }