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_latency_bound.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 #define TASK_NUM 3
15
16 /**
17  * 3 tasks send 1 byte in parallel 
18  * 3 flows exceed bandwidth
19  * should be 10001.5
20  * because the max tcp win size is 20000
21  * 
22  * @todo@ test assumes that max tcp win size is 20000
23  * assert this
24  */
25
26 int main(int argc, char **argv) {
27         int i;
28         double time;
29         double communication_amount[] = { 0.0, 1.0, 0.0, 0.0 };
30         double no_cost[] = { 0.0, 0.0 };
31
32         SD_task_t root;
33         SD_task_t task[TASK_NUM];
34
35         SD_init(&argc, argv);
36         SD_create_environment(argv[1]);
37
38         // xbt_assert0( check max tcp win size, "MAX TCP WIN SIZE is 20000");
39
40         root = SD_task_create("Root", NULL, 1.0);
41         SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost, no_cost, -1.0);
42
43         for (i=0; i<TASK_NUM; i++) {
44                 task[i] = SD_task_create("Comm", NULL, 1.0);
45                 SD_task_schedule(task[i], 2, SD_workstation_get_list(), no_cost,
46                                 communication_amount, -1.0);
47                 SD_task_dependency_add(NULL, NULL, root, task[i]);
48         }
49
50         SD_simulate(-1.0);
51
52         time = SD_get_clock();
53
54         printf("%g\n", time);
55         fflush(stdout);
56
57         for (i=0; i<TASK_NUM; i++) {
58                 SD_task_destroy(task[i]);
59         }
60
61         SD_exit();
62
63         return 0;
64 }
65