From 1f972737d4fc409ecbfb403d3addb9ceb908248d Mon Sep 17 00:00:00 2001 From: Mike Dubman Date: Mon, 19 May 2014 13:32:32 +0000 Subject: [PATCH] OSHMEM: optimize print to spend less of formatting when not needed fixed by Roman, reviewed by Miked cmr=v1.8.2:reviewer=ompi-rm1.8 This commit was SVN r31818. --- oshmem/util/oshmem_util.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/oshmem/util/oshmem_util.c b/oshmem/util/oshmem_util.c index 3e3c12949d..15d958611f 100644 --- a/oshmem/util/oshmem_util.c +++ b/oshmem/util/oshmem_util.c @@ -24,22 +24,24 @@ void oshmem_output_verbose(int level, int output_id, const char* prefix, char *buff, *str; int ret; - UNREFERENCED_PARAMETER(ret); + if (level < opal_output_get_verbosity(output_id)) { + UNREFERENCED_PARAMETER(ret); - va_start(args, format); + va_start(args, format); - ret = vasprintf(&str, format, args); - assert(-1 != ret); + ret = vasprintf(&str, format, args); + assert(-1 != ret); - ret = asprintf(&buff, "%s %s", prefix, str); - assert(-1 != ret); + ret = asprintf(&buff, "%s %s", prefix, str); + assert(-1 != ret); - opal_output_verbose(level, output_id, buff, file, line, function); + opal_output(output_id, buff, file, line, function); - va_end(args); + va_end(args); - free(buff); - free(str); + free(buff); + free(str); + } } void oshmem_output(int output_id, const char* prefix, const char* file,