Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
merge xbt/ex.hpp into simgrid/exception.hpp
[simgrid.git] / src / simix / smx_environment.cpp
1 /* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "smx_private.hpp"
7 #include "src/include/surf/surf.hpp"
8 #include "xbt/xbt_os_time.h"
9
10 #include <simgrid/engine.h>
11 #include <simgrid/exception.hpp>
12
13 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_environment, simix, "Logging specific to SIMIX (environment)");
14
15 /********************************* SIMIX **************************************/
16
17 /**
18  * @brief A platform constructor.
19  *
20  * Creates a new platform, including hosts, links and the
21  * routing_table.
22  * @param file a filename of a xml description of a platform. This file
23  * follows this DTD :
24  *
25  *     @include surfxml.dtd
26  *
27  * Here is a small example of such a platform
28  *
29  *     @include small_platform.xml
30  *
31  */
32 void SIMIX_create_environment(std::string file)
33 {
34   double start = 0;
35   double end = 0;
36   if(XBT_LOG_ISENABLED(simix_environment, xbt_log_priority_debug))
37     start = xbt_os_time();
38   try {
39     parse_platform_file(file);
40   }
41   catch (xbt_ex& e) {
42     xbt_die("Error while loading %s: %s", file.c_str(), e.what());
43   }
44   if(XBT_LOG_ISENABLED(simix_environment, xbt_log_priority_debug))
45     end = xbt_os_time();
46   XBT_DEBUG("PARSE TIME: %g", (end - start));
47 }
48
49 void SIMIX_create_environment(const char* file) // deprecated
50 {
51   simgrid_load_platform(file);
52 }
53
54 void SIMIX_post_create_environment()
55 {
56   surf_presolve();
57 }