| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003, 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: bkni_metrics.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/1 $ |
|---|
| 12 | * $brcm_Date: 3/20/03 3:27p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /vobs/magnum/basemodules/kernelinterface/linuxuser/bkni_metrics.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/1 3/20/03 3:27p erickson |
|---|
| 21 | * initial work |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/5 3/17/03 4:09p erickson |
|---|
| 24 | * kernel interface doc changes |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/4 3/10/03 2:29p erickson |
|---|
| 27 | * updated docs |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/3 3/7/03 5:20p erickson |
|---|
| 30 | * linux kernel interface work |
|---|
| 31 | * |
|---|
| 32 | * Hydra_Software_Devel/2 3/6/03 6:27p erickson |
|---|
| 33 | * rework KNI api |
|---|
| 34 | * |
|---|
| 35 | * Hydra_Software_Devel/1 3/5/03 5:16p erickson |
|---|
| 36 | * Initial kernelinterface work |
|---|
| 37 | * |
|---|
| 38 | ***************************************************************************/ |
|---|
| 39 | #ifndef BKNI_METRICS_H |
|---|
| 40 | #define BKNI_METRICS_H |
|---|
| 41 | |
|---|
| 42 | /*************************************************************************** |
|---|
| 43 | Summary: |
|---|
| 44 | Data structure used by BKNI_GetMetrics to return kernel interface metrics. |
|---|
| 45 | ****************************************************************************/ |
|---|
| 46 | typedef struct { |
|---|
| 47 | uint32_t totalDelays; /* Total number of times BKNI_Delay was called. */ |
|---|
| 48 | uint32_t totalDelayTime; /* Acculated microsec's passed into BKNI_Delay. */ |
|---|
| 49 | uint32_t maxDelayTime; /* Largest microsec value passed into BKNI_Delay. */ |
|---|
| 50 | |
|---|
| 51 | uint32_t totalSleeps; /* Total number of times BKNI_Sleep was called. */ |
|---|
| 52 | uint32_t totalSleepTime; /* Acculated millisec's passed into BKNI_Sleep. */ |
|---|
| 53 | uint32_t maxSleepTime; /* Largest millisec value passed into BKNI_Sleep. */ |
|---|
| 54 | |
|---|
| 55 | uint32_t totalMutexSections; /* Total number of times BKNI_AcquireMutex was called. */ |
|---|
| 56 | uint32_t totalMutexSectionTime; /* Total time in milliseconds spent between matching |
|---|
| 57 | BKNI_AcquireMutex and BKNI_ReleaseMutex calls. */ |
|---|
| 58 | uint32_t maxMutexSectionTime; /* Largest time in milliseconds spent between matching |
|---|
| 59 | BKNI_AcquireMutex and BKNI_ReleaseMutex calls. */ |
|---|
| 60 | |
|---|
| 61 | uint32_t totalCriticalSections; /* Total number of times BKNI_AcquireMutex was called. */ |
|---|
| 62 | uint32_t totalCriticalSectionTime;/* Total time in milliseconds spent between |
|---|
| 63 | BKNI_EnterCriticalSection and BKNI_LeaveCriticalSection calls. */ |
|---|
| 64 | uint32_t maxCriticalSectionTime; /* Largest time in milliseconds spent between |
|---|
| 65 | BKNI_EnterCriticalSection and BKNI_LeaveCriticalSection calls. */ |
|---|
| 66 | |
|---|
| 67 | uint32_t totalMemoryAllocated; |
|---|
| 68 | } BKNI_Metrics; |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | /*************************************************************************** |
|---|
| 72 | Summary: |
|---|
| 73 | Retrieve metrics from kernel interface regarding delay, sleep and mutex usage. The |
|---|
| 74 | metrics are accumulated since the last BKNI_Init() or BKNI_ResetMetrics() call. |
|---|
| 75 | ****************************************************************************/ |
|---|
| 76 | void BKNI_GetMetrics(BKNI_Metrics *metrics); |
|---|
| 77 | |
|---|
| 78 | |
|---|
| 79 | /*************************************************************************** |
|---|
| 80 | Summary: |
|---|
| 81 | Reset all metrics to initial values before kernel interface was used. |
|---|
| 82 | ****************************************************************************/ |
|---|
| 83 | void BKNI_ResetMetrics(void); |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | /*************************************************************************** |
|---|
| 87 | Summary: |
|---|
| 88 | Structure to control debug output of kernel interface. |
|---|
| 89 | ****************************************************************************/ |
|---|
| 90 | typedef struct { |
|---|
| 91 | bool printDelays; /* Print every time BKNI_Delay is called. */ |
|---|
| 92 | bool printSleeps; /* Print every time BKNI_Sleep is called. */ |
|---|
| 93 | bool printMutexSections; /* Print every time BKNI_AcquireMutex and BKNI_ReleaseMutex are called. */ |
|---|
| 94 | bool printCriticalSections; /* Print every time BKNI_EnterCriticalSection and |
|---|
| 95 | BKNI_LeaveCriticalSection are called. */ |
|---|
| 96 | bool printEvents; /* Print every time BKNI_SetEvent and |
|---|
| 97 | BKNI_WaitForEvent are called. */ |
|---|
| 98 | } BKNI_MetricsLoggingState; |
|---|
| 99 | |
|---|
| 100 | |
|---|
| 101 | /*************************************************************************** |
|---|
| 102 | Summary: |
|---|
| 103 | Change the debug output of the kernel interface. |
|---|
| 104 | ****************************************************************************/ |
|---|
| 105 | void BKNI_GetMetricsLoggingState(BKNI_MetricsLoggingState *logging); |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | /*************************************************************************** |
|---|
| 109 | Summary: |
|---|
| 110 | Get the debug output state of the kernel interface. |
|---|
| 111 | ****************************************************************************/ |
|---|
| 112 | void BKNI_SetMetricsLoggingState(const BKNI_MetricsLoggingState *logging); |
|---|
| 113 | |
|---|
| 114 | #endif /* BKNI_METRICS_H */ |
|---|