From: James Lentini Date: Tue, 16 Aug 2005 14:07:42 +0000 (+0000) Subject: r3106: Implemented debug counters X-Git-Tag: libdapl-1.2.1~92 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=49087ba27bd93769bb64d7ac5c454de1b94005bc;p=~ardavis%2Fdapl.git r3106: Implemented debug counters Signed-off by: Arlin Davis Signed-off by: James Lentini --- diff --git a/dapl/common/dapl_debug.c b/dapl/common/dapl_debug.c index 57f79e3..db1f583 100644 --- a/dapl/common/dapl_debug.c +++ b/dapl/common/dapl_debug.c @@ -58,7 +58,7 @@ void dapl_internal_dbg_log ( DAPL_DBG_TYPE type, const char *fmt, ...) } #if defined(DAPL_COUNTERS) -long dapl_dbg_counters[DAPL_CNTR_MAX]; +int dapl_dbg_counters[DCNT_NUM_COUNTERS] = { 0 }; /* * The order of this list must match exactly with the #defines @@ -86,9 +86,24 @@ char *dapl_dbg_counter_names[] = { "dapl_evd_not_found", "dapls_timer_set", "dapls_timer_cancel", - 0 }; +void dapl_dump_cntr( int cntr ) +{ + int i; + + for ( i = 0; i < DCNT_NUM_COUNTERS; i++ ) + { + if (( cntr == i ) || ( cntr == DCNT_ALL_COUNTERS )) + { + dapl_dbg_log ( DAPL_DBG_TYPE_CNTR, + "DAPL Counter: %s = %lu \n", + dapl_dbg_counter_names[i], + dapl_dbg_counters[i] ); + } + } +} + #endif /* DAPL_COUNTERS */ #endif diff --git a/dapl/include/dapl_debug.h b/dapl/include/dapl_debug.h index 23220ef..3ce435f 100644 --- a/dapl/include/dapl_debug.h +++ b/dapl/include/dapl_debug.h @@ -64,7 +64,9 @@ typedef enum DAPL_DBG_TYPE_API = 0x0100, DAPL_DBG_TYPE_RTN = 0x0200, DAPL_DBG_TYPE_EXCEPTION = 0x0400, - DAPL_DBG_TYPE_SRQ = 0x0800 + DAPL_DBG_TYPE_SRQ = 0x0800, + DAPL_DBG_TYPE_CNTR = 0x1000 + } DAPL_DBG_TYPE; typedef enum @@ -110,12 +112,21 @@ extern void dapl_internal_dbg_log ( DAPL_DBG_TYPE type, const char *fmt, ...); #define DCNT_EVD_DEQUEUE_NOT_FOUND 18 #define DCNT_TIMER_SET 19 #define DCNT_TIMER_CANCEL 20 -#define DCNT_LAST_COUNTER 22 /* Always the last counter */ +#define DCNT_NUM_COUNTERS 21 +#define DCNT_ALL_COUNTERS DCNT_NUM_COUNTERS #if defined(DAPL_COUNTERS) -#include "dapl_counters.h" -#define DAPL_CNTR(cntr) dapl_os_atomic_inc (&dapl_dbg_counters[cntr]); +extern void dapl_dump_cntr( int cntr ); +extern int dapl_dbg_counters[]; + +#define DAPL_CNTR(cntr) dapl_os_atomic_inc (&dapl_dbg_counters[cntr]); +#define DAPL_DUMP_CNTR(cntr) dapl_dump_cntr( cntr ); +#define DAPL_COUNTERS_INIT() +#define DAPL_COUNTERS_NEW(__tag, __id) +#define DAPL_COUNTERS_RESET(__id, __incr) +#define DAPL_COUNTERS_INCR(__id, __incr) + #else #define DAPL_CNTR(cntr)