3 /* Copyright (c) 2007 Arnaud Legrand, Bruno Donnassolo.
4 All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
10 #include "xbt/sysdep.h"
12 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_environment, simix,
13 "Logging specific to SIMIX (environment)");
14 /** \defgroup msg_easier_life Platform and Application management
15 * \brief This section describes functions to manage the platform creation
16 * and the application deployment. You should also have a look at
17 * \ref MSG_examples to have an overview of their usage.
18 * \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Platforms and Applications" --> \endhtmlonly
22 /********************************* SIMIX **************************************/
24 /** \ingroup msg_easier_life
25 * \brief A name directory service...
27 * Finds a m_host_t using its name.
28 * \param name the name of an host.
29 * \return the corresponding host
31 smx_host_t SIMIX_get_host_by_name(const char *name)
33 xbt_fifo_item_t i = NULL;
34 smx_host_t host = NULL;
36 xbt_assert0(((simix_global != NULL)
37 && (simix_global->host != NULL)), "Environment not set yet");
39 xbt_fifo_foreach(simix_global->host,i,host,smx_host_t) {
40 if(strcmp(host->name, name) == 0) return host;
45 /** \ingroup msg_easier_life
46 * \brief A platform constructor.
48 * Creates a new platform, including hosts, links and the
50 * \param file a filename of a xml description of a platform. This file
53 * \include surfxml.dtd
55 * Here is a small example of such a platform
57 * \include small_platform.xml
59 * Have a look in the directory examples/msg/ to have a big example.
61 void SIMIX_create_environment(const char *file)
63 xbt_dict_cursor_t cursor = NULL;
65 void *workstation = NULL;
66 char *workstation_model_name;
68 simix_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 (_simix_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);
78 else if (!strcmp(workstation_model_name,"KCCFLN05_proportionnal")) {
79 surf_workstation_resource_init_KCCFLN05_proportionnal(file);
80 } else if (!strcmp(workstation_model_name,"CLM03")) {
81 surf_workstation_resource_init_CLM03(file);
83 xbt_assert0(0,"The impossible happened (once again)");
85 _simix_init_status = 2; /* inited; don't change settings now */
87 xbt_dict_foreach(workstation_set, cursor, name, workstation) {
88 __SIMIX_host_create(name, workstation, NULL);