From e28f71f6e69d2ad828fd2dd914ded776d4b91c23 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 18 Jul 2008 10:52:21 +0000 Subject: [PATCH] Have ompi_info also output where the value was set from (default, environment, file, or API override). Refs trac:1397 This commit was SVN r18943. The following Trac tickets were found above: Ticket 1397 --> https://svn.open-mpi.org/trac/ompi/ticket/1397 --- ompi/tools/ompi_info/param.cc | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/ompi/tools/ompi_info/param.cc b/ompi/tools/ompi_info/param.cc index 77c52e8662..b3de373b82 100644 --- a/ompi/tools/ompi_info/param.cc +++ b/ompi/tools/ompi_info/param.cc @@ -149,6 +149,7 @@ void ompi_info::show_mca_params(opal_list_t *info, char *value_string, empty[] = "\0"; string message, content, tmp; int value_int, j; + mca_base_param_source_t source; for (i = opal_list_get_first(info); i != opal_list_get_last(info); i = opal_list_get_next(i)) { @@ -160,6 +161,12 @@ void ompi_info::show_mca_params(opal_list_t *info, (NULL != p->mbpp_component_name && component == p->mbpp_component_name)) { + // Find the source of the value + if (OPAL_SUCCESS != + mca_base_param_lookup_source(p->mbpp_index, &source)) { + continue; + } + // Make a string for the default value. Invoke a // lookup because it may transform the string ("~/" -> // "/") or get the value from the @@ -205,6 +212,25 @@ void ompi_info::show_mca_params(opal_list_t *info, content += "\""; } + // Indicate where the param was set from + content += ", data source: "; + switch(source) { + case MCA_BASE_PARAM_SOURCE_DEFAULT: + content += "default value"; + break; + case MCA_BASE_PARAM_SOURCE_ENV: + content += "environment"; + break; + case MCA_BASE_PARAM_SOURCE_FILE: + content += "file"; + break; + case MCA_BASE_PARAM_SOURCE_OVERRIDE: + content += "API override"; + break; + default: + break; + } + // Is this parameter deprecated? if (p->mbpp_deprecated) { content += ", deprecated"; @@ -258,6 +284,28 @@ void ompi_info::show_mca_params(opal_list_t *info, content = value_string; out(message, message, content); + // Indicate where the param was set from + + message = tmp; + message += "data_source"; + switch(source) { + case MCA_BASE_PARAM_SOURCE_DEFAULT: + content = "default value"; + break; + case MCA_BASE_PARAM_SOURCE_ENV: + content = "environment"; + break; + case MCA_BASE_PARAM_SOURCE_FILE: + content = "file"; + break; + case MCA_BASE_PARAM_SOURCE_OVERRIDE: + content = "API override"; + break; + default: + break; + } + out(message, message, content); + // Output whether it's read only or writable message = tmp;