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.
19 * \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Platforms and Applications" --> \endhtmlonly
23 /********************************* MSG **************************************/
25 /** \ingroup msg_easier_life
26 * \brief A name directory service...
28 * Finds a m_host_t using its name.
29 * \param name the name of an host.
30 * \return the corresponding host
32 m_host_t MSG_get_host_by_name(const char *name)
34 xbt_fifo_item_t i = NULL;
37 xbt_assert0(((msg_global != NULL)
38 && (msg_global->host != NULL)), "Environment not set yet");
40 xbt_fifo_foreach(msg_global->host,i,host,m_host_t) {
41 if(strcmp(host->name, name) == 0) return host;
46 /** \ingroup msg_easier_life
47 * \brief A platform constructor.
49 * Creates a new platform, including hosts, links and the
51 * \param file a filename of a xml description of a platform. This file
54 * \include surfxml.dtd
56 * Here is a small example of such a platform
58 * \include small_platform.xml
60 * Have a look in the directory examples/msg/ to have a big example.
62 void MSG_create_environment(const char *file) {
63 xbt_dict_cursor_t cursor = NULL;
65 void *workstation = NULL;
66 char *workstation_model_name;
68 msg_config_init(); /* make sure that our configuration set is created */
69 surf_timer_resource_init(file);
71 /* which model do you want today? */
72 workstation_model_name = xbt_cfg_get_string (_msg_cfg_set, "surf_workstation_model");
74 DEBUG1("Model : %s", workstation_model_name);
75 if (!strcmp(workstation_model_name,"KCCFLN05")) {
76 surf_workstation_resource_init_KCCFLN05(file);
77 }else if (!strcmp(workstation_model_name,"KCCFLN05_proportional")) {
78 surf_workstation_resource_init_KCCFLN05_proportionnal(file);
79 } else if (!strcmp(workstation_model_name,"CLM03")) {
80 surf_workstation_resource_init_CLM03(file);
82 } else if (!strcmp(workstation_model_name,"GTNETS")) {
83 surf_workstation_resource_init_GTNETS(file);
86 xbt_assert0(0,"The impossible happened (once again)");
88 _msg_init_status = 2; /* inited; don't change settings now */
90 xbt_dict_foreach(workstation_set, cursor, name, workstation) {
91 __MSG_host_create(name, workstation, NULL);