Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
03285b7aa439f4d11c20f85f0ec420b9979d0f14
[simgrid.git] / teshsuite / simdag / platforms / Evaluate_get_route_time.c
1 /* Copyright (c) 2008-2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 //for i in $(seq 1 100); do teshsuite/simdag/platforms/evaluate_get_route_time ../examples/platforms/cluster.xml 1 2> /tmp/null ; done
8
9
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include "simdag/simdag.h"
13 #include "surf/surf_private.h"
14 #include "xbt/xbt_os_time.h"
15
16 #define BILLION  1000000000L;
17 extern routing_platf_t routing_platf;
18
19 int main(int argc, char **argv)
20 {
21   SD_workstation_t w1, w2;
22   const SD_workstation_t *workstations;
23   int i, j;
24   int list_size;
25   xbt_os_timer_t timer = xbt_os_timer_new();
26
27   /* initialisation of SD */
28   SD_init(&argc, argv);
29
30   /* creation of the environment */
31   SD_create_environment(argv[1]);
32
33   workstations = SD_workstation_get_list();
34   list_size = SD_workstation_get_number();
35
36   /* Random number initialization */
37   srand( (int) (xbt_os_time()*1000) );
38
39   do{
40     i = rand()%list_size;
41     j = rand()%list_size;
42   }while(i==j);
43
44   w1 = workstations[i];
45   w2 = workstations[j];
46   printf("%d\tand\t%d\t\t",i,j);
47
48   xbt_os_cputimer_start(timer);
49   SD_route_get_list(w1, w2);
50   xbt_os_cputimer_stop(timer);
51
52   printf("%f\n", xbt_os_timer_elapsed(timer) );
53
54   SD_exit();
55
56   return 0;
57 }