3 /* msg_config.c - support for MSG user configuration */
5 /* Copyright (c) 2005 Martin Quinson. */
6 /* All rights reserved. */
8 /* This program is free software; you can redistribute it and/or modify it
9 * under the terms of the license (GNU LGPL) which comes with this package. */
12 #include "xbt/sysdep.h"
14 #include "gras_config.h"
16 int _msg_init_status = 0; /* 0: beginning of time;
17 1: pre-inited (cfg_set created);
18 2: inited (running) */
19 xbt_cfg_t _msg_cfg_set = NULL;
21 /* callback of the surf_workstation_model variable */
22 static void _msg_cfg_cb__surf_workstation_model(const char *name, int pos) {
25 xbt_assert0(_msg_init_status<2, "Cannot change the model after the initialization");
27 val = xbt_cfg_get_string (_msg_cfg_set, name);
30 xbt_assert1(!strcmp(val, "CLM03") ||
31 !strcmp(val, "KCCFLN05") ||
32 !strcmp(val, "GTNETS"),
33 "Unknown workstation model: %s (either 'CLM03', 'KCCFLN05', or 'GTNETS'",val);
35 xbt_assert1(!strcmp(val, "CLM03") ||
36 !strcmp(val, "KCCFLN05"),
37 "Unknown workstation model: %s (either 'CLM03' or 'KCCFLN05'",val);
42 /* create the config set and register what should be */
43 void msg_config_init(void) {
46 return; /* Already inited, nothing to do */
49 _msg_cfg_set = xbt_cfg_new();
51 xbt_cfg_register (_msg_cfg_set,
52 "surf_workstation_model", xbt_cfgelm_string, 1,1,
53 &_msg_cfg_cb__surf_workstation_model,NULL);
55 xbt_cfg_set_string(_msg_cfg_set,"surf_workstation_model", "KCCFLN05");
58 void msg_config_finalize(void) {
60 if (!_msg_init_status)
61 return; /* Not initialized yet. Nothing to do */
63 xbt_cfg_free(&_msg_cfg_set);
67 /** \brief set a configuration variable
69 * Currently existing configuation variable:
70 * - surf_workstation_model (string): Model of workstation to use.
71 * Possible values (defaults to "KCCFLN05"):
72 * - "CLM03": realistic TCP behavior + basic CPU model (see [CML03 at CCGrid03]) + support for parallel tasks
73 * - "KCCFLN05": realistic TCP behavior + basic CPU model (see [CML03 at CCGrid03]) + failure handling + interference between communications and computations if precised in the platform file.
76 * MSG_config("surf_workstation_model","KCCFLN05");
79 MSG_config(const char *name, ...) {
82 if (!_msg_init_status) {
85 /* xbt_cfg_dump("msg_cfg_set","",_msg_cfg_set);*/
87 xbt_cfg_set_vargs(_msg_cfg_set,name,pa);