root/ompi/mca/pml/v/pml_v_output.c

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

DEFINITIONS

This source file includes following definitions.
  1. ompi_pml_v_output_open
  2. ompi_pml_v_output_close

   1 /*
   2  * Copyright (c) 2004-2007 The Trustees of the University of Tennessee.
   3  *                         All rights reserved.
   4  * Copyright (c) 2017      IBM Corporation. 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 "ompi_config.h"
  14 
  15 #include "opal/util/output.h"
  16 #include "opal/util/printf.h"
  17 
  18 #include "pml_v_output.h"
  19 
  20 #if defined(HAVE_UNISTD_H)
  21 #include <unistd.h>
  22 #endif
  23 #include <string.h>
  24 
  25 int ompi_pml_v_output_open(char *output, int verbosity) {
  26     opal_output_stream_t lds;
  27     char hostname[OPAL_MAXHOSTNAMELEN] = "NA";
  28 
  29     OBJ_CONSTRUCT(&lds, opal_output_stream_t);
  30     if(!output) {
  31       mca_pml_v.output = 0;
  32     }
  33     else {
  34         if(!strcmp(output, "stdout")) {
  35             lds.lds_want_stdout = true;
  36         }
  37         else if(!strcmp(output, "stderr")) {
  38             lds.lds_want_stderr = true;
  39         }
  40         else
  41         {
  42             lds.lds_want_file = true;
  43             lds.lds_file_suffix = output;
  44         }
  45         lds.lds_is_debugging = true;
  46         gethostname(hostname, sizeof(hostname));
  47         opal_asprintf(&lds.lds_prefix, "[%s:%05d] pml_v: ", hostname, getpid());
  48         lds.lds_verbose_level = verbosity;
  49         mca_pml_v.output = opal_output_open(&lds);
  50         free(lds.lds_prefix);
  51     }
  52     return mca_pml_v.output;
  53 }
  54 
  55 void ompi_pml_v_output_close(void) {
  56     opal_output_close(mca_pml_v.output);
  57     mca_pml_v.output = -1;
  58 }

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