| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2010, 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: bxvd_decoder_timer.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/3 $ |
|---|
| 12 | * $brcm_Date: 6/28/10 3:01p $ |
|---|
| 13 | * |
|---|
| 14 | * [File Description:] |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/portinginterface/xvd/7401/bxvd_decoder_timer.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/3 6/28/10 3:01p btosi |
|---|
| 21 | * SW7405-4365: fixed file header |
|---|
| 22 | * |
|---|
| 23 | ***************************************************************************/ |
|---|
| 24 | |
|---|
| 25 | #ifndef BXVD_DECODER_TIMER_H__ |
|---|
| 26 | #define BXVD_DECODER_TIMER_H__ |
|---|
| 27 | |
|---|
| 28 | #include "bxvd.h" |
|---|
| 29 | |
|---|
| 30 | #ifdef __cplusplus |
|---|
| 31 | extern "C" { |
|---|
| 32 | #endif |
|---|
| 33 | |
|---|
| 34 | /* |
|---|
| 35 | * Set to a non zero value to compile in the function timing code. |
|---|
| 36 | * To reduce overhead, only enable this code when profiling the DM. |
|---|
| 37 | */ |
|---|
| 38 | #define BXVD_DECODER_TIMER_S_ENABLE_FUNCTION_TIMING 0 |
|---|
| 39 | |
|---|
| 40 | /* |
|---|
| 41 | * Set to a non zero value to compile in the callback timing code. |
|---|
| 42 | */ |
|---|
| 43 | #define BXVD_DECODER_TIMER_S_ENABLE_CALLBACK_TIMING 1 |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | #define BXVD_DECODER_TIMER_P_MAX_STR_LEN 512 |
|---|
| 47 | |
|---|
| 48 | typedef struct BXVD_DecoderTimer_P_Sample |
|---|
| 49 | { |
|---|
| 50 | uint32_t uiNumSamples; |
|---|
| 51 | uint32_t uiStartTimeUsecs; |
|---|
| 52 | uint32_t uiEndTimeUsecs; |
|---|
| 53 | uint32_t uiElapseTimeUsecs; |
|---|
| 54 | uint32_t uiTotalTimeUsecs; |
|---|
| 55 | |
|---|
| 56 | uint32_t uiAverageTimeUsecs; |
|---|
| 57 | uint32_t uiMinTimeUsecs; |
|---|
| 58 | uint32_t uiMaxTimeUsecs; |
|---|
| 59 | |
|---|
| 60 | } BXVD_DecoderTimer_P_Sample; |
|---|
| 61 | |
|---|
| 62 | /* To make the result easier to interpret, these should be in the order that calls are made. |
|---|
| 63 | * Note: they can be any sample point in the code, not just function entry/exit points |
|---|
| 64 | */ |
|---|
| 65 | typedef enum BXVD_DecoderTimer_P_eFunc |
|---|
| 66 | { |
|---|
| 67 | BXVD_DecoderTimer_P_eFuncDisplayIsr, |
|---|
| 68 | BXVD_DecoderTimer_P_eFuncUQ_Vet, |
|---|
| 69 | BXVD_DecoderTimer_P_eFuncUQ_DQT, |
|---|
| 70 | BXVD_DecoderTimer_P_eFuncUQ_Val, |
|---|
| 71 | BXVD_DecoderTimer_P_eFuncUQ_AddPic, |
|---|
| 72 | |
|---|
| 73 | BXVD_DecoderTimer_P_eFuncGetPicCount, |
|---|
| 74 | BXVD_DecoderTimer_P_eFuncPeekAtPic, |
|---|
| 75 | BXVD_DecoderTimer_P_eFuncGetNextPic, |
|---|
| 76 | BXVD_DecoderTimer_P_eFuncReleasePic, |
|---|
| 77 | |
|---|
| 78 | BXVD_DecoderTimer_P_eFuncMax |
|---|
| 79 | |
|---|
| 80 | } BXVD_DecoderTimer_P_eFunc; |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | typedef enum BXVD_DecoderTimer_P_eCallbacks |
|---|
| 84 | { |
|---|
| 85 | BXVD_DecoderTimer_P_eCbUserData, |
|---|
| 86 | BXVD_DecoderTimer_P_eCbPPBReceived, |
|---|
| 87 | BXVD_DecoderTimer_P_eCbMax |
|---|
| 88 | |
|---|
| 89 | } BXVD_DecoderTimer_P_eCallbacks; |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | typedef struct BXVD_DecoderTimer_P_Data |
|---|
| 93 | { |
|---|
| 94 | |
|---|
| 95 | #if BXVD_DECODER_TIMER_S_ENABLE_FUNCTION_TIMING |
|---|
| 96 | |
|---|
| 97 | /* Decoder Function Times */ |
|---|
| 98 | BXVD_DecoderTimer_P_Sample astFunctions[BXVD_DecoderTimer_P_eFuncMax]; |
|---|
| 99 | |
|---|
| 100 | #endif |
|---|
| 101 | |
|---|
| 102 | /* Decoder Callback Times */ |
|---|
| 103 | BXVD_DecoderTimer_P_Sample astCallbacks[BXVD_DecoderTimer_P_eCbMax]; |
|---|
| 104 | |
|---|
| 105 | } BXVD_DecoderTimer_P_Data; |
|---|
| 106 | |
|---|
| 107 | #if BDBG_DEBUG_BUILD |
|---|
| 108 | |
|---|
| 109 | void BXVD_DecoderTimer_P_SnapshotFunctionStartTime( |
|---|
| 110 | BXVD_ChannelHandle hXvdCh, |
|---|
| 111 | BXVD_DecoderTimer_P_eFunc eFunctionIndex |
|---|
| 112 | ); |
|---|
| 113 | void BXVD_DecoderTimer_P_SnapshotFunctionEndTime( |
|---|
| 114 | BXVD_ChannelHandle hXvdCh, |
|---|
| 115 | BXVD_DecoderTimer_P_eFunc eFunctionIndex |
|---|
| 116 | ); |
|---|
| 117 | |
|---|
| 118 | void BXVD_DecoderTimer_P_SnapshotCallbackStartTime( |
|---|
| 119 | BXVD_ChannelHandle hXvdCh, |
|---|
| 120 | BXVD_DecoderTimer_P_eCallbacks eCallbackIndex |
|---|
| 121 | ); |
|---|
| 122 | |
|---|
| 123 | void BXVD_DecoderTimer_P_SnapshotCallbackEndTime( |
|---|
| 124 | BXVD_ChannelHandle hXvdCh, |
|---|
| 125 | BXVD_DecoderTimer_P_eCallbacks eCallbackIndex |
|---|
| 126 | ); |
|---|
| 127 | |
|---|
| 128 | void BXVD_DecoderTimer_P_PrintResults( |
|---|
| 129 | BXVD_ChannelHandle hXvdCh |
|---|
| 130 | ); |
|---|
| 131 | |
|---|
| 132 | #else |
|---|
| 133 | |
|---|
| 134 | /* non debug build */ |
|---|
| 135 | |
|---|
| 136 | #define BXVD_DecoderTimer_P_SnapshotFunctionStartTime( hXvdCh, eFunctionIndex ) |
|---|
| 137 | #define BXVD_DecoderTimer_P_SnapshotCallbackStartTime( hXvdCh, eCallbackIndex ) |
|---|
| 138 | #define BXVD_DecoderTimer_P_SnapshotFunctionEndTime( hXvdCh, eFunctionIndex ) |
|---|
| 139 | #define BXVD_DecoderTimer_P_SnapshotCallbackEndTime( hXvdCh, eCallbackIndex ) |
|---|
| 140 | #define BXVD_DecoderTimer_P_PrintResults( hXvdCh ) |
|---|
| 141 | |
|---|
| 142 | #endif |
|---|
| 143 | |
|---|
| 144 | #ifdef __cplusplus |
|---|
| 145 | } |
|---|
| 146 | #endif |
|---|
| 147 | |
|---|
| 148 | #endif /* #ifndef BXVD_DECODER_TIMER_H__ */ |
|---|