[openib-general] Re: [PATCH] uDAPL common code to build with counters

James Lentini jlentini at netapp.com
Fri Aug 5 09:17:15 PDT 2005



On Wed, 3 Aug 2005, Arlin Davis wrote:

> James,
>
> I tried to build uDAPL with counters to debug my wait/wakeup problem but ran into some build
> problems. Can you review the following patch to enable counters?
>
> Not sure what happened to dapl_counters.h?

I'm not either. I'll look into it.

A couple of questions:

>
> Thanks,
>
> -arlin
>
>
> Signed-off by: Arlin Davis <ardavis at ichips.intel.com>
>
>
> Index: dapl/include/dapl_debug.h
> ===================================================================
> --- dapl/include/dapl_debug.h	(revision 2967)
> +++ dapl/include/dapl_debug.h	(working copy)
> @@ -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
> #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_LAST_COUNTER		21 /* Always the last counter */

What do you think of changing the name of DCNT_LAST_COUNTER to 
DCNT_NUM_COUNTERS?

> +#define DCNT_ALL_COUNTERS               DCNT_LAST_COUNTER
>
> #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)
> Index: dapl/common/dapl_debug.c
> ===================================================================
> --- dapl/common/dapl_debug.c	(revision 2967)
> +++ dapl/common/dapl_debug.c	(working copy)
> @@ -58,7 +58,7 @@ void dapl_internal_dbg_log ( DAPL_DBG_TY
> }
>
> #if defined(DAPL_COUNTERS)
> -long dapl_dbg_counters[DAPL_CNTR_MAX];
> +int dapl_dbg_counters[DCNT_LAST_COUNTER+1] = { 0 };

How about making the array size equal to DCNT_LAST_COUNTER (aka 
DCNT_NUM_COUNTERS) and ...

>
> /*
>  * The order of this list must match exactly with the #defines
> @@ -89,6 +89,22 @@ char  *dapl_dbg_counter_names[] = {
> 	0

... getting rid of this extra placeholder.

> };
>
> +void dapl_dump_cntr( int cntr )
> +{
> +    int i;
> +
> +    for ( i=0;i<DCNT_LAST_COUNTER;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



More information about the general mailing list