Skip to content

Commit 1c723da

Browse files
UCP/PROTO/CORE: Added 'auto' option for UCX_PROTO_INFO
1 parent 328841f commit 1c723da

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/ucp/core/ucp_context.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,11 @@ static ucs_config_field_t ucp_context_config_table[] = {
487487
ucs_offsetof(ucp_context_config_t, worker_addr_version),
488488
UCS_CONFIG_TYPE_ENUM(ucp_object_versions)},
489489

490-
{"PROTO_INFO", "n",
490+
{"PROTO_INFO", "auto",
491491
"Enable printing protocols information. The value is interpreted as follows:\n"
492492
" 'y' : Print information for all protocols\n"
493493
" 'n' : Do not print any protocol information\n"
494+
" 'auto' : Print information when UCX_LOG_LEVEL is 'debug' or higher\n"
494495
" glob_pattern : Print information for operations matching the glob pattern.\n"
495496
" For example: '*tag*gpu*', '*put*fast*host*'",
496497
ucs_offsetof(ucp_context_config_t, proto_info), UCS_CONFIG_TYPE_STRING},

src/ucp/proto/proto_debug.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,17 @@ static int ucp_proto_debug_is_info_enabled(ucp_context_h context,
161161
const char *proto_info_config = context->config.ext.proto_info;
162162
int bool_value;
163163

164+
/* Handle "auto" - enable when log level is DEBUG or higher */
165+
if (!strcasecmp(proto_info_config, "auto")) {
166+
return ucs_log_is_enabled(UCS_LOG_LEVEL_DEBUG);
167+
}
168+
169+
/* Handle boolean */
164170
if (ucs_config_sscanf_bool(proto_info_config, &bool_value, NULL)) {
165171
return bool_value;
166172
}
167173

174+
/* Handle glob pattern */
168175
return fnmatch(proto_info_config, select_param_str, FNM_CASEFOLD) == 0;
169176
}
170177

0 commit comments

Comments
 (0)