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. */
10 #include "xbt/error.h"
11 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(environment, msg,
12 "Logging specific to MSG (environment)");
14 /********************************* MSG **************************************/
16 /** \ingroup msg_easier_life
17 * \brief A name directory service...
19 * Finds a m_host_t using its name.
20 * \param name the name of an host.
21 * \return the corresponding host
23 m_host_t MSG_get_host_by_name(const char *name)
25 xbt_fifo_item_t i = NULL;
28 xbt_assert0(((msg_global != NULL)
29 && (msg_global->host != NULL)), "Environment not set yet");
31 xbt_fifo_foreach(msg_global->host,i,host,m_host_t) {
32 if(strcmp(host->name, name) == 0) return host;
37 /** \ingroup msg_easier_life
38 * \brief A platform constructor.
40 * Creates a new platform, including hosts, links and the
42 * \param file a filename of a description of a platform. This file is a simple text
43 * file in which you can use C-style comments and C-style strings.
44 * Here is a simple description of the format:
47 host_name "power in MFlops" "availability" "availability file" ON/OFF "failure file"
48 host_name "power in MFlops" "availability" "availability file" ON/OFF "failure file"
51 link_name "bandwidth in Mbytes" "bandwidth file" "latency in ms" "latency file"
52 link_name "bandwidth in Mbytes" "bandwidth file" "latency in ms" "latency file"
55 src_name dst_name (link_name link_name link_name ... )
56 src_name dst_name (link_name link_name link_name ... )
59 * Have a look in the directory examples/msg/ to have a better idea of what
62 void MSG_create_environment(const char *file) {
63 xbt_dict_cursor_t cursor = NULL;
65 void *workstation = NULL;
67 /* surf_workstation_resource_init_CLM03(file); */
68 surf_workstation_resource_init_KCCFLN05(file);
70 xbt_dict_foreach(workstation_set, cursor, name, workstation) {
71 __MSG_host_create(name, workstation, NULL);