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

📄 ixperfprofacccodelet.c

📁 intel IXP400系列cpu(2.3版)的库文件
💻 C
📖 第 1 页 / 共 4 页
字号:
    if (frequency != evt3Samp)    {        printf("\nALERT SAMPLE numbers does not match !");    } /* end if */    /* Print defined number of results onto the screen */    printf("List of samples for every counter of EventProfile3 in descending frequency\n");    printf("**************************************************************************\n\n");    for (eventSampCount=0; eventSampCount < SAMPLES_REQUIRED; eventSampCount++)    {        printf("Event 3 sample %d program counter = 0x%x\n", eventSampCount+1,                                          eventProfile3[eventSampCount].programCounter);        printf("Event 3 sample %d frequency = %u\n", eventSampCount+1,                                          eventProfile3[eventSampCount].freq);    } /* end for */    printf("*****************************************************\n\n");    /* Get total number of samples collected for event 4 */    evt4Samp = eventSampResults.event4_samples;    numPc=0;    frequency=0;    /* Get total frequency of samples */    while (frequency < evt4Samp)    {        frequency += eventProfile4[numPc].freq;        numPc++;    } /* end while */    if (frequency != evt4Samp)    {        printf("\nALERT SAMPLE numbers does not match !");    } /* end if */    printf("List of samples for every counter of EventProfile4 in descending frequency\n");    printf("**************************************************************************\n\n");    /* Print results of defined number of samples for event 4 */    for (eventSampCount=0; eventSampCount < SAMPLES_REQUIRED; eventSampCount++)    {        printf("Event 4 sample %d program counter = 0x%x\n", eventSampCount+1,                                          eventProfile4[eventSampCount].programCounter);        printf("Event 4 sample %d frequency = %u\n", eventSampCount+1,                                          eventProfile4[eventSampCount].freq);    } /* end for */    printf("*****************************************************\n\n");    return eventSampStatus; } /* end function ixPerfProfAccCodeletXscalePmuEventSamp*/#ifdef __vxworks/* Function definition:  * Run xcycle functionalities */IxPerfProfAccStatusixPerfProfAccCodeletXcycle(UINT32 param1){    IxPerfProfAccStatus xcycleStatus = IX_PERFPROF_ACC_STATUS_SUCCESS;    IxPerfProfAccXcycleResults xcycleResults;     /* Stores the Idle Cycle results */    UINT32 numBaselineCycle = 0;   /* Stores the baseline from Xcycle calculations */        printf("\n*****************************\n");        printf("Executing Xcycle Measurement\n");        printf("****************************\n");        /* Get Baseline */        if (XCYCLE_CONTINUOUS_MODE == param1)        {            printf("Cannot select 0 number of runs\n");            return IX_PERFPROF_ACC_STATUS_FAIL;        }        xcycleStatus = ixPerfProfAccXcycleBaselineRun(&numBaselineCycle);        switch (xcycleStatus)        {            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_XCYCLE_MEASUREMENT_IN_PROGRESS:                printf("XCycle measurement in progress\n");                return IX_PERFPROF_ACC_STATUS_FAIL;            case IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_SET_FAIL:                printf("Failed to set priority\n");                return IX_PERFPROF_ACC_STATUS_FAIL;            case IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_RESTORE_FAIL:                printf("Failed to restore priority\n");                return IX_PERFPROF_ACC_STATUS_FAIL;            case IX_PERFPROF_ACC_STATUS_SUCCESS:                printf("Baseline successfully obtained\n");                break;            default:                printf("Unknown error baseline not obtained\n");                return IX_PERFPROF_ACC_STATUS_FAIL;        } /* end switch */        /* Start calculation of idle cycles for a given number of runs*/        xcycleStatus = ixPerfProfAccXcycleStart(param1);        switch (xcycleStatus)                {            case IX_PERFPROF_ACC_STATUS_XCYCLE_NO_BASELINE:                printf("Cannot start...no baseline set\n");                return IX_PERFPROF_ACC_STATUS_FAIL;             case IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_REQUEST_OUT_OF_RANGE:                printf("Number of measurements requested exceeds limit\n");                printf("Maximum limit defined by\n");                printf("IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS\n");                return IX_PERFPROF_ACC_STATUS_FAIL;             case IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS:                printf("Xcycle measurement already in progress\n");                return IX_PERFPROF_ACC_STATUS_FAIL;             case IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS:                printf("Another utility is currently running. Xcycle not started\n");                return IX_PERFPROF_ACC_STATUS_FAIL;            case IX_PERFPROF_ACC_STATUS_XCYCLE_THREAD_CREATE_FAIL:                printf("Failed to create thread\n");                return IX_PERFPROF_ACC_STATUS_FAIL;             case IX_PERFPROF_ACC_STATUS_SUCCESS:                printf("Xcycle Measurement Started\n");                break;            default:                printf("Unknown error\n");                return IX_PERFPROF_ACC_STATUS_FAIL;       } /* end switch */       /* Delay to allow idle cycle measurement to complete before getting results. */       while(ixPerfProfAccXcycleInProgress())       {           ixOsalSleep(XCYCLE_DELAY);       }       /* Get results. If anything except success is returned, print error message and        * exit.        */       xcycleStatus = ixPerfProfAccXcycleResultsGet (&xcycleResults);       switch(xcycleStatus)       {            case IX_PERFPROF_ACC_STATUS_XCYCLE_NO_BASELINE:                printf("Cannot start...no baseline set\n");                return IX_PERFPROF_ACC_STATUS_FAIL;            case IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS:                printf("Xcycle measurement already in progress\n");                return IX_PERFPROF_ACC_STATUS_FAIL;            case IX_PERFPROF_ACC_STATUS_FAIL:                printf("No measurements have been performed\n");                return IX_PERFPROF_ACC_STATUS_FAIL;            case IX_PERFPROF_ACC_STATUS_SUCCESS:                printf("Results obtained\n");                break;            default:                printf("Unknown error\n");                return IX_PERFPROF_ACC_STATUS_FAIL;       }/* end switch */       /* Print calculated values to screen. */       printf("Maximum percentage of idle cycles = %f\n", xcycleResults.maxIdlePercentage);       printf("Minimum percentage of idle cycles = %f\n", xcycleResults.minIdlePercentage);       printf("Average percentage of idle cycles = %f\n", xcycleResults.aveIdlePercentage);       printf("Total number of measurements      = %u\n", xcycleResults.totalMeasurements);       return xcycleStatus;}/* end function ixPerfProfAccCodeletXcycle */#endif/* * Function definition: ixPerfProfAccCodeletSelection() * Function accepts user selection and runs individual functionality based on the input. * This function is also called by demo all and runs all the functionalities. It returns a  * fail if any of the user selection is wrong or a fail is returned by the function it calls. * In either case an error message is printed to the screen and function is exited. When all the  * necessary functionalities are executed correctly, this function returns a success. */IxPerfProfAccStatus ixPerfProfAccCodeletSelection(      IxPerfProfAccCodeletMode mode,       UINT32 param1,       UINT32 param2,      UINT32 param3,       UINT32 param4,       UINT32 param5,       UINT32 param6,      UINT32 param7,       UINT32 param8,       UINT32 param9){    IxPerfProfAccStatus status = IX_PERFPROF_ACC_STATUS_SUCCESS;    /* If help mode selected, call the help function. */    if (IX_PERFPROF_ACC_CODELET_MODE_HELP == mode)    {        ixPerfProfAccCodeletHelp();        return IX_PERFPROF_ACC_STATUS_SUCCESS;     }/* end if */    /* If BUS PMU modes selected, print the relevant messages on the screen and start counting     * of events.     */    else if ((IX_PERFPROF_ACC_CODELET_MODE_BUS_PMU_NORTH_MODE == mode)||             (IX_PERFPROF_ACC_CODELET_MODE_BUS_PMU_SOUTH_MODE == mode)||             (IX_PERFPROF_ACC_CODELET_MODE_BUS_PMU_SDRAM_MODE == mode))     {           status = ixPerfProfAccCodeletBusPmu(mode,                                           param1,                                           param2,                                           param3,                                           param4,                                           param5,                                           param6,                                           param7);        if (IX_PERFPROF_ACC_STATUS_SUCCESS != status)        {            return status;        }    }    /* If bus pmu pmsr is selected, get the pmsr value and perform bit-wise      * to obtain required information manipulation      */    else if (IX_PERFPROF_ACC_CODELET_MODE_BUS_PMU_PMSR_GET == mode)    {        ixPerfProfAccCodeletPMSR();    } /* end else if */         /* If Xscale PMU event counting is selected, start the counting, check for errors,     * wait for a preset period while counting is taking place, stop and read values.     */    else if (IX_PERFPROF_ACC_CODELET_MODE_XSCALE_PMU_EVENT_COUNTING == mode)    {        status = ixPerfProfAccCodeletXscalePmuEventCount(param1,                                                          param2,                                                          param3,                                                         param4,                                                          param5,                                                          param6);        if (IX_PERFPROF_ACC_STATUS_SUCCESS != status)        {            return status;        }    } /*end else if*/     /* If Xscale PMU time sampling is selected, start the sampling, check for errors,     * wait for a preset period while counting is taking place, stop and read values.     */    else if (IX_PERFPROF_ACC_CODELET_MODE_XSCALE_PMU_TIME_SAMPLING == mode)    {        status = ixPerfProfAccCodeletXscalePmuTimeSamp(param1, param2);        if (IX_PERFPROF_ACC_STATUS_SUCCESS != status)        {            return status;        }    } /*end else if*/            /* If Xscale PMU Event Sampling is selected, start the sampling, check for errors,     * wait for a preset period while counting is taking place, stop and read values.     */    else if (IX_PERFPROF_ACC_CODELET_MODE_XSCALE_PMU_EVENT_SAMPLING == mode)    {        status = ixPerfProfAccCodeletXscalePmuEventSamp(param1,                                                         param2,                                                         param3,                                                         param4,                                                        param5,                                                         param6,                                                         param7,                                                         param8,                                                         param9);        if (IX_PERFPROF_ACC_STATUS_SUCCESS != status)        {            return status;        }    }    #ifdef __vxworks    /* If Xcycle mode is selected, start the baseline calculation,      * start the idle cycle calculation, check for errors,     * wait for a preset period while counting is taking place, stop and read values.     */    else if (IX_PERFPROF_ACC_CODELET_MODE_XCYCLE == mode)    {        status = ixPerfProfAccCodeletXcycle(param1);        if (IX_PERFPROF_ACC_STATUS_SUCCESS != status)        {            return status;        }    }    #endif      else    {       printf("Invalid mode selected. Please try again\n");       return IX_PERFPROF_ACC_STATUS_FAIL;    }/* end else */     return IX_PERFPROF_ACC_STATUS_SUCCESS; }/* end function ixPerfProfAccCodeletSelection() *//** *Function definition: ixPerfProfAccCodeletAll() *Called to demonstrated all the functionalities available. Function calls all the  *individual functions and exits if there is an error. */IxPerfProfAccStatusixPerfProfAccCodeletAll(void){   IxPerfProfAccStatus status = IX_PERFPROF_ACC_STATUS_SUCCESS;   BOOL clkCntDiv = FALSE;   UINT32 numEvents = 4;   UINT32 samplingRate = 0xffff;   #ifdef __vxworks   UINT32 numRun = 20;   #endif   

⌨️ 快捷键说明

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