2007-07-28 03:11:00 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2007 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PML_V_OUTPUT_H_HAS_BEEN_INCLUDED
|
|
|
|
#define PML_V_OUTPUT_H_HAS_BEEN_INCLUDED
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
#include "pml_v.h"
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int pml_v_output_init(char *output, int verbosity);
|
|
|
|
void pml_v_output_finalize(void);
|
|
|
|
|
|
|
|
/* Tricky stuff to define V_OUTPUT and V_OUTPUT_VERBOSE with variadic arguments
|
|
|
|
*/
|
|
|
|
#if defined(ACCEPT_C99)
|
|
|
|
# define V_OUTPUT(ARGS...) OPAL_OUTPUT((mca_pml_v.output, __VA_ARGS__))
|
|
|
|
# define V_OUTPUT_VERBOSE(V, ARGS...) OPAL_OUTPUT_VERBOSE((V, mca_pml_v.output, __VA_ARGS__))
|
|
|
|
#elif defined(__GNUC__) && !defined(__STDC__)
|
|
|
|
# define V_OUTPUT(ARGS...) OPAL_OUTPUT((mca_pml_v.output, ARGS))
|
|
|
|
# define V_OUTPUT_VERBOSE(V, ARGS...) OPAL_OUTPUT_VERBOSE((V, mca_pml_v.output, ARGS))
|
2007-07-30 23:11:15 +04:00
|
|
|
#elif OMPI_ENABLE_DEBUG
|
|
|
|
/* No variadic macros available... So sad */
|
2007-07-31 23:33:39 +04:00
|
|
|
static inline void V_OUTPUT(const char* fmt, ... ) {
|
2007-07-30 23:11:15 +04:00
|
|
|
va_list list;
|
|
|
|
char *str;
|
2007-07-31 23:33:39 +04:00
|
|
|
int ret;
|
2007-07-30 23:11:15 +04:00
|
|
|
va_start(list, fmt);
|
2007-07-31 23:33:39 +04:00
|
|
|
ret = vasprintf(&str, fmt, list);
|
|
|
|
assert(-1 != ret);
|
2007-07-30 23:11:15 +04:00
|
|
|
opal_output(mca_pml_v.output, str);
|
|
|
|
free(str);
|
|
|
|
va_end(list);
|
2007-07-28 03:11:00 +04:00
|
|
|
}
|
2007-07-31 23:33:39 +04:00
|
|
|
static inline void V_OUTPUT_VERBOSE(int V, const char* fmt, ... ) {
|
2007-07-30 23:11:15 +04:00
|
|
|
va_list list;
|
|
|
|
char *str;
|
2007-07-31 23:33:39 +04:00
|
|
|
int ret;
|
2007-07-30 23:11:15 +04:00
|
|
|
va_start(list, fmt);
|
2007-07-31 23:33:39 +04:00
|
|
|
ret = vasprintf(&str, fmt, list);
|
|
|
|
assert(-1 != ret);
|
2007-07-30 23:11:15 +04:00
|
|
|
opal_output_verbose(V, mca_pml_v.output, str);
|
|
|
|
free(str);
|
|
|
|
va_end(list);
|
2007-07-28 03:11:00 +04:00
|
|
|
}
|
2007-07-30 23:11:15 +04:00
|
|
|
#else /* !DEBUG */
|
|
|
|
/* Some compilers complain if we have ... and no corresponding va_start() */
|
2007-07-31 23:33:39 +04:00
|
|
|
static inline void V_OUTPUT(const char* fmt, ... ) {
|
2007-07-28 03:11:00 +04:00
|
|
|
#if defined(__PGI)
|
2007-07-30 23:11:15 +04:00
|
|
|
va_list list;
|
|
|
|
va_start(list, fmt);
|
|
|
|
va_end(list);
|
2007-07-28 03:11:00 +04:00
|
|
|
#endif
|
|
|
|
}
|
2007-07-31 23:33:39 +04:00
|
|
|
static inline void V_OUTPUT_VERBOSE(int V, const char* fmt, ... ) {
|
2007-07-28 03:11:00 +04:00
|
|
|
#if defined(__PGI)
|
2007-07-30 23:11:15 +04:00
|
|
|
va_list list;
|
|
|
|
va_start(list, fmt);
|
|
|
|
va_end(list);
|
2007-07-28 03:11:00 +04:00
|
|
|
#endif
|
|
|
|
}
|
2007-07-30 23:11:15 +04:00
|
|
|
#endif /* DEBUG */
|
2007-07-28 03:11:00 +04:00
|
|
|
|
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* PML_V_OUTPUT_H_HAS_BEEN_INCLUDED */
|