Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge back master branch.
[simgrid.git] / teshsuite / simdag / platforms / Evaluate_parse_time.c
1 /* Copyright (c) 2008, 2009, 2010. 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 //teshsuite/simdag/platforms/evaluate_parse_time ../examples/platforms/nancy.xml
8
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include "simdag/simdag.h"
12 #include "surf/surf_private.h"
13 #include <time.h>
14
15 #define BILLION  1000000000L;
16 extern routing_global_t global_routing;
17
18 int main(int argc, char **argv)
19 {
20         struct timespec start, stop;
21         double accum;
22
23         /* initialisation of SD */
24         SD_init(&argc, argv);
25
26         if( clock_gettime( CLOCK_REALTIME, &start) == -1 ) {
27         perror( "clock gettime" );
28         return EXIT_FAILURE;
29         }
30
31         /* creation of the environment */
32         SD_create_environment(argv[1]);
33
34         if( clock_gettime( CLOCK_REALTIME, &stop) == -1 ) {
35         perror( "clock gettime" );
36         return EXIT_FAILURE;
37         }
38
39         accum = ( stop.tv_sec - start.tv_sec )
40                    + (double)( stop.tv_nsec - start.tv_nsec )
41                          / (double)BILLION;
42
43         printf( "%lf\n", accum );
44
45         sleep(20);
46
47         SD_exit();
48
49         return 0;
50 }