⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ixperfprofacccodelet.c

📁 intel IXP400系列cpu(2.3版)的库文件
💻 C
📖 第 1 页 / 共 4 页
字号:
/** * @file IxPerfProfAccCodelet.c * * @date June-18-2003 * * @brief This file contains the implementation of the PerfProf Access Codelet. * * Descriptions of the functions used in this codelet is contained in * IxPerfProfAccCodelet.h * *  * @par * IXP400 SW Release version 2.3 *  * -- Copyright Notice -- *  * @par * Copyright (c) 2001-2005, Intel Corporation. * All rights reserved. *  * @par * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. Neither the name of the Intel Corporation nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. *  *  * @par * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. *  *  * @par * -- End of Copyright Notice --*//* * Put the system defined include files required. *//* * Put the user defined include files required. */#include "IxPerfProfAccCodelet.h"#include "IxPerfProfAcc.h"#include "IxOsal.h"#define     SAMPLES_REQUIRED        5     /* Number of samples required by the user to be                                             printed onto the screen. Used for event sampling */#define     DELAY                   20000 /* Delay used between the start and stop calls */#ifdef __vxworks#define     XCYCLE_DELAY            1000  /* Delay between the xcycle start and stop calls */ #define     XCYCLE_CONTINUOUS_MODE  0     /* When xcycle start is called, this parameter                                               indicates continuous counting */#endif/* * Declaration of private function  */IxPerfProfAccStatus ixPerfProfAccCodeletSelection     (IxPerfProfAccCodeletMode mode,                       UINT32 param1,                       UINT32 param2,                      UINT32 param3,                       UINT32 param4,                       UINT32 param5,                       UINT32 param6,                      UINT32 param7,                       UINT32 param8,                       UINT32 param9);voidixPerfProfAccCodeletHelp(void);IxPerfProfAccStatus ixPerfProfAccCodeletAll(void);IxPerfProfAccStatusixPerfProfAccCodeletBusPmu (IxPerfProfAccCodeletMode mode,                            UINT32 param1,                            UINT32 param2,                            UINT32 param3,                            UINT32 param4,                            UINT32 param5,                            UINT32 param6,                            UINT32 param7);voidixPerfProfAccCodeletPMSR(void);IxPerfProfAccStatusixPerfProfAccCodeletXscalePmuEventCount(UINT32 param1,                                        UINT32 param2,                                        UINT32 param3,                                        UINT32 param4,                                        UINT32 param5,                                        UINT32 param6);IxPerfProfAccStatusixPerfProfAccCodeletXscalePmuTimeSamp(UINT32 param1, UINT32 param2);IxPerfProfAccStatusixPerfProfAccCodeletXscalePmuEventSamp(UINT32 param1,                                UINT32 param2,                                UINT32 param3,                                UINT32 param4,                                UINT32 param5,                                UINT32 param6,                                UINT32 param7,                                UINT32 param8,                                UINT32 param9);IxPerfProfAccStatusixPerfProfAccCodeletXcycle(UINT32 param1);voidixPerfProfAccCodeletProfileSort (IxPerfProfAccXscalePmuSamplePcProfile *profileArray, UINT32 total);/* * Global variables.  */IxPerfProfAccXscalePmuSamplePcProfile timeProfile[IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES];IxPerfProfAccXscalePmuSamplePcProfile eventProfile1[IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES];IxPerfProfAccXscalePmuSamplePcProfile eventProfile2[IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES];IxPerfProfAccXscalePmuSamplePcProfile eventProfile3[IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES];IxPerfProfAccXscalePmuSamplePcProfile eventProfile4[IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES];/* * Function definition: ixPerfProfAccCodeletBusPmu() * Function executes all bus pmu related functionalities.  */IxPerfProfAccStatusixPerfProfAccCodeletBusPmu (IxPerfProfAccCodeletMode mode,                            UINT32 param1,                            UINT32 param2,                            UINT32 param3,                            UINT32 param4,                            UINT32 param5,                            UINT32 param6,                            UINT32 param7) {    IxPerfProfAccStatus busPmuStatus = IX_PERFPROF_ACC_STATUS_SUCCESS;    IxPerfProfAccBusPmuResults BusPmuResults;       /* Stores the Bus PMU results */    UINT32 pecCounter = 0;                          /* Counts number of PECs in Bus PMU */     switch(mode)    {        /* Start executing BUS PMU North mode event counting */        case IX_PERFPROF_ACC_CODELET_MODE_BUS_PMU_NORTH_MODE:            printf("\n*************************************\n");            printf("Executing BUS PMU NORTH BUS profiling\n");            printf("*************************************\n");            busPmuStatus = ixPerfProfAccBusPmuStart(IX_PERFPROF_ACC_BUS_PMU_MODE_NORTH,                                                      param1,                                                      param2,                                                     param3,                                                      param4,                                                      param5,                                                      param6,                                                      param7);            break;        /* Start executing BUS PMU South mode event counting */        case IX_PERFPROF_ACC_CODELET_MODE_BUS_PMU_SOUTH_MODE:            printf("\n*************************************\n");            printf("Executing BUS PMU SOUTH BUS profiling\n");            printf("*************************************\n");            busPmuStatus = ixPerfProfAccBusPmuStart(IX_PERFPROF_ACC_BUS_PMU_MODE_SOUTH,                                                      param1,                                                      param2,                                                     param3,                                                      param4,                                                      param5,                                                      param6,                                                      param7);            break;        /* Start executing BUS PMU Sdram mode event counting */        case IX_PERFPROF_ACC_CODELET_MODE_BUS_PMU_SDRAM_MODE:            printf("\n*************************************\n");            printf("Executing BUS PMU SDRAM BUS profiling\n");            printf("*************************************\n");            busPmuStatus = ixPerfProfAccBusPmuStart(IX_PERFPROF_ACC_BUS_PMU_MODE_SDRAM,                                                      param1,                                                      param2,                                                     param3,                                                      param4,                                                      param5,                                                      param6,                                                      param7);            break;        default:            break;    }/* end switch */    switch(busPmuStatus)        {         case IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS:             printf("Another utility currently running\n");             return IX_PERFPROF_ACC_STATUS_FAIL;         case IX_PERFPROF_ACC_STATUS_BUS_PMU_MODE_ERROR:             printf("BUS PMU: Invalid mode selected\n");             return IX_PERFPROF_ACC_STATUS_FAIL;         case IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC1_ERROR:             printf("BUS PMU: Invalid selection for PEC1\n");             return IX_PERFPROF_ACC_STATUS_FAIL;         case IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC2_ERROR:             printf("BUS PMU: Invalid selection for PEC2\n");             return IX_PERFPROF_ACC_STATUS_FAIL;         case IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC3_ERROR:             printf("BUS PMU: Invalid selection for PEC3\n");             return IX_PERFPROF_ACC_STATUS_FAIL;         case IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC4_ERROR:             printf("BUS PMU: Invalid selection for PEC4\n");             return IX_PERFPROF_ACC_STATUS_FAIL;         case IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC5_ERROR:             printf("BUS PMU: Invalid selection for PEC5\n");             return IX_PERFPROF_ACC_STATUS_FAIL;         case IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC6_ERROR:             printf("BUS PMU: Invalid selection for PEC6\n");             return IX_PERFPROF_ACC_STATUS_FAIL;         case IX_PERFPROF_ACC_STATUS_BUS_PMU_PEC7_ERROR:             printf("BUS PMU: Invalid selection for PEC7\n");             return IX_PERFPROF_ACC_STATUS_FAIL;         case IX_PERFPROF_ACC_STATUS_SUCCESS:             printf("Bus PMU started\n");             break;         default:             printf("Unknown error\n");             return IX_PERFPROF_ACC_STATUS_FAIL;    }/* end switch */    /* Run counting for this period of time */    ixOsalSleep(DELAY);    /* Stop counting */    busPmuStatus = ixPerfProfAccBusPmuStop();    /* Check status of returned value and if anything other than a success,     * print error message and exit.     */    switch(busPmuStatus)    {         case IX_PERFPROF_ACC_STATUS_BUS_PMU_START_NOT_CALLED:             printf("Need to call start first\n");             return IX_PERFPROF_ACC_STATUS_FAIL;         case IX_PERFPROF_ACC_STATUS_FAIL:             printf("Fail to stop BUS Pmu\n");             return IX_PERFPROF_ACC_STATUS_FAIL;         case IX_PERFPROF_ACC_STATUS_SUCCESS:             printf("Bus PMU stopped successfully\n");             break;         default:             printf("Unknown error while stopping\n");             return IX_PERFPROF_ACC_STATUS_FAIL;    }/* end switch */    /* Get results of the counters and print to the output. */    ixPerfProfAccBusPmuResultsGet (&BusPmuResults);    for (pecCounter = 0; IX_PERFPROF_ACC_BUS_PMU_MAX_PECS > pecCounter; pecCounter++)    {        printf("PEC %d upper 32 bit value = %u\n", pecCounter+1,                                  BusPmuResults.statsToGetUpper32Bit[pecCounter]);        printf("PEC %d lower 27 bit value = %u\n", pecCounter+1,                                  BusPmuResults.statsToGetLower27Bit[pecCounter]);    }/* end for */    return busPmuStatus;}/* end function ixPerfProfAccCodeletBusPmu *//* Function definition: IxPerfProfAccCodeletPMSR() * Function calls PMSR Get and displays results onto the screen. */void ixPerfProfAccCodeletPMSR(){    UINT32 pmsrValue = 0;          /* PMSR value read from the PMSR register. */    UINT32 pssValue = 0;           /* Value corresponding to the pss portion of the total                                      PMSR value */    printf ("\n**************\n");    printf ("GET PMSR VALUE\n");    printf ("**************\n");    ixPerfProfAccBusPmuPMSRGet (&pmsrValue);    pssValue = pmsrValue & PSS_MASK;    if(EXPANSION_BUS == pssValue)    {        printf("Expansion Bus was the previous slave on the arbiter\n");        printf("accessing the AHBS\n");    } /* end else if */    else if (SDRAM_CONTROLLER == pssValue)    {        printf("Sdram controller was the previous slave on the arbiter\n");        printf("accessing the AHBS\n");    } /* end else if */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -