From: mquinson Date: Tue, 30 Mar 2010 14:40:36 +0000 (+0000) Subject: --help-models display the long description of all known models X-Git-Tag: SVN~342 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/585e88a8584949c3033db68c8af327487af9e780 --help-models display the long description of all known models git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7398 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/ChangeLog b/ChangeLog index 02d321911e..8d2c784609 100644 --- a/ChangeLog +++ b/ChangeLog @@ -45,6 +45,7 @@ SimGrid (3.3.5-svn) unstable; urgency=low o netwotk/weight_S: correction to the weight of competing streams * Add a long description to the models, that users can see with such argument on the command line: --cfg=cpu/model:help + * --help-models display the long description of all known models SMPI: * Implement MPI_Get_count, MPI_MAXLOC, MPI_MINLOC XBT: diff --git a/src/surf/surf.c b/src/surf/surf.c index 1ad77e92c8..dec52bf82e 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -151,7 +151,6 @@ void model_help(const char* category, s_surf_model_description_t * table) { printf("Long description of the %s models accepted by this simulator:\n",category); for (i = 0; table[i].name; i++) printf(" %s: %s\n", table[i].name, table[i].description); - exit(0); } int find_model_description(s_surf_model_description_t * table, diff --git a/src/surf/surf_config.c b/src/surf/surf_config.c index 60da0de937..818b456019 100644 --- a/src/surf/surf_config.c +++ b/src/surf/surf_config.c @@ -34,7 +34,12 @@ static void surf_config_cmd_line(int *argc, char **argv) !strncmp(argv[i], "--help", strlen("--help") + 1)) { printf("Description of the configuration accepted by this simulator:\n"); xbt_cfg_help(_surf_cfg_set); - remove_it = 1; + printf("\nYou can also use --help-models to see the details of all models known by this simulator.\n"); + exit(0); + } else if (!strncmp(argv[i], "--help-models", strlen("--help-models")+1)) { + model_help("workstation",surf_workstation_model_description); + model_help("CPU",surf_cpu_model_description); + model_help("network",surf_network_model_description); exit(0); } if (remove_it) { /*remove this from argv */ @@ -64,8 +69,10 @@ static void _surf_cfg_cb__workstation_model(const char *name, int pos) val = xbt_cfg_get_string(_surf_cfg_set, name); - if (!strcmp(val,"help")) + if (!strcmp(val,"help")) { model_help("workstation",surf_workstation_model_description); + exit(0); + } /* Make sure that the model exists */ find_model_description(surf_workstation_model_description, val); @@ -81,8 +88,10 @@ static void _surf_cfg_cb__cpu_model(const char *name, int pos) val = xbt_cfg_get_string(_surf_cfg_set, name); - if (!strcmp(val,"help")) + if (!strcmp(val,"help")) { model_help("CPU",surf_cpu_model_description); + exit(0); + } /* New Module missing */ find_model_description(surf_cpu_model_description, val); @@ -98,8 +107,10 @@ static void _surf_cfg_cb__network_model(const char *name, int pos) val = xbt_cfg_get_string(_surf_cfg_set, name); - if (!strcmp(val,"help")) + if (!strcmp(val,"help")) { model_help("network",surf_network_model_description); + exit(0); + } /* New Module missing */ find_model_description(surf_network_model_description, val);