[WSD] Add perfmon counter object implementation. WSD installation now
[mirror/winof/.git] / ulp / wsd / user / ibsp_iblow.c
index 87c318e..191b9a2 100644 (file)
 \r
 #include "ibspdll.h"\r
 \r
+#ifdef PERFMON_ENABLED\r
+#include "ibsp_perfmon.h"\r
+#endif\r
+\r
 \r
 typedef struct _io_comp_info\r
 {\r
@@ -89,10 +93,10 @@ complete_wq(
                 * NOTE: Without a valid length, the switch doesn't seem to call \r
                 * GetOverlappedResult() even if we call lpWPUCompleteOverlappedRequest()\r
                 */\r
-               if( wc->wc_type == IB_WC_RECV )\r
+               switch ( wc->wc_type ) \r
                {\r
+               case IB_WC_RECV:\r
                        lpOverlapped->InternalHigh = wc->length;\r
-\r
 #ifdef IBSP_LOGGING\r
                        cl_spinlock_acquire( &socket_info->recv_lock );\r
                        DataLogger_WriteData(&socket_info->RecvDataLogger,\r
@@ -100,8 +104,37 @@ complete_wq(
                                wc->length);\r
                        cl_spinlock_release( &socket_info->recv_lock );\r
 #endif\r
+#ifdef PERFMON_ENABLED\r
+                       InterlockedIncrement64( &g_pm_stat.pdata[COMP_RECV] );\r
+                       InterlockedExchangeAdd64( &g_pm_stat.pdata[BYTES_RECV],\r
+                               lpOverlapped->InternalHigh );\r
+#endif\r
+                       break;\r
+#ifdef PERFMON_ENABLED\r
+\r
+               case IB_WC_RDMA_READ:\r
+                       lpOverlapped->InternalHigh = wc->length;\r
+                       InterlockedIncrement64( &g_pm_stat.pdata[COMP_RECV] );\r
+                       InterlockedExchangeAdd64( &g_pm_stat.pdata[BYTES_READ],\r
+                               lpOverlapped->InternalHigh );\r
+                       break;\r
+\r
+               case IB_WC_SEND:\r
+                       InterlockedIncrement64( &g_pm_stat.pdata[COMP_SEND] );\r
+                       InterlockedExchangeAdd64( &g_pm_stat.pdata[BYTES_SEND],\r
+                               lpOverlapped->InternalHigh );\r
+                       break;\r
+\r
+               case IB_WC_RDMA_WRITE:\r
+                       InterlockedIncrement64( &g_pm_stat.pdata[COMP_SEND] );\r
+                       InterlockedExchangeAdd64( &g_pm_stat.pdata[BYTES_WRITE],\r
+                               lpOverlapped->InternalHigh );\r
+               default:\r
+                       break;\r
                }\r
 \r
+#endif /* PERFMON_ENABLED */\r
+\r
                lpOverlapped->OffsetHigh = 0;\r
                break;\r
 \r
@@ -173,6 +206,10 @@ complete_wq(
                break;\r
        }\r
 \r
+#ifdef PERFMON_ENABLED\r
+       InterlockedIncrement64( &g_pm_stat.pdata[COMP_TOTAL] );\r
+#endif\r
+\r
 #ifdef _DEBUG_\r
        if( wc->wc_type == IB_WC_RECV )\r
        {\r
@@ -285,9 +322,13 @@ complete_wq(
        }\r
 \r
        if( wc->wc_type == IB_WC_RECV )\r
+       {\r
                cl_atomic_dec( &socket_info->recv_cnt );\r
+       }\r
        else\r
+       {\r
                cl_atomic_dec( &socket_info->send_cnt );\r
+       }\r
 \r
        IBSP_EXIT( IBSP_DBG_IO );\r
 }\r
@@ -432,7 +473,6 @@ ib_cq_thread(
 \r
        IBSP_ENTER( IBSP_DBG_HW );\r
 \r
-\r
        fzprint(("%s():%d:0x%x:0x%x: cq_tinfo=0x%p\n", __FUNCTION__,\r
                         __LINE__, GetCurrentProcessId(), GetCurrentThreadId(), cq_tinfo));\r
 \r
@@ -454,6 +494,9 @@ ib_cq_thread(
                        fzprint(("%s():%d:0x%x:0x%x: Calling ib_cq_comp().\n", __FUNCTION__,\r
                                         __LINE__, GetCurrentProcessId(), GetCurrentThreadId()));\r
 \r
+#ifdef PERFMON_ENABLED\r
+                       InterlockedIncrement64( &g_pm_stat.pdata[INTR_TOTAL] );\r
+#endif\r
                        i = g_max_poll;\r
                        do\r
                        {\r