3 /* Copyright (c) 2007 Arnaud Legrand, Bruno Donassolo.
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"
13 int _simix_init_status = 0; /* 0: beginning of time;
14 1: pre-inited (cfg_set created);
15 2: inited (running) */
16 xbt_cfg_t _simix_cfg_set = NULL;
18 /* callback of the workstation_model variable */
19 static void _simix_cfg_cb__workstation_model(const char *name, int pos)
23 xbt_assert0(_simix_init_status<2, "Cannot change the model after the initialization");
25 val = xbt_cfg_get_string (_simix_cfg_set, name);
26 /* New Module missing */
27 xbt_assert1(!strcmp(val, "CLM03") ||
28 !strcmp(val, "KCCFLN05") ||
29 !strcmp(val, "KCCFLN05_proportional") ||
30 !strcmp(val, "KCCFLN05_Vegas") ||
31 !strcmp(val, "KCCFLN05_Reno") ||
32 !strcmp(val, "GTNETS"),
33 "Unknown workstation model: %s (choices are: 'CLM03', 'KCCFLN05', 'KCCFLN05_proportional', 'KCCFLN05_Vegas', 'KCCFLN05_Reno' and 'GTNETS'",val);
36 /* create the config set and register what should be */
37 void simix_config_init(void)
40 if (_simix_init_status)
41 return; /* Already inited, nothing to do */
43 _simix_init_status = 1;
44 _simix_cfg_set = xbt_cfg_new();
46 xbt_cfg_register (_simix_cfg_set,
47 "workstation_model", xbt_cfgelm_string, 1,1,
48 &_simix_cfg_cb__workstation_model,NULL);
50 xbt_cfg_set_string(_simix_cfg_set,"workstation_model", "KCCFLN05");
53 void simix_config_finalize(void)
56 if (!_simix_init_status)
57 return; /* Not initialized yet. Nothing to do */
59 xbt_cfg_free(&_simix_cfg_set);
60 _simix_init_status = 0;
63 /** \brief Set a configuration variable
65 * Currently existing configuration variable:
66 * - workstation_model (string): Model of workstation to use.
67 * Possible values (defaults to "KCCFLN05"):
68 * - "CLM03": realistic TCP behavior + basic CPU model (see [CML03 at CCGrid03]) + support for parallel tasks
69 * - "KCCFLN05": realistic TCP behavior + basic CPU model (see [CML03 at CCGrid03]) + failure handling + interference between communications and computations if precised in the platform file.
71 * \param name Configuration variable name that will change.
72 * \param pa A va_list with the others parameters
74 void SIMIX_config(const char *name, va_list pa)
76 if (!_simix_init_status) {
79 xbt_cfg_set_vargs(_simix_cfg_set,name,pa);