/** * @file IxPerfProfAcc.h * * @brief Header file for the IXP400 Perf Prof component (IxPerfProfAcc) * * * @par * IXP400 SW Release version 2.0 * * -- Copyright Notice -- * * @par * Copyright 2001-2005, Intel Corporation. * All rights reserved. * * @par * SPDX-License-Identifier: BSD-3-Clause * @par * -- End of Copyright Notice -- */ /** * @defgroup IxPerfProfAcc IXP400 Performance Profiling (IxPerfProfAcc) API * * @brief IXP400 Performance Profiling Utility component Public API. * @li NOTE: Xcycle measurement is not supported in Linux. * * * @{ */ #ifndef IXPERFPROFACC_H #define IXPERFPROFACC_H #include "IxOsal.h" #ifdef __linux #include #endif /* * Section for #define */ /** * @ingroup IxPerfProfAcc * * @def IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES * * @brief This is the maximum number of profiling samples allowed, which can be * modified according to the user's discretion */ #define IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES 0xFFFF /** * @ingroup IxPerfProfAcc * * @def IX_PERFPROF_ACC_BUS_PMU_MAX_PECS * * @brief This is the maximum number of Programmable Event Counters available. * This is a hardware specific and fixed value. Do not change. * */ #define IX_PERFPROF_ACC_BUS_PMU_MAX_PECS 7 /** * @ingroup IxPerfProfAcc * * @def IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS * * @brief Max number of measurement allowed. This constant is used when * creating storage array for Xcycle. When run in continuous mode, * Xcycle will wrap around and re-use buffer. */ #define IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS 600 #ifdef __linux /** * @ingroup IxPerfProfAcc * * @def IX_PERFPROF_ACC_XSCALE_PMU_SYMBOL_ACCURACY * * @brief Level of accuracy required for matching the PC Address to * symbol address. This is used when the XScale PMU time/event * sampling functions get the PC address and search for the * corresponding symbol address. */ #define IX_PERFPROF_ACC_XSCALE_PMU_SYMBOL_ACCURACY 0xffff #endif /*__linux*/ /** * @ingroup IxPerfProfAcc * * @def IX_PERFPROF_ACC_LOG * * @brief Mechanism for logging a formatted message for the PerfProfAcc component * * @param level UINT32 [in] - trace level * @param device UINT32 [in] - output device * @param str char* [in] - format string, similar to printf(). * @param a UINT32 [in] - first argument to display * @param b UINT32 [in] - second argument to display * @param c UINT32 [in] - third argument to display * @param d UINT32 [in] - fourth argument to display * @param e UINT32 [in] - fifth argument to display * @param f UINT32 [in] - sixth argument to display * * @return none */ #ifndef NDEBUG #define IX_PERFPROF_ACC_LOG(level, device, str, a, b, c, d, e, f)\ (ixOsalLog (level, device, str, a, b, c, d, e, f)) #else /*do nothing*/ #define IX_PERFPROF_ACC_LOG(level, device, str, a, b, c, d, e, f) #endif /*ifdef NDEBUG */ /* * Section for struct */ /** * @brief contains summary of samples taken * * Structure contains all details of each program counter value - frequency * that PC occurs */ typedef struct { UINT32 programCounter; /** * * ************************************************************************************* * * Bit * Name * Description * * * * * ************************************************************************************* * * [31:18] *Reserved* * * ************************************************************************************* * * [17:12] * PSS * Indicates which of the slaves on * * * * * ARBS was previously * * * * * accessed by the AHBS. * * * * * [000001] Expansion Bus * * * * * [000010] SDRAM Controller * * * * * [000100] PCI * * * * * [001000] Queue Manager * * * * * [010000] AHB-APB Bridge * * * * * [100000] Reserved * * ************************************************************************************* * * [11:8] * PSN * Indicates which of the Slaves on * * * * * ARBN was previously * * * * * accessed the AHBN. * * * * * [0001] SDRAM Controller * * * * * [0010] AHB-AHB Bridge * * * * * [0100] Reserved * * * * * [1000] Reserved * * ************************************************************************************* * * [7:4] * PMS * Indicates which of the Masters on * * * * * ARBS was previously * * * * * accessing the AHBS. * * * * * [0001] Gasket * * * * * [0010] AHB-AHB Bridge * * * * * [0100] PCI * * * * * [1000] APB * * ************************************************************************************* * * [3:0] * PMN * Indicates which of the Masters on * * * * * ARBN was previously * * * * * accessing the AHBN. * * * * * [0001] NPEA * * * * * [0010] NPEB * * * * * [0100] NPEC * * * * * [1000] Reserved * * ************************************************************************************* * * * @param *pmsrValue UINT32 [out] - Pointer to return PMSR value. Users need to * allocate storage for psmrValue. * * @return none * * @li Reentrant : no * @li ISR Callable : no * **/ PUBLIC void ixPerfProfAccBusPmuPMSRGet ( UINT32 *pmsrValue); /** * The APIs below are specifically used for Xcycle module. **/ /** * @ingroup IxPerfProfAcc * * @fn ixPerfProfAccXcycleBaselineRun ( UINT32 *numBaselineCycle) * * @brief Perform baseline for Xcycle * * @param *numBaselineCycle UINT32 [out] - pointer to baseline value after * calibration. Calling function are responsible for * allocating memory space for this pointer. * * Global Data : * - None. * * This function MUST be run before the Xcycle tool can be used. This * function must be run immediately when the OS boots up with no other * addition programs running. * Addition note : This API will measure the time needed to perform * a fix amount of CPU instructions (~ 1 second worth of loops) as a * highest priority task and with interrupt disabled. The time measured * is known as the baseline - interpreted as the shortest time * needed to complete the amount of CPU instructions. The baseline is * returned as unit of time in 66Mhz clock tick. * * @return * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful run, result is returned * - IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_SET_FAIL - failed to change * task priority * - IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_RESTORE_FAIL - failed to * restore task priority * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility * is running * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS - Xcycle * tool has already started * * @li Reentrant : no * @li ISR Callable : no * */ PUBLIC IxPerfProfAccStatus ixPerfProfAccXcycleBaselineRun( UINT32 *numBaselineCycle); /** * @ingroup IxPerfProfAcc * * @fn ixPerfProfAccXcycleStart( UINT32 numMeasurementsRequested); * * @brief Start the measurement * * @param numMeasurementsRequested UINT32 [in] - number of measurements * to perform. Value can be 0 to * IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS. * 0 indicate continuous measurement. * * Global Data : * - None. * * * Start the measurements immediately. * numMeasurementsRequested specifies number of measurements to run. * If numMeasurementsRequested is set to 0, the measurement will * be performed continuously until IxPerfProfAccXcycleStop() * is called. * It is estimated that 1 measurement takes approximately 1 second during * low CPU utilization, therefore 128 measurement takes approximately 128 sec. * When CPU utilization is high, the measurement will take longer. * This function spawn a task the perform the measurement and returns. * The measurement may continue even if this function returns. * * IMPORTANT: Under heavy CPU utilization, the task spawn by this * function may starve and fail to respond to stop command. User * may need to kill the task manually in this case. * * There are only IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS * storage available so storing is wrapped around if measurements are * more than IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS. * * * @return * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful start, a thread is created * in the background to perform measurement. * - IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_SET_FAIL - failed to set * task priority * - IX_PERFPROF_ACC_STATUS_XCYCLE_THREAD_CREATE_FAIL - failed to create * thread to perform measurement. * - IX_PERFPROF_ACC_STATUS_XCYCLE_NO_BASELINE - baseline is not available * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_REQUEST_OUT_OF_RANGE - * value is larger than IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS - Xcycle tool * has already started * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility is * running * * @li Reentrant : no * @li ISR Callable : no * */ PUBLIC IxPerfProfAccStatus ixPerfProfAccXcycleStart ( UINT32 numMeasurementsRequested); /** * @ingroup IxPerfProfAcc * * @fn ixPerfProfAccXcycleStop(void); * * @brief Stop the Xcycle measurement * * @param None * * Global Data : * - None. * * Stop Xcycle measurements immediately. If the measurements have stopped * or not started, return IX_PERFPROF_STATUS_XCYCLE_MEASUREMENT_NOT_RUNNING. * Note: This function does not stop measurement cold. The measurement thread * may need a few seconds to complete the last measurement. User needs to use * ixPerfProfAccXcycleInProgress() to determine if measurement is indeed * completed. * * @return * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful measurement is stopped * - IX_PERFPROF_STATUS_XCYCLE_MEASUREMENT_NOT_RUNNING - no measurement running * * @li Reentrant : no * @li ISR Callable : no * */ PUBLIC IxPerfProfAccStatus ixPerfProfAccXcycleStop(void); /** * @ingroup IxPerfProfAcc * * @fn ixPerfProfAccXcycleResultsGet( IxPerfProfAccXcycleResults *xcycleResult ) * * @brief Get the results of Xcycle measurement * * @param *xcycleResult @ref IxPerfProfAccXcycleResults [out] - Pointer to * results of last measurements. Calling function are * responsible for allocating memory space for this pointer. * * Global Data : * - None. * * Retrieve the results of last measurement. User should use * ixPerfProfAccXcycleInProgress() to check if measurement is completed * before getting the results. * * @return * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful * - IX_PERFPROF_ACC_STATUS_FAIL - result is not complete. * - IX_PERFPROF_ACC_STATUS_XCYCLE_NO_BASELINE - baseline is performed * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS - Xcycle * tool is still running * * @li Reentrant : no * @li ISR Callable : no * */ PUBLIC IxPerfProfAccStatus ixPerfProfAccXcycleResultsGet ( IxPerfProfAccXcycleResults *xcycleResult); /** * @ingroup IxPerfProfAcc * * @fn ixPerfProfAccXcycleInProgress (void) * * @brief Check if Xcycle is running * * @param None * Global Data : * - None. * * Check if Xcycle measuring task is running. * * @return * - true - Xcycle is running * - false - Xcycle is not running * * @li Reentrant : no * @li ISR Callable : no * */ PUBLIC BOOL ixPerfProfAccXcycleInProgress(void); #ifdef __linux /** * @ingroup IxPerfProfAcc * * @fn ixPerfProfAccXscalePmuTimeSampCreateProcFile * * @brief Enables proc file to call module function * * @param None * * Global Data : * - None. * * This function is declared globally to enable /proc directory system to call * and execute the function when the registered file is called. This function is not meant to * be called by the user. * * @return * - Length of data written to file. * * @li Reentrant : no * @li ISR Callable : no * */ int ixPerfProfAccXscalePmuTimeSampCreateProcFile (char *buf, char **start, off_t offset, int count, int *eof, void *data); /** * @ingroup IxPerfProfAcc * * @fn ixPerfProfAccXscalePmuEventSampCreateProcFile * * @brief Enables proc file to call module function * * @param None * * Global Data : * - None. * * This function is declared globally to enable /proc directory system to call * and execute the function when the registered file is called. This function is not meant to * be called by the user. * * @return * - Length of data written to file. * * @li Reentrant : no * @li ISR Callable : no * */ int ixPerfProfAccXscalePmuEventSampCreateProcFile (char *buf, char **start, off_t offset, int count, int *eof, void *data); #endif /* ifdef __linux */ #endif /* ndef IXPERFPROFACC_H */ /** *@} defgroup IxPerfProfAcc */