1
1

Add new MCA param API functions:

- mca_base_param_set_int() -- set the value of an MCA int param from
  the API
- mca_base_param_set_string() -- set the value of an MCA string param
  from the API
- mca_base_param_unsed() -- unset a previously set MCA param (string
  or int)
- mca_base_param_dump() -- obtain a listing of all currently
  registered MCA params
- mca_base_param_dump_release() -- release the list of all registered
  MCA params that was obtained from mca_base_param_dump()

See Doxygen docs in src/mca/base/mca_base_param.h for details of these
functions.

This commit was SVN r4415.
Этот коммит содержится в:
Jeff Squyres 2005-02-12 16:23:39 +00:00
родитель 2b13a95162
Коммит 93e702a3c8
4 изменённых файлов: 479 добавлений и 148 удалений

Просмотреть файл

@ -37,16 +37,15 @@
* Public variables
*
* This variable is public, but not advertised in mca_base_param.h.
* It's only public so that ompi_info can see it. The relevant component
* in ompi_info will provide an extern to see this variable.
* It's only public so that the file parser can see it.
*/
ompi_value_array_t mca_base_params;
ompi_list_t mca_base_param_file_values;
/*
* local variables
*/
static ompi_value_array_t mca_base_params;
static const char *mca_prefix = "OMPI_MCA_";
static char *home = NULL;
static bool initialized = false;
@ -65,6 +64,11 @@ static int param_register(const char *type_name, const char *component_name,
mca_base_param_storage_t *override_value);
static bool param_lookup(size_t index, mca_base_param_storage_t *storage,
ompi_hash_table_t *attrs);
static bool param_set_override(size_t index,
mca_base_param_storage_t *storage,
mca_base_param_type_t type);
static bool lookup_override(mca_base_param_t *param,
mca_base_param_storage_t *storage);
static bool lookup_keyvals(mca_base_param_t *param,
mca_base_param_storage_t *storage,
ompi_hash_table_t *attrs);
@ -80,6 +84,8 @@ static void param_constructor(mca_base_param_t *p);
static void param_destructor(mca_base_param_t *p);
static void fv_constructor(mca_base_param_file_value_t *p);
static void fv_destructor(mca_base_param_file_value_t *p);
static void info_constructor(mca_base_param_info_t *p);
static void info_destructor(mca_base_param_info_t *p);
/*
@ -89,6 +95,8 @@ OBJ_CLASS_INSTANCE(mca_base_param_t, ompi_object_t,
param_constructor, param_destructor);
OBJ_CLASS_INSTANCE(mca_base_param_file_value_t, ompi_list_item_t,
fv_constructor, fv_destructor);
OBJ_CLASS_INSTANCE(mca_base_param_info_t, ompi_list_item_t,
info_constructor, info_destructor);
@ -180,7 +188,7 @@ int mca_base_param_register_string(const char *type_name,
/*
* Associate a keyval with a parameter index
*/
int mca_base_param_kv_associate(size_t index, int keyval)
int mca_base_param_kv_associate(int index, int keyval)
{
size_t len;
mca_base_param_t *array;
@ -190,7 +198,7 @@ int mca_base_param_kv_associate(size_t index, int keyval)
}
len = ompi_value_array_get_size(&mca_base_params);
if (index > len) {
if (((size_t) index) > len) {
return OMPI_ERROR;
}
@ -241,9 +249,14 @@ int mca_base_param_kv_lookup_int(int index, ompi_hash_table_t *attrs,
/*
* Set an integer parameter
*/
#if 0
#error JMS: Need to figure out what to do here
#endif
int mca_base_param_set_int(int index, int value)
{
mca_base_param_storage_t storage;
mca_base_param_unset(index);
storage.intval = value;
return param_set_override(index, &storage, MCA_BASE_PARAM_TYPE_INT);
}
/*
@ -280,9 +293,51 @@ int mca_base_param_kv_lookup_string(int index, ompi_hash_table_t *attrs,
/*
* Set an string parameter
*/
#if 0
#error JMS: Need to figure out what to do here
#endif
int mca_base_param_set_string(int index, char *value)
{
mca_base_param_storage_t storage;
mca_base_param_unset(index);
storage.stringval = value;
return param_set_override(index, &storage, MCA_BASE_PARAM_TYPE_STRING);
}
/*
* Unset a parameter
*/
int mca_base_param_unset(int index)
{
size_t len;
mca_base_param_t *array;
if (!initialized) {
return OMPI_ERROR;
}
len = ompi_value_array_get_size(&mca_base_params);
if (((size_t) index) > len) {
return OMPI_ERROR;
}
/* We have a valid entry (remember that we never delete MCA
parameters, so if the index is >0 and <len, it must be good),
so save the internal flag */
array = OMPI_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
if (array[index].mbp_override_value_set) {
if (MCA_BASE_PARAM_TYPE_STRING == array[index].mbp_type &&
NULL != array[index].mbp_override_value.stringval) {
free(array[index].mbp_override_value.stringval);
array[index].mbp_override_value.stringval = NULL;
}
}
array[index].mbp_override_value_set = false;
/* All done */
return OMPI_SUCCESS;
}
/*
@ -326,7 +381,7 @@ int mca_base_param_find(const char *type_name, const char *component_name,
}
int mca_base_param_set_internal(size_t index, bool internal)
int mca_base_param_set_internal(int index, bool internal)
{
size_t len;
mca_base_param_t *array;
@ -338,7 +393,7 @@ int mca_base_param_set_internal(size_t index, bool internal)
}
len = ompi_value_array_get_size(&mca_base_params);
if (index > len) {
if (((size_t) index) > len) {
return OMPI_ERROR;
}
@ -355,6 +410,69 @@ int mca_base_param_set_internal(size_t index, bool internal)
}
/*
* Return a list of info of all currently registered parameters
*/
int mca_base_param_dump(ompi_list_t **info, bool internal)
{
size_t i, len;
mca_base_param_info_t *p;
mca_base_param_t *array;
/* Check for bozo cases */
if (!initialized) {
return OMPI_ERROR;
}
if (NULL == info) {
return OMPI_ERROR;
}
*info = OBJ_NEW(ompi_list_t);
/* Iterate through all the registered parameters */
len = ompi_value_array_get_size(&mca_base_params);
array = OMPI_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
for (i = 0; i < len; ++i) {
p = OBJ_NEW(mca_base_param_info_t);
p->mbpp_index = i;
p->mbpp_type_name = array[i].mbp_type_name;
p->mbpp_component_name = array[i].mbp_component_name;
p->mbpp_param_name = array[i].mbp_param_name;
p->mbpp_type = array[i].mbp_type;
/* JMS to be removed? */
p->mbpp_env_var_name = array[i].mbp_env_var_name;
p->mbpp_full_name = array[i].mbp_full_name;
ompi_list_append(*info, (ompi_list_item_t*) p);
}
/* All done */
return OMPI_SUCCESS;
}
/*
* Free a list -- and all associated memory -- that was previously
* returned from mca_base_param_dump()
*/
int mca_base_param_dump_release(ompi_list_t *info)
{
ompi_list_item_t *item;
for (item = ompi_list_remove_first(info); NULL != item;
item = ompi_list_remove_first(info)) {
OBJ_RELEASE(item);
}
OBJ_RELEASE(info);
return OMPI_SUCCESS;
}
/*
* Shut down the MCA parameter system (normally only invoked by the
* MCA framework itself).
@ -633,6 +751,43 @@ static int param_register(const char *type_name, const char *component_name,
}
/*
* Set an override
*/
static bool param_set_override(size_t index,
mca_base_param_storage_t *storage,
mca_base_param_type_t type)
{
size_t size;
mca_base_param_t *array;
/* Lookup the index and see if it's valid */
if (!initialized) {
return false;
}
size = ompi_value_array_get_size(&mca_base_params);
if (index > size) {
return false;
}
array = OMPI_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
if (MCA_BASE_PARAM_TYPE_INT == type) {
array[index].mbp_override_value.intval = storage->intval;
} else if (MCA_BASE_PARAM_TYPE_STRING == type) {
if (NULL != storage->stringval) {
array[index].mbp_override_value.stringval =
strdup(storage->stringval);
} else {
array[index].mbp_override_value.stringval = NULL;
}
}
array[index].mbp_override_value_set = true;
return true;
}
/*
* Lookup a parameter in multiple places
*/
@ -664,7 +819,8 @@ static bool param_lookup(size_t index, mca_base_param_storage_t *storage,
/* Check all the places that the param may be hiding, in priority
order */
if (lookup_keyvals(&array[index], storage, attrs) ||
if (lookup_override(&array[index], storage) ||
lookup_keyvals(&array[index], storage, attrs) ||
lookup_env(&array[index], storage) ||
lookup_file(&array[index], storage) ||
lookup_default(&array[index], storage)) {
@ -699,6 +855,28 @@ static bool param_lookup(size_t index, mca_base_param_storage_t *storage,
}
/*
* Lookup a param in the overrides section
*/
static bool lookup_override(mca_base_param_t *param,
mca_base_param_storage_t *storage)
{
if (param->mbp_override_value_set) {
if (MCA_BASE_PARAM_TYPE_INT == param->mbp_type) {
storage->intval = param->mbp_override_value.intval;
} else if (MCA_BASE_PARAM_TYPE_STRING == param->mbp_type) {
storage->stringval = strdup(param->mbp_override_value.stringval);
}
return true;
}
/* Don't have an override */
return false;
}
/*
* Lookup a param in the set of attributes/keyvals
*/
@ -920,6 +1098,7 @@ static void param_destructor(mca_base_param_t *p)
free(p->mbp_override_value.stringval);
}
}
param_constructor(p);
}
@ -938,4 +1117,26 @@ static void fv_destructor(mca_base_param_file_value_t *f)
if (NULL != f->mbpfv_value) {
free(f->mbpfv_value);
}
fv_constructor(f);
}
static void info_constructor(mca_base_param_info_t *p)
{
p->mbpp_index = -1;
p->mbpp_type_name = NULL;
p->mbpp_component_name = NULL;
p->mbpp_param_name = NULL;
p->mbpp_type = MCA_BASE_PARAM_TYPE_MAX;
/* JMS to be removed? */
p->mbpp_env_var_name = NULL;
p->mbpp_full_name = NULL;
}
static void info_destructor(mca_base_param_info_t *p)
{
/* No need to free any of the strings -- the pointers were copied
by value from their corresponding parameter registration */
info_constructor(p);
}

Просмотреть файл

@ -57,8 +57,57 @@
#include "mpi.h"
#include "class/ompi_value_array.h"
#include "class/ompi_list.h"
#include "class/ompi_hash_table.h"
/**
* The types of MCA parameters.
*/
typedef enum {
/** The parameter is of type integer. */
MCA_BASE_PARAM_TYPE_INT,
/** The parameter is of type string. */
MCA_BASE_PARAM_TYPE_STRING,
/** Maximum parameter type. */
MCA_BASE_PARAM_TYPE_MAX
} mca_base_param_type_t;
/**
* Struct for holding name/type info. Used in mca_base_param_dump(),
* below.
*/
struct mca_base_param_info_t {
/** So that we can be in a list */
ompi_list_item_t super;
/** Index of this parameter */
int mbpp_index;
/** String name of the type of the parameter */
char *mbpp_type_name;
/** String name of the component of the parameter */
char *mbpp_component_name;
/** String name of the parameter of the parameter */
char *mbpp_param_name;
/** Enum indicating the back-end type of the parameter */
mca_base_param_type_t mbpp_type;
/** JMS To be removed? */
char *mbpp_env_var_name;
/** JMS To be removed? */
char *mbpp_full_name;
};
/**
* Convenience typedef
*/
typedef struct mca_base_param_info_t mca_base_param_info_t;
/**
* Make a real object for the info
*/
OBJ_CLASS_DECLARATION(mca_base_param_info_t);
/*
* Global functions for MCA
*/
@ -75,7 +124,7 @@ extern "C" {
* invoked internally (by mca_base_open()) and is only documented
* here for completeness.
*/
OMPI_DECLSPEC int mca_base_param_init(void);
OMPI_DECLSPEC int mca_base_param_init(void);
/**
* Register an integer MCA parameter.
@ -119,11 +168,11 @@ OMPI_DECLSPEC int mca_base_param_init(void);
* returned, but the default value will be changed to reflect the
* last registration.
*/
OMPI_DECLSPEC int mca_base_param_register_int(const char *type_name,
const char *component_name,
const char *param_name,
const char *mca_param_name,
int default_value);
OMPI_DECLSPEC int mca_base_param_register_int(const char *type_name,
const char *component_name,
const char *param_name,
const char *mca_param_name,
int default_value);
/**
* Register a string MCA parameter.
@ -147,11 +196,11 @@ OMPI_DECLSPEC int mca_base_param_register_int(const char *type_name,
* associated string default value (which is allowed to be NULL).
* See mca_base_param_register_int() for all other details.
*/
OMPI_DECLSPEC int mca_base_param_register_string(const char *type_name,
const char *component_name,
const char *param_name,
const char *mca_param_name,
const char *default_value);
OMPI_DECLSPEC int mca_base_param_register_string(const char *type_name,
const char *component_name,
const char *param_name,
const char *mca_param_name,
const char *default_value);
/**
* Associate a communicator/datatype/window keyval with an MCA
@ -176,7 +225,7 @@ OMPI_DECLSPEC int mca_base_param_register_string(const char *type_name,
* versions will cross reference and attempt to find parameter
* values on attributes.
*/
OMPI_DECLSPEC int mca_base_param_kv_associate(size_t index, int keyval);
OMPI_DECLSPEC int mca_base_param_kv_associate(int index, int keyval);
/**
* Look up an integer MCA parameter.
@ -194,7 +243,7 @@ OMPI_DECLSPEC int mca_base_param_kv_associate(size_t index, int keyval);
* The value of a specific MCA parameter can be looked up using the
* return value from mca_base_param_register_int().
*/
OMPI_DECLSPEC int mca_base_param_lookup_int(int index, int *value);
OMPI_DECLSPEC int mca_base_param_lookup_int(int index, int *value);
/**
* Look up an integer MCA parameter, to include looking in
@ -216,9 +265,9 @@ OMPI_DECLSPEC int mca_base_param_lookup_int(int index, int *value);
* value. The function mca_base_param_kv_associate() must have been
* called first to associate a keyval with the index.
*/
OMPI_DECLSPEC int mca_base_param_kv_lookup_int(int index,
struct ompi_hash_table_t *attrs,
int *value);
OMPI_DECLSPEC int mca_base_param_kv_lookup_int(int index,
struct ompi_hash_table_t *attrs,
int *value);
/**
* Look up a string MCA parameter.
@ -236,7 +285,7 @@ OMPI_DECLSPEC int mca_base_param_kv_lookup_int(int index,
* The value of a specific MCA parameter can be looked up using the
* return value from mca_base_param_register_string().
*/
OMPI_DECLSPEC int mca_base_param_lookup_string(int index, char **value);
OMPI_DECLSPEC int mca_base_param_lookup_string(int index, char **value);
/**
* Look up a string MCA parameter, to include looking in attributes.
@ -257,9 +306,60 @@ OMPI_DECLSPEC int mca_base_param_lookup_string(int index, char **value);
* parameter value. The function mca_base_param_kv_associate() must
* have been called first to associate a keyval with the index.
*/
OMPI_DECLSPEC int mca_base_param_kv_lookup_string(int index,
struct ompi_hash_table_t *attrs,
char **value);
OMPI_DECLSPEC int mca_base_param_kv_lookup_string(int index,
struct ompi_hash_table_t *attrs,
char **value);
/**
* Sets an "override" value for an integer MCA parameter.
*
* @param index[in] Index of MCA parameter to set
* @param value[in] The integer value to set
*
* @retval OMPI_ERROR If the parameter was not found.
* @retval OMPI_SUCCESS Upon success.
*
* This function sets an integer value on the MCA parmeter
* indicated by the index value index. This value will be used in
* lieu of any other value from any other MCA source (environment
* variable, file, etc.) until the value is unset with
* mca_base_param_unset().
*/
OMPI_DECLSPEC int mca_base_param_set_int(int index, int value);
/**
* Sets an "override" value for an string MCA parameter.
*
* @param index[in] Index of MCA parameter to set
* @param value[in] The string value to set
*
* @retval OMPI_ERROR If the parameter was not found.
* @retval OMPI_SUCCESS Upon success.
*
* This function sets a string value on the MCA parmeter
* indicated by the index value index. This value will be used in
* lieu of any other value from any other MCA source (environment
* variable, file, etc.) until the value is unset with
* mca_base_param_unset().
*
* The string is copied by value; the string buffer does not
* become "owned" by the parameter subsystem.
*/
OMPI_DECLSPEC int mca_base_param_set_string(int index, char *value);
/**
* Unset a parameter that was previously set by
* mca_base_param_set_int() or mca_base_param_set_string().
*
* @param index[in] Index of MCA parameter to set
*
* @retval OMPI_ERROR If the parameter was not found.
* @retval OMPI_SUCCESS Upon success.
*
* Resets previous value that was set (if any) on the given MCA
* parameter.
*/
OMPI_DECLSPEC int mca_base_param_unset(int index);
/**
* Find the index for an MCA parameter based on its names.
@ -280,8 +380,9 @@ OMPI_DECLSPEC int mca_base_param_kv_lookup_string(int index,
* can be used with mca_base_param_lookup_int() and
* mca_base_param_lookup_string().
*/
OMPI_DECLSPEC int mca_base_param_find(const char *type, const char *component,
const char *param);
OMPI_DECLSPEC int mca_base_param_find(const char *type,
const char *component,
const char *param);
/**
* Set the "internal" flag on an MCA parameter to true or false.
@ -302,8 +403,53 @@ OMPI_DECLSPEC int mca_base_param_find(const char *type, const char *component,
* MPI_INIT (at least, they're not displayed by default), thus
* keeping them away from prying user eyes.
*/
OMPI_DECLSPEC int mca_base_param_set_internal(size_t index, bool internal);
OMPI_DECLSPEC int mca_base_param_set_internal(int index, bool internal);
/**
* Obtain a list of all the MCA parameters currently defined as
* well as their types.
*
* @param info[out] An ompi_list_t of mca_base_param_info_t
* instances.
* @param internal[in] Whether to include the internal parameters
* or not.
*
* @retval OMPI_SUCCESS Upon success.
* @retval OMPI_ERROR Upon failure.
*
* This function is used to obtain a list of all the currently
* registered MCA parameters along with their associated types
* (currently: string or integer). The results from this function
* can be used to repeatedly invoke mca_base_param_lookup_int()
* and/or mca_base_param_lookup_string() to obtain a comprehensive
* list of all MCA parameters and their current values.
*
* Releasing the list, and all the items in the list, is a
* relatively complicated process. Use the companion function
* mca_base_param_dump_release() when finished with the returned
* info list to release all associated memory.
*/
OMPI_DECLSPEC int mca_base_param_dump(ompi_list_t **info, bool internal);
/**
* Release the memory associated with the info list returned from
* mca_base_param_dump().
*
* @param info[in/out] An ompi_list_t previously returned from
* mca_base_param_dump().
*
* @retval OMPI_SUCCESS Upon success.
* @retval OMPI_ERROR Upon failure.
*
* This function is intended to be used to free the info list
* returned from mca_base_param_dump(). There are a bunch of
* strings and other associated memory in the list making it
* cumbersome for the caller to free it all properly. Hence, once
* the caller is finished with the info list, invoke this
* function and all memory associated with the list will be freed.
*/
OMPI_DECLSPEC int mca_base_param_dump_release(ompi_list_t *info);
/**
* Shut down the MCA parameter system (normally only invoked by the
* MCA framework itself).
@ -318,11 +464,8 @@ OMPI_DECLSPEC int mca_base_param_set_internal(size_t index, bool internal);
* when the process is shutting down (e.g., during MPI_FINALIZE). It
* is only documented here for completeness.
*/
OMPI_DECLSPEC int mca_base_param_finalize(void);
OMPI_DECLSPEC int mca_base_param_finalize(void);
OMPI_DECLSPEC extern ompi_value_array_t mca_base_params;
OMPI_DECLSPEC extern ompi_list_t mca_base_param_file_values;
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif

Просмотреть файл

@ -33,6 +33,7 @@
#include "class/ompi_object.h"
#include "class/ompi_list.h"
#include "class/ompi_hash_table.h"
#include "mca/base/mca_base_param.h"
/**
* \internal
@ -47,22 +48,6 @@ typedef union {
} mca_base_param_storage_t;
/**
* \internal
*
* The following types are really in this public .h file so that
* ompi_info can see them. No one else should use them!
*/
typedef enum {
/** The parameter is of type integer. */
MCA_BASE_PARAM_TYPE_INT,
/** The parameter is of type string. */
MCA_BASE_PARAM_TYPE_STRING,
/** Maximum parameter type. */
MCA_BASE_PARAM_TYPE_MAX
} mca_base_param_type_t;
/**
* \internal
*

Просмотреть файл

@ -28,7 +28,6 @@
#include "class/ompi_value_array.h"
#include "util/printf.h"
#include "mca/base/mca_base_param.h"
#include "mca/base/mca_base_param_internal.h"
#include "tools/ompi_info/ompi_info.h"
using namespace std;
@ -114,103 +113,106 @@ void ompi_info::do_params(bool want_all, bool want_internal)
void ompi_info::show_mca_params(const string& type, const string& component,
const string& param, bool want_internal)
{
size_t i, size;
char *value_string, empty[] = "\0";
string message, content;
mca_base_param_t *item;
int value_int;
ompi_list_t *info;
ompi_list_item_t *i;
mca_base_param_info_t *p;
char *value_string, empty[] = "\0";
string message, content;
int value_int;
size = ompi_value_array_get_size(&mca_base_params);
if (0 == size) {
return;
}
mca_base_param_dump(&info, want_internal);
for (i = ompi_list_get_first(info); i != ompi_list_get_last(info);
i = ompi_list_get_next(i)) {
p = (mca_base_param_info_t*) i;
if (type == p->mbpp_type_name) {
if (component == component_all ||
NULL == p->mbpp_component_name ||
(NULL != p->mbpp_component_name &&
component == p->mbpp_component_name)) {
if (param == param_all || param == p->mbpp_param_name) {
for (i = 0; i < size; ++i) {
item = &(OMPI_VALUE_ARRAY_GET_ITEM(&mca_base_params, mca_base_param_t, i));
if (type == item->mbp_type_name &&
(!item->mbp_internal || want_internal)) {
if (component == component_all ||
NULL == item->mbp_component_name ||
(NULL != item->mbp_component_name &&
component == item->mbp_component_name)) {
if (param == param_all || param == item->mbp_param_name) {
// Make a string for the default value. Invoke a
// lookup because it may transform the string
// ("~/" -> "<home dir>/") or get the value from
// the environment, a file, etc.
// Make a string for the default value. Invoke a lookup
// because it may transform the string ("~/" -> "<home
// dir>/") or get the value from the
// environment, a file, etc.
if (MCA_BASE_PARAM_TYPE_STRING == p->mbpp_type) {
mca_base_param_lookup_string(p->mbpp_index,
&value_string);
if (MCA_BASE_PARAM_TYPE_STRING == item->mbp_type) {
mca_base_param_lookup_string(i, &value_string);
// Can't let the string be NULL because we
// assign it to a std::string, below
// Can't let the string be NULL because we assign it to a
// std::string, below
if (NULL == value_string) {
value_string = empty;
if (NULL == value_string) {
value_string = empty;
}
} else {
mca_base_param_lookup_int(p->mbpp_index, &value_int);
asprintf(&value_string, "%d", value_int);
}
content = value_string;
// Build up the strings to output.
if (pretty) {
message = "MCA ";
message += p->mbpp_type_name;
// Put in the real, full name (which may be
// different than the categorization).
content = (p->mbpp_env_var_name != NULL) ?
"parameter \"" : "information \"";
content += p->mbpp_full_name;
content += (p->mbpp_env_var_name != NULL) ?
"\" (default: " : "\" (value: ";
if (strlen(value_string) == 0)
content += "<none>)";
else {
content += "\"";
content += value_string;
content += "\")";
}
out(message, message, content);
} else {
message = "mca:";
message += p->mbpp_type_name;
message += ":";
if (p->mbpp_component_name != NULL) {
message += p->mbpp_component_name;
} else {
message += "base";
}
message += (p->mbpp_env_var_name != NULL) ?
":param:" : ":info:";
// Put in the real, full name (which may be
// different than the categorization).
message += p->mbpp_full_name;
content = value_string;
out(message, message, content);
}
// If we allocated the string, then free it
if (value_string != empty) {
free(value_string);
}
}
}
} else {
mca_base_param_lookup_int(i, &value_int);
asprintf(&value_string, "%d", value_int);
}
content = value_string;
// Build up the strings to output.
if (pretty) {
message = "MCA ";
message += item->mbp_type_name;
// Put in the real, full name (which may be different than
// the categorization).
content = (item->mbp_env_var_name != NULL) ?
"parameter \"" : "information \"";
content += item->mbp_full_name;
content += (item->mbp_env_var_name != NULL) ?
"\" (default: " : "\" (value: ";
if (strlen(value_string) == 0)
content += "<none>)";
else {
content += "\"";
content += value_string;
content += "\")";
}
out(message, message, content);
} else {
message = "mca:";
message += item->mbp_type_name;
message += ":";
if (item->mbp_component_name != NULL) {
message += item->mbp_component_name;
} else {
message += "base";
}
message += (item->mbp_env_var_name != NULL) ?
":param:" : ":info:";
// Put in the real, full name (which may be different than
// the categorization).
message += item->mbp_full_name;
content = value_string;
out(message, message, content);
}
// If we allocated the string, then free it
if (value_string != empty) {
free(value_string);
}
}
}
}
}
/* Release the memory */
mca_base_param_dump_release(info);
}