Skip to content

Commit 13979f5

Browse files
committed
opal_info_support: refactor component output separation
Adding component name to the pvar pretty output as well. Further, I think keeping the asprintf()/opal_info_out(msg,msg,------) within the loops is needed to avoid printing any component information (independently for group_vars and group_pvars) in case the upcoming parameters are internal and not to be displayed. Lastly, unnecessarily duplicating the dashed output should not happen as each invocation of opal_info_show_mca_group_params() passes a new group structure which we check. Signed-off-by: Karol Mroz <[email protected]>
1 parent 4325439 commit 13979f5

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

opal/runtime/opal_info_support.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,8 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, m
648648

649649
const mca_base_var_group_t *curr_group = NULL;
650650
char *component_msg = NULL;
651+
asprintf(&component_msg, " %s", group_component);
652+
651653
for (i = 0 ; i < count ; ++i) {
652654
ret = mca_base_var_get(variables[i], &var);
653655
if (OPAL_SUCCESS != ret || ((var->mbv_flags & MCA_BASE_VAR_FLAG_INTERNAL) &&
@@ -657,8 +659,6 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, m
657659
}
658660

659661
if (opal_info_pretty && curr_group != group) {
660-
free(component_msg);
661-
asprintf(&component_msg, " %s", group_component);
662662
asprintf(&message, "MCA%s %s%s", requested ? "" : " (disabled)",
663663
group->group_framework,
664664
component_msg ? component_msg : "");
@@ -704,14 +704,25 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, m
704704
continue;
705705
}
706706

707+
if (opal_info_pretty && curr_group != group) {
708+
asprintf(&message, "MCA%s %s%s", requested ? "" : " (disabled)",
709+
group->group_framework,
710+
component_msg ? component_msg : "");
711+
opal_info_out(message, message, "---------------------------------------------------");
712+
free(message);
713+
curr_group = group;
714+
}
715+
707716
ret = mca_base_pvar_dump (variables[i], &strings, !opal_info_pretty ? MCA_BASE_VAR_DUMP_PARSABLE : MCA_BASE_VAR_DUMP_READABLE);
708717
if (OPAL_SUCCESS != ret) {
709718
continue;
710719
}
711720

712721
for (j = 0 ; strings[j] ; ++j) {
713722
if (0 == j && opal_info_pretty) {
714-
asprintf (&message, "MCA%s %s", requested ? "" : " (disabled)", group->group_framework);
723+
asprintf (&message, "MCA%s %s%s", requested ? "" : " (disabled)",
724+
group->group_framework,
725+
component_msg ? component_msg : "");
715726
opal_info_out(message, message, strings[j]);
716727
free(message);
717728
} else {

0 commit comments

Comments
 (0)