File: oshmem_util.c

package info (click to toggle)
openmpi 5.0.8-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 201,692 kB
  • sloc: ansic: 613,078; makefile: 42,353; sh: 11,194; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,179; python: 1,859; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (73 lines) | stat: -rw-r--r-- 1,645 bytes parent folder | download | duplicates (5)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * Copyright (c) 2014      Mellanox Technologies, Inc.
 *                         All rights reserved.
 * Copyright (c) 2015 Cisco Systems, Inc.  All rights reserved.
 * Copyright (c) 2018      Amazon.com, Inc. or its affiliates.  All Rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#include "oshmem_config.h"
#include <stdarg.h>
#include <stdio.h>

#include "opal/util/printf.h"

#include "oshmem/constants.h"
#include "oshmem/util/oshmem_util.h"

void oshmem_output_verbose(int level, int output_id, const char* prefix,
    const char* file, int line, const char* function, const char* format, ...)
{
    va_list args;
    char *buff, *str;
    int ret = 0;

    if (level <= opal_output_get_verbosity(output_id)) {
        UNREFERENCED_PARAMETER(ret);

        va_start(args, format);

        ret = opal_vasprintf(&str, format, args);
        assert(-1 != ret);

        ret = opal_asprintf(&buff, "%s %s", prefix, str);
        assert(-1 != ret);

        opal_output(output_id, buff, file, line, function);

        va_end(args);

        free(buff);
        free(str);
    }
}


void oshmem_output(int output_id, const char* prefix, const char* file,
    int line, const char* function, const char* format, ...)
{
    va_list args;
    char *buff, *str;
    int ret = 0;

    UNREFERENCED_PARAMETER(ret);

    va_start(args, format);

    ret = opal_vasprintf(&str, format, args);
    assert(-1 != ret);

    ret = opal_asprintf(&buff, "%s %s", prefix, str);
    assert(-1 != ret);

    opal_output(output_id, buff, file, line, function);

    va_end(args);

    free(buff);
    free(str);
}