root/oshmem/util/oshmem_util.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. oshmem_output_verbose
  2. oshmem_output

   1 /*
   2  * Copyright (c) 2014      Mellanox Technologies, Inc.
   3  *                         All rights reserved.
   4  * Copyright (c) 2015 Cisco Systems, Inc.  All rights reserved.
   5  * Copyright (c) 2018      Amazon.com, Inc. or its affiliates.  All Rights reserved.
   6  * $COPYRIGHT$
   7  *
   8  * Additional copyrights may follow
   9  *
  10  * $HEADER$
  11  */
  12 
  13 #include "oshmem_config.h"
  14 #include <stdarg.h>
  15 #include <stdio.h>
  16 
  17 #include "opal/util/printf.h"
  18 
  19 #include "oshmem/constants.h"
  20 #include "oshmem/util/oshmem_util.h"
  21 
  22 void oshmem_output_verbose(int level, int output_id, const char* prefix,
  23     const char* file, int line, const char* function, const char* format, ...)
  24 {
  25     va_list args;
  26     char *buff, *str;
  27     int ret = 0;
  28 
  29     if (level <= opal_output_get_verbosity(output_id)) {
  30         UNREFERENCED_PARAMETER(ret);
  31 
  32         va_start(args, format);
  33 
  34         ret = opal_vasprintf(&str, format, args);
  35         assert(-1 != ret);
  36 
  37         ret = opal_asprintf(&buff, "%s %s", prefix, str);
  38         assert(-1 != ret);
  39 
  40         opal_output(output_id, buff, file, line, function);
  41 
  42         va_end(args);
  43 
  44         free(buff);
  45         free(str);
  46     }
  47 }
  48 
  49 
  50 void oshmem_output(int output_id, const char* prefix, const char* file,
  51     int line, const char* function, const char* format, ...)
  52 {
  53     va_list args;
  54     char *buff, *str;
  55     int ret = 0;
  56 
  57     UNREFERENCED_PARAMETER(ret);
  58 
  59     va_start(args, format);
  60 
  61     ret = opal_vasprintf(&str, format, args);
  62     assert(-1 != ret);
  63 
  64     ret = opal_asprintf(&buff, "%s %s", prefix, str);
  65     assert(-1 != ret);
  66 
  67     opal_output(output_id, buff, file, line, function);
  68 
  69     va_end(args);
  70 
  71     free(buff);
  72     free(str);
  73 }

/* [<][>][^][v][top][bottom][index][help] */