Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a indent rule to format the code in an uniform way, avoiding breaking the branche...
[simgrid.git] / teshsuite / simdag / network / p2p / test_latency2.c
1
2 /*
3  * SimDag
4  * Latency tests
5  * Copyright (C) 2007 
6  * Sascha Hunold, Frederic Suter
7  */
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         double time;
23         SD_task_t root;
24         SD_task_t task1;
25         SD_task_t task2;
26         double communication_amount1[] = { 0.0, 1.0, 0.0, 0.0 };
27         double communication_amount2[] = { 0.0, 1.0, 0.0, 0.0 };
28         double no_cost1[] = { 0.0 };
29         double no_cost[] = { 0.0, 0.0 };
30
31         SD_init(&argc, argv);
32         SD_create_environment(argv[1]);
33
34         root = SD_task_create("Root", NULL, 1.0);
35         task1 = SD_task_create("Comm 1", NULL, 1.0);
36         task2 = SD_task_create("Comm 2", NULL, 1.0);
37
38         SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost1, no_cost1,
39                         -1.0);
40         SD_task_schedule(task1, 2, SD_workstation_get_list(), no_cost,
41                         communication_amount1, -1.0);
42         SD_task_schedule(task2, 2, SD_workstation_get_list(), no_cost,
43                         communication_amount2, -1.0);
44
45         SD_task_dependency_add(NULL, NULL, root, task1);
46         SD_task_dependency_add(NULL, NULL, root, task2);
47
48         SD_simulate(-1.0);
49
50         time = SD_get_clock();
51
52         printf("%g\n", time);
53         fflush(stdout);
54
55         SD_task_destroy(root);
56         SD_task_destroy(task1);
57         SD_task_destroy(task2);
58
59         SD_exit();
60
61         return 0;
62 }
63