1
1

btl/tcp: add missing mca_btl_tcp_dump() subroutine

Этот коммит содержится в:
Gilles Gouaillardet 2016-03-30 15:35:06 +09:00
родитель a89f113507
Коммит e852d85cc1
4 изменённых файлов: 52 добавлений и 27 удалений

Просмотреть файл

@ -12,6 +12,8 @@
* All rights reserved.
* Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*
* $COPYRIGHT$
*
@ -27,6 +29,7 @@
#include "opal/datatype/opal_convertor.h"
#include "opal/mca/mpool/base/base.h"
#include "opal/mca/mpool/mpool.h"
#include "opal/mca/btl/base/btl_base_error.h"
#include "btl_tcp.h"
#include "btl_tcp_frag.h"
@ -485,3 +488,34 @@ int mca_btl_tcp_finalize(struct mca_btl_base_module_t* btl)
free(tcp_btl);
return OPAL_SUCCESS;
}
void mca_btl_tcp_dump(struct mca_btl_base_module_t* base_btl,
struct mca_btl_base_endpoint_t* endpoint,
int verbose)
{
mca_btl_tcp_module_t* btl = (mca_btl_tcp_module_t*)base_btl;
mca_btl_base_err("%s TCP %p kernel_id %d\n"
#if MCA_BTL_TCP_STATISTICS
" | statistics: sent %lu recv %lu\n"
#endif /* MCA_BTL_TCP_STATISTICS */
" | latency %u bandwidth %u\n",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), (void*)btl, btl->tcp_ifkindex,
#if MCA_BTL_TCP_STATISTICS
btl->tcp_bytes_sent, btl->btl_bytes_recv,
#endif /* MCA_BTL_TCP_STATISTICS */
btl->super.btl_latency, btl->super.btl_bandwidth);
#if OPAL_ENABLE_DEBUG && WANT_PEER_DUMP
if( NULL != endpoint ) {
MCA_BTL_TCP_ENDPOINT_DUMP(10, endpoint, false, "TCP");
} else if( verbose ) {
opal_list_item_t *item;
for(item = opal_list_get_first(&btl->tcp_endpoints);
item != opal_list_get_end(&btl->tcp_endpoints);
item = opal_list_get_next(item)) {
MCA_BTL_TCP_ENDPOINT_DUMP(10, (mca_btl_base_endpoint_t*)item, false, "TCP");
}
}
#endif /* OPAL_ENABLE_DEBUG && WANT_PEER_DUMP */
}

Просмотреть файл

@ -1314,15 +1314,3 @@ static void mca_btl_tcp_component_recv_handler(int sd, short flags, void* user)
/* are there any existing peer instances will to accept this connection */
(void)mca_btl_tcp_proc_accept(btl_proc, (struct sockaddr*)&addr, sd);
}
/**
* Debugging infrastructure, absolutely not thread safe. Call with care.
*/
static void mca_btl_tcp_component_dump(void)
{
uint32_t i;
for( i = 0; i < mca_btl_tcp_component.tcp_num_btls; i++ ) {
mca_btl_tcp_dump( (mca_btl_base_module_t*)mca_btl_tcp_component.tcp_btls[i], NULL, 1 );
}
}

Просмотреть файл

@ -116,16 +116,11 @@ static void mca_btl_tcp_endpoint_connected(mca_btl_base_endpoint_t*);
static void mca_btl_tcp_endpoint_recv_handler(int sd, short flags, void* user);
static void mca_btl_tcp_endpoint_send_handler(int sd, short flags, void* user);
/*
* Diagnostics: change this to "1" to enable the function
* mca_btl_tcp_endpoint_dump(), below
*/
#define WANT_PEER_DUMP 0
/*
* diagnostics
*/
#if WANT_PEER_DUMP
#if OPAL_ENABLE_DEBUG && WANT_PEER_DUMP
#define DEBUG_LENGTH 1024
/**
@ -136,7 +131,7 @@ static void mca_btl_tcp_endpoint_send_handler(int sd, short flags, void* user);
* might access freed memory. Thus, the caller should lock the endpoint prior
* to the call.
*/
static void
void
mca_btl_tcp_endpoint_dump(int level,
const char* fname,
int lineno,
@ -289,13 +284,7 @@ out:
(NULL != btl_endpoint->endpoint_proc ? OPAL_NAME_PRINT(btl_endpoint->endpoint_proc->proc_opal->proc_name) : "unknown remote"),
outmsg);
}
#endif /* WANT_PEER_DUMP */
#if OPAL_ENABLE_DEBUG && WANT_PEER_DUMP
#define MCA_BTL_TCP_ENDPOINT_DUMP(LEVEL, ENDPOINT, INFO, MSG) mca_btl_tcp_endpoint_dump((LEVEL), __FILE__, __LINE__, __func__, (ENDPOINT), (INFO), (MSG))
#else
#define MCA_BTL_TCP_ENDPOINT_DUMP(LEVEL, ENDPOINT, INFO, MSG)
#endif /* OPAL_ENABLE_DEBUG && WANT_PEER_DUMP */
#endif /* OPAL_ENABLE_DEBUG && WANT_PEER_DUMP */
/*
* Initialize events to be used by the endpoint instance for TCP select/poll callbacks.

Просмотреть файл

@ -80,7 +80,21 @@ void mca_btl_tcp_endpoint_close(mca_btl_base_endpoint_t*);
int mca_btl_tcp_endpoint_send(mca_btl_base_endpoint_t*, struct mca_btl_tcp_frag_t*);
void mca_btl_tcp_endpoint_accept(mca_btl_base_endpoint_t*, struct sockaddr*, int);
void mca_btl_tcp_endpoint_shutdown(mca_btl_base_endpoint_t*);
void mca_btl_tcp_endpoint_dump(mca_btl_base_endpoint_t* btl_endpoint, const char* msg);
/*
* Diagnostics: change this to "1" to enable the function
* mca_btl_tcp_endpoint_dump(), below
*/
#define WANT_PEER_DUMP 0
#if OPAL_ENABLE_DEBUG && WANT_PEER_DUMP
#define MCA_BTL_TCP_ENDPOINT_DUMP(LEVEL, ENDPOINT, INFO, MSG) mca_btl_tcp_endpoint_dump((LEVEL), __FILE__, __LINE__, __func__, (ENDPOINT), (INFO), (MSG))
void mca_btl_tcp_endpoint_dump(int level, const char* fname, int lineno, const char* funcname,
mca_btl_base_endpoint_t* btl_endpoint, bool full_info, const char* msg);
#else
#define MCA_BTL_TCP_ENDPOINT_DUMP(LEVEL, ENDPOINT, INFO, MSG)
#endif /* OPAL_ENABLE_DEBUG && WANT_PEER_DUMP */
END_C_DECLS
#endif