Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Restore C interface (needed by StarPU).
[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 #include <xbt/ex.hpp>
10
11 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_environment, simix, "Logging specific to SIMIX (environment)");
12
13 /********************************* SIMIX **************************************/
14
15 /**
16  * \brief A platform constructor.
17  *
18  * Creates a new platform, including hosts, links and the
19  * routing_table.
20  * \param file a filename of a xml description of a platform. This file
21  * follows this DTD :
22  *
23  *     \include surfxml.dtd
24  *
25  * Here is a small example of such a platform
26  *
27  *     \include small_platform.xml
28  *
29  */
30 void SIMIX_create_environment(std::string file)
31 {
32   double start = 0;
33   double end = 0;
34   if(XBT_LOG_ISENABLED(simix_environment, xbt_log_priority_debug))
35     start = xbt_os_time();
36   try {
37     parse_platform_file(file);
38   }
39   catch (xbt_ex& e) {
40     xbt_die("Error while loading %s: %s", file.c_str(), e.what());
41   }
42   if(XBT_LOG_ISENABLED(simix_environment, xbt_log_priority_debug))
43     end = xbt_os_time();
44   XBT_DEBUG("PARSE TIME: %g", (end - start));
45 }
46
47 void SIMIX_create_environment(const char* file)
48 {
49   SIMIX_create_environment(std::string(file));
50 }
51
52 void SIMIX_post_create_environment()
53 {
54   surf_presolve();
55 }