Skip to content

Commit e852d85

Browse files
committed
btl/tcp: add missing mca_btl_tcp_dump() subroutine
1 parent a89f113 commit e852d85

File tree

4 files changed

+52
-27
lines changed

4 files changed

+52
-27
lines changed

opal/mca/btl/tcp/btl_tcp.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
* All rights reserved.
1313
* Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights
1414
* reserved.
15+
* Copyright (c) 2016 Research Organization for Information Science
16+
* and Technology (RIST). All rights reserved.
1517
*
1618
* $COPYRIGHT$
1719
*
@@ -27,6 +29,7 @@
2729
#include "opal/datatype/opal_convertor.h"
2830
#include "opal/mca/mpool/base/base.h"
2931
#include "opal/mca/mpool/mpool.h"
32+
#include "opal/mca/btl/base/btl_base_error.h"
3033

3134
#include "btl_tcp.h"
3235
#include "btl_tcp_frag.h"
@@ -485,3 +488,34 @@ int mca_btl_tcp_finalize(struct mca_btl_base_module_t* btl)
485488
free(tcp_btl);
486489
return OPAL_SUCCESS;
487490
}
491+
492+
void mca_btl_tcp_dump(struct mca_btl_base_module_t* base_btl,
493+
struct mca_btl_base_endpoint_t* endpoint,
494+
int verbose)
495+
{
496+
mca_btl_tcp_module_t* btl = (mca_btl_tcp_module_t*)base_btl;
497+
mca_btl_base_err("%s TCP %p kernel_id %d\n"
498+
#if MCA_BTL_TCP_STATISTICS
499+
" | statistics: sent %lu recv %lu\n"
500+
#endif /* MCA_BTL_TCP_STATISTICS */
501+
" | latency %u bandwidth %u\n",
502+
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), (void*)btl, btl->tcp_ifkindex,
503+
#if MCA_BTL_TCP_STATISTICS
504+
btl->tcp_bytes_sent, btl->btl_bytes_recv,
505+
#endif /* MCA_BTL_TCP_STATISTICS */
506+
btl->super.btl_latency, btl->super.btl_bandwidth);
507+
#if OPAL_ENABLE_DEBUG && WANT_PEER_DUMP
508+
if( NULL != endpoint ) {
509+
MCA_BTL_TCP_ENDPOINT_DUMP(10, endpoint, false, "TCP");
510+
511+
} else if( verbose ) {
512+
opal_list_item_t *item;
513+
514+
for(item = opal_list_get_first(&btl->tcp_endpoints);
515+
item != opal_list_get_end(&btl->tcp_endpoints);
516+
item = opal_list_get_next(item)) {
517+
MCA_BTL_TCP_ENDPOINT_DUMP(10, (mca_btl_base_endpoint_t*)item, false, "TCP");
518+
}
519+
}
520+
#endif /* OPAL_ENABLE_DEBUG && WANT_PEER_DUMP */
521+
}

opal/mca/btl/tcp/btl_tcp_component.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,15 +1314,3 @@ static void mca_btl_tcp_component_recv_handler(int sd, short flags, void* user)
13141314
/* are there any existing peer instances will to accept this connection */
13151315
(void)mca_btl_tcp_proc_accept(btl_proc, (struct sockaddr*)&addr, sd);
13161316
}
1317-
1318-
/**
1319-
* Debugging infrastructure, absolutely not thread safe. Call with care.
1320-
*/
1321-
static void mca_btl_tcp_component_dump(void)
1322-
{
1323-
uint32_t i;
1324-
1325-
for( i = 0; i < mca_btl_tcp_component.tcp_num_btls; i++ ) {
1326-
mca_btl_tcp_dump( (mca_btl_base_module_t*)mca_btl_tcp_component.tcp_btls[i], NULL, 1 );
1327-
}
1328-
}

opal/mca/btl/tcp/btl_tcp_endpoint.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,11 @@ static void mca_btl_tcp_endpoint_connected(mca_btl_base_endpoint_t*);
116116
static void mca_btl_tcp_endpoint_recv_handler(int sd, short flags, void* user);
117117
static void mca_btl_tcp_endpoint_send_handler(int sd, short flags, void* user);
118118

