File: pml_v_output.c

package info (click to toggle)
openmpi 2.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 99,912 kB
  • ctags: 55,589
  • sloc: ansic: 525,999; f90: 18,307; makefile: 12,062; sh: 6,583; java: 6,278; asm: 3,515; cpp: 2,227; perl: 2,136; python: 1,350; lex: 734; fortran: 52; tcl: 12
file content (55 lines) | stat: -rw-r--r-- 1,321 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * Copyright (c) 2004-2007 The Trustees of the University of Tennessee.
 *                         All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#include "ompi_config.h"
#include "opal/util/output.h"


#include "pml_v_output.h"

#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
#include <string.h>

int pml_v_output_open(char *output, int verbosity) {
    opal_output_stream_t lds;
    char hostname[OPAL_MAXHOSTNAMELEN] = "NA";

    OBJ_CONSTRUCT(&lds, opal_output_stream_t);
    if(!output) {
      mca_pml_v.output = 0;
    }
    else {
        if(!strcmp(output, "stdout")) {
            lds.lds_want_stdout = true;
        }
        else if(!strcmp(output, "stderr")) {
            lds.lds_want_stderr = true;
        }
        else
        {
            lds.lds_want_file = true;
            lds.lds_file_suffix = output;
        }
        lds.lds_is_debugging = true;
        gethostname(hostname, sizeof(hostname));
        asprintf(&lds.lds_prefix, "[%s:%05d] pml_v: ", hostname, getpid());
        lds.lds_verbose_level = verbosity;
        mca_pml_v.output = opal_output_open(&lds);
        free(lds.lds_prefix);
    }
    return mca_pml_v.output;
}

void pml_v_output_close(void) {
    opal_output_close(mca_pml_v.output);
    mca_pml_v.output = -1;
}