3 /* Copyright (c) 2002,2003,2004 Arnaud Legrand. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
9 #include "xbt/sysdep.h"
11 #include "gras_config.h"
12 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_environment, msg,
13 "Logging specific to MSG (environment)");
15 /** \defgroup msg_easier_life Platform and Application management
16 * \brief This section describes functions to manage the platform creation
17 * and the application deployment. You should also have a look at
18 * \ref MSG_examples to have an overview of their usage.
20 /** @addtogroup msg_easier_life
21 * \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Platforms and Applications" --> \endhtmlonly
25 /********************************* MSG **************************************/
27 /** \ingroup msg_easier_life
28 * \brief A name directory service...
30 * Finds a m_host_t using its name.
31 * \param name the name of an host.
32 * \return the corresponding host
34 m_host_t MSG_get_host_by_name(const char *name)
36 xbt_fifo_item_t i = NULL;
39 xbt_assert0(((msg_global != NULL)
40 && (msg_global->host != NULL)), "Environment not set yet");
42 xbt_fifo_foreach(msg_global->host,i,host,m_host_t) {
43 if(strcmp(host->name, name) == 0) return host;
48 /** \ingroup msg_easier_life
49 * \brief A platform constructor.
51 * Creates a new platform, including hosts, links and the
53 * \param file a filename of a xml description of a platform. This file
56 * \include surfxml.dtd
58 * Here is a small example of such a platform
60 * \include small_platform.xml
62 * Have a look in the directory examples/msg/ to have a big example.
64 void MSG_create_environment(const char *file) {
65 xbt_dict_cursor_t cursor = NULL;
67 void *workstation = NULL;
68 char *workstation_model_name;
70 msg_config_init(); /* make sure that our configuration set is created */
71 surf_timer_resource_init(file);
73 /* which model do you want today? */
74 workstation_model_name = xbt_cfg_get_string (_msg_cfg_set, "surf_workstation_model");
76 DEBUG1("Model : %s", workstation_model_name);
77 if (!strcmp(workstation_model_name,"KCCFLN05")) {
78 surf_workstation_resource_init_KCCFLN05(file);
79 }else if (!strcmp(workstation_model_name,"KCCFLN05_proportional")) {
80 surf_workstation_resource_init_KCCFLN05_proportionnal(file);
81 } else if (!strcmp(workstation_model_name,"CLM03")) {
82 surf_workstation_resource_init_CLM03(file);
84 } else if (!strcmp(workstation_model_name,"GTNETS")) {
85 surf_workstation_resource_init_GTNETS(file);
88 xbt_assert0(0,"The impossible happened (once again)");
90 _msg_init_status = 2; /* inited; don't change settings now */
92 xbt_dict_foreach(workstation_set, cursor, name, workstation) {
93 __MSG_host_create(name, workstation, NULL);