119-
/*
120-
* Diagnostics: change this to "1" to enable the function
121-
* mca_btl_tcp_endpoint_dump(), below
122-
*/
123-
#define WANT_PEER_DUMP 0
124119
/*
125120
* diagnostics
126121
*/
127122

128-
#if WANT_PEER_DUMP
123+
#if OPAL_ENABLE_DEBUG && WANT_PEER_DUMP
129124

130125
#define DEBUG_LENGTH 1024
131126
/**
@@ -136,7 +131,7 @@ static void mca_btl_tcp_endpoint_send_handler(int sd, short flags, void* user);
136131
* might access freed memory. Thus, the caller should lock the endpoint prior
137132
* to the call.
138133
*/
139-
static void
134+
void
140135
mca_btl_tcp_endpoint_dump(int level,
141136
const char* fname,
142137
int lineno,
@@ -289,13 +284,7 @@ mca_btl_tcp_endpoint_dump(int level,
289284
(NULL != btl_endpoint->endpoint_proc ? OPAL_NAME_PRINT(btl_endpoint->endpoint_proc->proc_opal->proc_name) : "unknown remote"),
290285
outmsg);
291286
}
292-
#endif /* WANT_PEER_DUMP */
293-
294-
#if OPAL_ENABLE_DEBUG && WANT_PEER_DUMP
295-
#define MCA_BTL_TCP_ENDPOINT_DUMP(LEVEL, ENDPOINT, INFO, MSG) mca_btl_tcp_endpoint_dump((LEVEL), __FILE__, __LINE__, __func__, (ENDPOINT), (INFO), (MSG))
296-
#else
297-
#define MCA_BTL_TCP_ENDPOINT_DUMP(LEVEL, ENDPOINT, INFO, MSG)
298-
#endif /* OPAL_ENABLE_DEBUG && WANT_PEER_DUMP */
287+
#endif /* OPAL_ENABLE_DEBUG && WANT_PEER_DUMP */
299288

300289
/*
301290
* Initialize events to be used by the endpoint instance for TCP select/poll callbacks.

opal/mca/btl/tcp/btl_tcp_endpoint.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,21 @@ void mca_btl_tcp_endpoint_close(mca_btl_base_endpoint_t*);
8080
int mca_btl_tcp_endpoint_send(mca_btl_base_endpoint_t*, struct mca_btl_tcp_frag_t*);
8181
void mca_btl_tcp_endpoint_accept(mca_btl_base_endpoint_t*, struct sockaddr*, int);
8282
void mca_btl_tcp_endpoint_shutdown(mca_btl_base_endpoint_t*);
83-
void mca_btl_tcp_endpoint_dump(mca_btl_base_endpoint_t* btl_endpoint, const char* msg);
83+
84+
/*
85+
* Diagnostics: change this to "1" to enable the function
86+
* mca_btl_tcp_endpoint_dump(), below
87+
*/
88+
#define WANT_PEER_DUMP 0
89+
90+
#if OPAL_ENABLE_DEBUG && WANT_PEER_DUMP
91+
#define MCA_BTL_TCP_ENDPOINT_DUMP(LEVEL, ENDPOINT, INFO, MSG) mca_btl_tcp_endpoint_dump((LEVEL), __FILE__, __LINE__, __func__, (ENDPOINT), (INFO), (MSG))
92+
void mca_btl_tcp_endpoint_dump(int level, const char* fname, int lineno, const char* funcname,
93+
mca_btl_base_endpoint_t* btl_endpoint, bool full_info, const char* msg);
94+
#else
95+
#define MCA_BTL_TCP_ENDPOINT_DUMP(LEVEL, ENDPOINT, INFO, MSG)
96+
#endif /* OPAL_ENABLE_DEBUG && WANT_PEER_DUMP */
8497

8598
END_C_DECLS
99+
86100
#endif

0 commit comments

Comments
 (0)