2008-02-28 04:57:57 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2012-06-24 01:20:09 +04:00
|
|
|
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
|
2014-02-12 23:37:21 +04:00
|
|
|
* Copyright (c) 2014 Intel, Inc. All rights reserved.
|
2008-02-28 04:57:57 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "opal_config.h"
|
|
|
|
|
2009-01-04 08:09:18 +03:00
|
|
|
#include "opal_stdint.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "opal/dss/dss_internal.h"
|
|
|
|
|
|
|
|
int opal_dss_print(char **output, char *prefix, void *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
opal_dss_type_info_t *info;
|
|
|
|
|
|
|
|
/* check for error */
|
|
|
|
if (NULL == output) {
|
|
|
|
return OPAL_ERR_BAD_PARAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Lookup the print function for this type and call it */
|
|
|
|
|
|
|
|
if(NULL == (info = (opal_dss_type_info_t*)opal_pointer_array_get_item(&opal_dss_types, type))) {
|
|
|
|
return OPAL_ERR_UNKNOWN_DATA_TYPE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return info->odti_print_fn(output, prefix, src, type);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* STANDARD PRINT FUNCTIONS FOR SYSTEM TYPES
|
|
|
|
*/
|
|
|
|
int opal_dss_print_byte(char **output, char *prefix, uint8_t *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_BYTE\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_BYTE\tValue: %x", prefix, *src);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int opal_dss_print_string(char **output, char *prefix, char *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_STRING\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_STRING\tValue: %s", prefx, src);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int opal_dss_print_size(char **output, char *prefix, size_t *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_SIZE\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_SIZE\tValue: %lu", prefx, (unsigned long) *src);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int opal_dss_print_pid(char **output, char *prefix, pid_t *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_PID\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_PID\tValue: %lu", prefx, (unsigned long) *src);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int opal_dss_print_bool(char **output, char *prefix, bool *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_BOOL\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_BOOL\tValue: %s", prefx, *src ? "TRUE" : "FALSE");
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int opal_dss_print_int(char **output, char *prefix, int *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_INT\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_INT\tValue: %ld", prefx, (long) *src);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int opal_dss_print_uint(char **output, char *prefix, int *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_UINT\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_UINT\tValue: %lu", prefx, (unsigned long) *src);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int opal_dss_print_uint8(char **output, char *prefix, uint8_t *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_UINT8\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_UINT8\tValue: %u", prefx, (unsigned int) *src);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int opal_dss_print_uint16(char **output, char *prefix, uint16_t *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_UINT16\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_UINT16\tValue: %u", prefx, (unsigned int) *src);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int opal_dss_print_uint32(char **output, char *prefix, uint32_t *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_UINT32\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_UINT32\tValue: %u", prefx, (unsigned int) *src);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int opal_dss_print_int8(char **output, char *prefix, int8_t *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_INT8\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_INT8\tValue: %d", prefx, (int) *src);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int opal_dss_print_int16(char **output, char *prefix, int16_t *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_INT16\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_INT16\tValue: %d", prefx, (int) *src);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int opal_dss_print_int32(char **output, char *prefix, int32_t *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_INT32\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_INT32\tValue: %d", prefx, (int) *src);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
int opal_dss_print_uint64(char **output, char *prefix,
|
|
|
|
#ifdef HAVE_INT64_T
|
|
|
|
uint64_t *src,
|
|
|
|
#else
|
|
|
|
void *src,
|
|
|
|
#endif /* HAVE_INT64_T */
|
|
|
|
opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_UINT64\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_INT64_T
|
|
|
|
asprintf(output, "%sData type: OPAL_UINT64\tValue: %lu", prefx, (unsigned long) *src);
|
|
|
|
#else
|
|
|
|
asprintf(output, "%sData type: OPAL_UINT64\tValue: unsupported", prefx);
|
|
|
|
#endif /* HAVE_INT64_T */
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int opal_dss_print_int64(char **output, char *prefix,
|
|
|
|
#ifdef HAVE_INT64_T
|
2014-08-31 12:07:03 +04:00
|
|
|
int64_t *src,
|
2008-02-28 04:57:57 +03:00
|
|
|
#else
|
2014-08-31 12:07:03 +04:00
|
|
|
void *src,
|
2008-02-28 04:57:57 +03:00
|
|
|
#endif /* HAVE_INT64_T */
|
|
|
|
opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_INT64\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_INT64_T
|
|
|
|
asprintf(output, "%sData type: OPAL_INT64\tValue: %ld", prefx, (long) *src);
|
|
|
|
#else
|
|
|
|
asprintf(output, "%sData type: OPAL_INT64\tValue: unsupported", prefx);
|
|
|
|
#endif /* HAVE_INT64_T */
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2012-12-19 04:14:19 +04:00
|
|
|
int opal_dss_print_float(char **output, char *prefix,
|
2014-08-31 12:07:03 +04:00
|
|
|
float *src, opal_data_type_t type)
|
2012-12-19 04:14:19 +04:00
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_FLOAT\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2012-12-19 04:14:19 +04:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_FLOAT\tValue: %f", prefx, *src);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2012-12-19 04:14:19 +04:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2014-07-07 17:51:58 +04:00
|
|
|
int opal_dss_print_double(char **output, char *prefix,
|
|
|
|
double *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_DOUBLE\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2014-07-07 17:51:58 +04:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_DOUBLE\tValue: %f", prefx, *src);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2014-07-07 17:51:58 +04:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2014-02-12 23:37:21 +04:00
|
|
|
int opal_dss_print_time(char **output, char *prefix,
|
|
|
|
time_t *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
char *t;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_TIME\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2014-02-12 23:37:21 +04:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
t = ctime(src);
|
|
|
|
t[strlen(t)-1] = '\0'; // remove trailing newline
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_TIME\tValue: %s", prefx, t);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2014-02-12 23:37:21 +04:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2012-12-19 04:14:19 +04:00
|
|
|
int opal_dss_print_timeval(char **output, char *prefix,
|
2014-08-31 12:07:03 +04:00
|
|
|
struct timeval *src, opal_data_type_t type)
|
2012-12-19 04:14:19 +04:00
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_TIMEVAL\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2012-12-19 04:14:19 +04:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_TIMEVAL\tValue: %ld.%06ld", prefx,
|
|
|
|
(long)src->tv_sec, (long)src->tv_usec);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2012-12-19 04:14:19 +04:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
int opal_dss_print_null(char **output, char *prefix, void *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_NULL\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_NULL", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* PRINT FUNCTIONS FOR GENERIC OPAL TYPES */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OPAL_DATA_TYPE
|
|
|
|
*/
|
|
|
|
int opal_dss_print_data_type(char **output, char *prefix, opal_data_type_t *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_DATA_TYPE\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_DATA_TYPE\tValue: %lu", prefx, (unsigned long) *src);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OPAL_BYTE_OBJECT
|
|
|
|
*/
|
|
|
|
int opal_dss_print_byte_object(char **output, char *prefix, opal_byte_object_t *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_BYTE_OBJECT\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
asprintf(output, "%sData type: OPAL_BYTE_OBJECT\tSize: %lu", prefx, (unsigned long) src->size);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-02-28 04:57:57 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
2008-12-22 23:23:05 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* OPAL_PSTAT
|
|
|
|
*/
|
|
|
|
int opal_dss_print_pstat(char **output, char *prefix, opal_pstats_t *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
2011-04-22 02:55:45 +04:00
|
|
|
|
2008-12-22 23:23:05 +03:00
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_PSTATS\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-12-22 23:23:05 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
2012-12-19 04:14:19 +04:00
|
|
|
asprintf(output, "%sOPAL_PSTATS SAMPLED AT: %ld.%06ld\n%snode: %s rank: %d pid: %d cmd: %s state: %c pri: %d #threads: %d Processor: %d\n"
|
|
|
|
"%s\ttime: %ld.%06ld cpu: %5.2f VMsize: %8.2f PeakVMSize: %8.2f RSS: %8.2f\n",
|
2012-12-18 07:45:09 +04:00
|
|
|
prefx, (long)src->sample_time.tv_sec, (long)src->sample_time.tv_usec,
|
2011-04-22 02:55:45 +04:00
|
|
|
prefx, src->node, src->rank, src->pid, src->cmd, src->state[0], src->priority, src->num_threads, src->processor,
|
2012-12-18 07:45:09 +04:00
|
|
|
prefx, (long)src->time.tv_sec, (long)src->time.tv_usec, src->percent_cpu, src->vsize, src->peak_vsize, src->rss);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
|
|
|
|
2011-04-22 02:55:45 +04:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OPAL_NODE_STAT
|
|
|
|
*/
|
|
|
|
int opal_dss_print_node_stat(char **output, char *prefix, opal_node_stats_t *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
char *prefx;
|
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
|
|
|
else prefx = prefix;
|
2008-12-22 23:23:05 +03:00
|
|
|
|
2011-04-22 02:55:45 +04:00
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_NODE_STATS\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2011-04-22 02:55:45 +04:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
2012-12-19 04:14:19 +04:00
|
|
|
asprintf(output, "%sOPAL_NODE_STATS SAMPLED AT: %ld.%06ld\n%sTotal Mem: %5.2f Free Mem: %5.2f Buffers: %5.2f Cached: %5.2f\n"
|
2014-08-31 12:07:03 +04:00
|
|
|
"%sSwapCached: %5.2f SwapTotal: %5.2f SwapFree: %5.2f Mapped: %5.2f\n"
|
|
|
|
"%s\tla: %5.2f\tla5: %5.2f\tla15: %5.2f\n",
|
2012-12-18 07:45:09 +04:00
|
|
|
prefx, (long)src->sample_time.tv_sec, (long)src->sample_time.tv_usec,
|
2011-05-08 18:45:16 +04:00
|
|
|
prefx, src->total_mem, src->free_mem, src->buffers, src->cached,
|
|
|
|
prefx, src->swap_cached, src->swap_total, src->swap_free, src->mapped,
|
2011-04-22 02:55:45 +04:00
|
|
|
prefx, src->la, src->la5, src->la15);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2008-12-22 23:23:05 +03:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
2012-06-27 18:53:55 +04:00
|
|
|
|
|
|
|
/*
|
2013-01-05 10:31:47 +04:00
|
|
|
* OPAL_VALUE
|
2012-06-27 18:53:55 +04:00
|
|
|
*/
|
|
|
|
int opal_dss_print_value(char **output, char *prefix, opal_value_t *src, opal_data_type_t type)
|
|
|
|
{
|
2014-08-31 12:07:03 +04:00
|
|
|
char *prefx, *t2;
|
|
|
|
int i;
|
2013-01-05 10:31:47 +04:00
|
|
|
|
|
|
|
/* deal with NULL prefix */
|
|
|
|
if (NULL == prefix) asprintf(&prefx, " ");
|
2014-08-31 12:07:03 +04:00
|
|
|
else prefx = prefix;
|
2013-01-05 10:31:47 +04:00
|
|
|
|
|
|
|
/* if src is NULL, just print data type and return */
|
|
|
|
if (NULL == src) {
|
|
|
|
asprintf(output, "%sData type: OPAL_VALUE\tValue: NULL pointer", prefx);
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2013-01-05 10:31:47 +04:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (src->type) {
|
2014-08-31 12:07:03 +04:00
|
|
|
case OPAL_BOOL:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BOOL\tKey: %s\tValue: %s",
|
|
|
|
prefx, src->key, src->data.flag ? "true" : "false");
|
|
|
|
break;
|
2014-06-06 21:28:00 +04:00
|
|
|
case OPAL_BYTE:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BYTE\tKey: %s\tValue: %x",
|
|
|
|
prefx, src->key, src->data.byte);
|
|
|
|
break;
|
2013-01-05 10:31:47 +04:00
|
|
|
case OPAL_STRING:
|
2014-04-30 01:49:23 +04:00
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_STRING\tKey: %s\tValue: %s",
|
|
|
|
prefx, src->key, src->data.string);
|
2013-01-05 10:31:47 +04:00
|
|
|
break;
|
2014-06-06 21:28:00 +04:00
|
|
|
case OPAL_SIZE:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_SIZE\tKey: %s\tValue: %lu",
|
|
|
|
prefx, src->key, (unsigned long)src->data.size);
|
|
|
|
break;
|
|
|
|
case OPAL_PID:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_PID\tKey: %s\tValue: %lu",
|
|
|
|
prefx, src->key, (unsigned long)src->data.pid);
|
|
|
|
break;
|
|
|
|
case OPAL_INT:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT\tKey: %s\tValue: %d",
|
|
|
|
prefx, src->key, src->data.integer);
|
|
|
|
break;
|
|
|
|
case OPAL_INT8:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT8\tKey: %s\tValue: %d",
|
|
|
|
prefx, src->key, (int)src->data.int8);
|
|
|
|
break;
|
2013-01-05 10:31:47 +04:00
|
|
|
case OPAL_INT16:
|
2014-06-06 21:28:00 +04:00
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT16\tKey: %s\tValue: %d",
|
2014-04-30 01:49:23 +04:00
|
|
|
prefx, src->key, (int)src->data.int16);
|
2013-01-05 10:31:47 +04:00
|
|
|
break;
|
|
|
|
case OPAL_INT32:
|
2014-04-30 01:49:23 +04:00
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT32\tKey: %s\tValue: %d",
|
|
|
|
prefx, src->key, src->data.int32);
|
2013-01-05 10:31:47 +04:00
|
|
|
break;
|
2014-06-06 21:28:00 +04:00
|
|
|
case OPAL_INT64:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT64\tKey: %s\tValue: %ld",
|
|
|
|
prefx, src->key, (long)src->data.int64);
|
|
|
|
break;
|
|
|
|
case OPAL_UINT:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT\tKey: %s\tValue: %u",
|
|
|
|
prefx, src->key, src->data.uint);
|
|
|
|
break;
|
|
|
|
case OPAL_UINT8:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT8\tKey: %s\tValue: %u",
|
|
|
|
prefx, src->key, (unsigned int)src->data.uint8);
|
|
|
|
break;
|
|
|
|
case OPAL_UINT16:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT16\tKey: %s\tValue: %u",
|
|
|
|
prefx, src->key, (unsigned int)src->data.uint16);
|
|
|
|
break;
|
|
|
|
case OPAL_UINT32:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT32\tKey: %s\tValue: %u",
|
|
|
|
prefx, src->key, src->data.uint32);
|
|
|
|
break;
|
|
|
|
case OPAL_UINT64:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT64\tKey: %s\tValue: %lu",
|
|
|
|
prefx, src->key, (unsigned long)src->data.uint64);
|
2013-01-05 10:31:47 +04:00
|
|
|
break;
|
|
|
|
case OPAL_FLOAT:
|
2014-04-30 01:49:23 +04:00
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_FLOAT\tKey: %s\tValue: %f",
|
|
|
|
prefx, src->key, src->data.fval);
|
2013-01-05 10:31:47 +04:00
|
|
|
break;
|
2014-07-07 17:51:58 +04:00
|
|
|
case OPAL_DOUBLE:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_DOUBLE\tKey: %s\tValue: %f",
|
|
|
|
prefx, src->key, src->data.dval);
|
|
|
|
break;
|
2014-06-06 21:28:00 +04:00
|
|
|
case OPAL_BYTE_OBJECT:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BYTE_OBJECT\tKey: %s\tData: %s\tSize: %lu",
|
2014-08-31 12:07:03 +04:00
|
|
|
prefx, src->key, (NULL == src->data.bo.bytes) ? "NULL" : "NON-NULL", (unsigned long)src->data.bo.size);
|
2014-06-06 21:28:00 +04:00
|
|
|
break;
|
2013-01-05 10:31:47 +04:00
|
|
|
case OPAL_TIMEVAL:
|
2014-04-30 01:49:23 +04:00
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_TIMEVAL\tKey: %s\tValue: %ld.%06ld", prefx,
|
|
|
|
src->key, (long)src->data.tv.tv_sec, (long)src->data.tv.tv_usec);
|
2013-01-05 10:31:47 +04:00
|
|
|
break;
|
2014-06-01 20:14:10 +04:00
|
|
|
case OPAL_PTR:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_PTR\tKey: %s", prefx, src->key);
|
|
|
|
break;
|
2014-08-31 12:07:03 +04:00
|
|
|
case OPAL_FLOAT_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_FLOAT_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.fval_array.size);
|
|
|
|
for (i = 0; i < src->data.fval_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%f", *output, prefx, src->data.fval_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_DOUBLE_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_DOUBLE_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.dval_array.size);
|
|
|
|
for (i = 0; i < src->data.dval_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%f", *output, prefx, src->data.dval_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_STRING_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_STRING_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.string_array.size);
|
|
|
|
for (i = 0; i < src->data.string_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%s", *output, prefx, src->data.string_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_BOOL_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BOOL_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.flag_array.size);
|
|
|
|
for (i = 0; i < src->data.flag_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%s", *output, prefx, src->data.flag_array.data[i] ? "true" : "false");
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_SIZE_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_SIZE_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.size_array.size);
|
|
|
|
for (i = 0; i < src->data.size_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%lu", *output, prefx, (unsigned long)src->data.size_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_BYTE_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BYTE_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.byte_array.size);
|
|
|
|
for (i = 0; i < src->data.byte_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%x", *output, prefx, (uint8_t)src->data.byte_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_INT_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.integer_array.size);
|
|
|
|
for (i = 0; i < src->data.integer_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%d", *output, prefx, src->data.integer_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_INT8_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT8_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.int8_array.size);
|
|
|
|
for (i = 0; i < src->data.int8_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%d", *output, prefx, (int)src->data.int8_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_INT16_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT16_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.int16_array.size);
|
|
|
|
for (i = 0; i < src->data.int16_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%d", *output, prefx, (int)src->data.int16_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_INT32_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT32_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.int32_array.size);
|
|
|
|
for (i = 0; i < src->data.int32_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%d", *output, prefx, src->data.int32_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_INT64_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT64_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.int64_array.size);
|
|
|
|
for (i = 0; i < src->data.int64_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%ld", *output, prefx, (long)src->data.int64_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_UINT_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.uint_array.size);
|
|
|
|
for (i = 0; i < src->data.uint_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%u", *output, prefx, src->data.uint_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_UINT8_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT8_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.uint8_array.size);
|
|
|
|
for (i = 0; i < src->data.uint8_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%u", *output, prefx, (unsigned int)src->data.uint8_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_UINT16_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT16_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.uint16_array.size);
|
|
|
|
for (i = 0; i < src->data.uint16_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%u", *output, prefx, (unsigned int)src->data.uint16_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_UINT32_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT32_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.uint32_array.size);
|
|
|
|
for (i = 0; i < src->data.uint32_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%u", *output, prefx, (unsigned int)src->data.uint32_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_UINT64_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT64_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.uint64_array.size);
|
|
|
|
for (i = 0; i < src->data.uint64_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%lu", *output, prefx, (unsigned long)src->data.uint64_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_BYTE_OBJECT_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BYTE_OBJECT_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.bo_array.size);
|
|
|
|
for (i = 0; i < src->data.bo_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\tData: %s\tSize: %lu ", *output, prefx,
|
|
|
|
(NULL == src->data.bo_array.data[i].bytes) ? "NULL" : "NON-NULL",
|
|
|
|
(unsigned long)src->data.bo_array.data[i].size);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_PID_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_PID_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.pid_array.size);
|
|
|
|
for (i = 0; i < src->data.pid_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%u", *output, prefx, (unsigned int)src->data.pid_array.data[i]);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPAL_TIMEVAL_ARRAY:
|
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_TIMEVAL_ARRAY\tKey: %s \tSIZE: %d \tDATA: ",
|
|
|
|
prefx, src->key, src->data.tv_array.size);
|
|
|
|
for (i = 0; i < src->data.tv_array.size; i++) {
|
|
|
|
asprintf(&t2, "%s\n%s\t%ld.%06ld", *output, prefx,
|
|
|
|
(long)src->data.tv_array.data[i].tv_sec,
|
|
|
|
(long)src->data.tv_array.data[i].tv_usec);
|
|
|
|
free(*output);
|
|
|
|
*output = t2;
|
|
|
|
}
|
|
|
|
break;
|
2013-01-05 10:31:47 +04:00
|
|
|
default:
|
2014-04-30 01:49:23 +04:00
|
|
|
asprintf(output, "%sOPAL_VALUE: Data type: UNKNOWN\tKey: %s\tValue: UNPRINTABLE",
|
|
|
|
prefx, src->key);
|
2013-01-05 10:31:47 +04:00
|
|
|
break;
|
|
|
|
}
|
2014-08-31 12:07:03 +04:00
|
|
|
if (prefx != prefix) {
|
|
|
|
free(prefx);
|
|
|
|
}
|
2012-06-27 18:53:55 +04:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
2012-11-10 18:02:23 +04:00
|
|
|
|
|
|
|
int opal_dss_print_buffer_contents(char **output, char *prefix,
|
|
|
|
opal_buffer_t *src, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|