source: svn/trunk/newcon3bcm2_21bu/magnum/basemodules/int/bint_dump.c @ 2

Last change on this file since 2 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 5.8 KB
Line 
1/***************************************************************************
2 *         Copyright (c) 2003-2006, Broadcom Corporation
3 *         All Rights Reserved
4 *         Confidential Property of Broadcom Corporation
5 *
6 *      THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *      AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *      EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: bint_dump.c $
11 * $brcm_Revision: Hydra_Software_Devel/6 $
12 * $brcm_Date: 5/25/06 5:15p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/basemodules/int/bint_dump.c $
19 *
20 * Hydra_Software_Devel/6   5/25/06 5:15p albertl
21 * PR21392:  BINT_Stats functions now split off into bint_stats.h to solve
22 * BTMR circular dependency.
23 *
24 * Hydra_Software_Devel/5   5/9/05 2:23p albertl
25 * PR10596:  Removed space between label and data.
26 *
27 * Hydra_Software_Devel/4   4/28/05 5:28p albertl
28 * PR10596:  Added BINT_Stats_DumpData for dumping stats in comma
29 * delimited format.
30 *
31 * Hydra_Software_Devel/3   4/14/05 6:05p albertl
32 * PR10596:  Changed address output to hex.
33 *
34 * Hydra_Software_Devel/2   4/13/05 5:17p albertl
35 * PR10596:  Streamlined dump display.
36 *
37 * Hydra_Software_Devel/1   4/11/05 5:25p albertl
38 * PR10596:  Initial Revision.
39 *
40 *
41 ***************************************************************************/
42#include "bstd.h"
43#include "bint.h"
44#include "bint_stats.h"
45#include "bkni.h"
46#include "bchp.h"
47
48
49BDBG_MODULE(intstats);
50
51BERR_Code BINT_Stats_Dump
52        ( BINT_Handle          intHandle )
53{
54        BINT_CallbackHandle cbHandle;
55        BINT_Stats_CallbackStats *pCbStats = NULL;
56        BINT_Id intId = 0;
57        int iCallbackNum = 1;
58        int i = 0;
59        bool bCallbackEnabled = false;
60        bool bLastDumpStats = false;
61        bool bFirstLine = true;
62
63        if (intHandle == NULL)
64        {
65                return BERR_TRACE(BERR_INVALID_PARAMETER);
66        }
67
68        cbHandle = BINT_GetCallbackFirst( intHandle );
69
70        while (cbHandle)
71        {
72                int iDumpBins = 0;
73                bool bDumpStats = false;
74
75                BINT_Stats_Get(cbHandle, &pCbStats);
76
77                BINT_GetInterruptId(cbHandle, &intId);
78                BINT_GetCallbackStatus(cbHandle, &bCallbackEnabled);
79
80                if (bCallbackEnabled ||
81                        !pCbStats->bDefaultBins ||
82                        (pCbStats->ulCbHitCount != 0))
83                {
84                        bDumpStats = true;
85                }
86
87                if (bDumpStats || bLastDumpStats || bFirstLine)
88                {
89                        BKNI_Printf("-------------------------------------------------------------------------------\n");
90                        bFirstLine = false;
91                }
92
93                BKNI_Printf(" Callback %-2d %s -- IntID: 0x%08x  L2Reg: 0x%08x  L2Shift: %u\n",
94                        iCallbackNum++,
95                        (bCallbackEnabled) ? "(on) ": "(off)",
96                        intId,
97                        BCHP_INT_ID_GET_REG(intId),
98                        BCHP_INT_ID_GET_SHIFT(intId));
99
100                if (bDumpStats)
101                {
102                        BKNI_Printf("                      Min: %-6u Max: %-6u  Avg: %-6u  CbHitCount : %-6u\n", 
103                                (pCbStats->ulTimeMin == UINT32_MAX) ? 0: pCbStats->ulTimeMin,
104                                pCbStats->ulTimeMax,
105                                pCbStats->ulTimeAvg,
106                                pCbStats->ulCbHitCount);
107                }
108
109                /* print bins */
110                for (i = 0; i < (int)pCbStats->ulActiveBins; i++)
111                {
112                        if (!pCbStats->bDefaultBins ||
113                                (pCbStats->aBinInfo[i].ulBinHitCount != 0))
114                        {
115                                iDumpBins++;
116
117                                BKNI_Printf("  %sBin %-2d -- Range Min: %-6u  Range Max: %-6u  BinHitCount: %-6u\n",
118                                        pCbStats->bDefaultBins ? "(Default) ": "(User)    ",
119                                        i + 1,
120                                        pCbStats->aBinInfo[i].ulBinRangeMin,
121                                        pCbStats->aBinInfo[i].ulBinRangeMax,
122                                        pCbStats->aBinInfo[i].ulBinHitCount);
123                        }
124                }
125
126                bLastDumpStats = bDumpStats;
127                cbHandle = BINT_GetCallbackNext( cbHandle );
128        }
129
130        BKNI_Printf("\n");
131
132        return BERR_SUCCESS;
133}
134
135void BINT_P_Stats_DumpLabel
136        ( BINT_Stats_CallbackStats *pCbStats )
137{
138        int i = 0;
139
140        BKNI_Printf("\n");
141        BKNI_Printf("Callback #,Status,IntId,L2Reg,L2Shift,");
142        BKNI_Printf("Min,Max,Avg,CbHitCount,");
143
144        for (i = 0; i < (int)pCbStats->ulActiveBins; i++)
145        {
146                BKNI_Printf("%d-%d us,",
147                        pCbStats->aBinInfo[i].ulBinRangeMin,
148                        pCbStats->aBinInfo[i].ulBinRangeMax);
149        }
150
151        BKNI_Printf("\n");
152}
153
154void BINT_P_Stats_DumpCbData
155        ( BINT_CallbackHandle cbHandle, int iCallbackNum )
156{
157        BINT_Stats_CallbackStats *pCbStats = NULL;
158        BINT_Id intId = 0;
159        bool bCallbackEnabled = false;
160        int i = 0;
161
162        BINT_Stats_Get(cbHandle, &pCbStats);
163        BINT_GetInterruptId(cbHandle, &intId);
164        BINT_GetCallbackStatus(cbHandle, &bCallbackEnabled);
165
166        BKNI_Printf("Callback %d,%s,0x%08x,0x%08x,%u,",
167                iCallbackNum,
168                (bCallbackEnabled) ? "(on) ": "(off)",
169                intId,
170                BCHP_INT_ID_GET_REG(intId),
171                BCHP_INT_ID_GET_SHIFT(intId));
172
173        BKNI_Printf("%u,%u,%u,%u,", 
174                (pCbStats->ulTimeMin == UINT32_MAX) ? 0: pCbStats->ulTimeMin,
175                pCbStats->ulTimeMax,
176                pCbStats->ulTimeAvg,
177                pCbStats->ulCbHitCount);
178
179        /* print bins */
180        for (i = 0; i < (int)pCbStats->ulActiveBins; i++)
181        {
182                if (pCbStats->aBinInfo[i].ulBinHitCount != 0)
183                {
184                        BKNI_Printf("%u",  pCbStats->aBinInfo[i].ulBinHitCount);
185                }
186
187                BKNI_Printf(",");
188        }
189
190        BKNI_Printf("\n");
191}
192
193BERR_Code BINT_Stats_DumpData
194        ( BINT_Handle          intHandle )
195{
196        BINT_CallbackHandle cbHandle;
197        BINT_Stats_CallbackStats *pCbStats = NULL;
198        int iCallbackNum = 1;
199        bool bFirstDump = true;
200
201        if (intHandle == NULL)
202        {
203                return BERR_TRACE(BERR_INVALID_PARAMETER);
204        }
205
206        /* print stats using default bins */
207        cbHandle = BINT_GetCallbackFirst( intHandle );
208
209        while (cbHandle)
210        {
211                BINT_Stats_Get(cbHandle, &pCbStats);
212
213                if (pCbStats->bDefaultBins)
214                {
215                        /* print out label */
216                        if (bFirstDump)
217                        {
218                                BINT_P_Stats_DumpLabel(pCbStats);
219                                bFirstDump = false;
220                        }
221
222                        BINT_P_Stats_DumpCbData(cbHandle, iCallbackNum);
223                }
224
225                iCallbackNum++;
226                cbHandle = BINT_GetCallbackNext( cbHandle );
227        }
228
229        /* print stats using user bins */
230        iCallbackNum = 1;
231        cbHandle = BINT_GetCallbackFirst( intHandle );
232
233        while (cbHandle)
234        {
235                BINT_Stats_Get(cbHandle, &pCbStats);
236
237                if (!pCbStats->bDefaultBins)
238                {
239                        BINT_P_Stats_DumpLabel(pCbStats);
240                        BINT_P_Stats_DumpCbData(cbHandle, iCallbackNum);
241                }
242
243                iCallbackNum++;
244                cbHandle = BINT_GetCallbackNext( cbHandle );
245        }
246
247        return BERR_SUCCESS;
248}
Note: See TracBrowser for help on using the repository browser.