📄 ixperfprofacccodelet.c
字号:
else if (PCI == pssValue) { printf("PCI was the previous slave on the arbiter\n"); printf("accessing the AHBS\n"); } /* end else if */ else if (QUEUE_MANAGER == pssValue) { printf("Queue manager was the previous slave on the arbiter\n"); printf("accessing the AHBS\n"); } /* end else if */ else if (AHB_APB_BRIDGE == pssValue) { printf("Expansion Bus was the previous slave on the arbiter\n"); printf("accessing the AHBS\n"); } /* end else if */ else { printf("Unknown value obtained. Last slave undetermined.\n"); } /* end else */} /*end of function ixPerfProfAccCodeletPMSR */ /* Function definition ixPerfProfAccCodeletXscalePmuEventCount() * Run xscale pmu event counting functionalities. */IxPerfProfAccStatusixPerfProfAccCodeletXscalePmuEventCount( UINT32 param1, UINT32 param2, UINT32 param3, UINT32 param4, UINT32 param5, UINT32 param6){ IxPerfProfAccXscalePmuResults eventCountStopResults; /* Stores the event count results */ IxPerfProfAccStatus eventCountStatus = IX_PERFPROF_ACC_STATUS_SUCCESS; printf("\n***********************************\n"); printf("Executing Xscale PMU Event Counting\n"); printf("***********************************\n"); eventCountStatus = ixPerfProfAccXscalePmuEventCountStart(param1, param2, param3, param4, param5, param6); /* Check returned value. If anything but success, print error message to the * screen and exit. */ switch (eventCountStatus) { 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_XSCALE_PMU_NUM_INVALID: printf("Invalid number of events chosen\n"); return IX_PERFPROF_ACC_STATUS_FAIL; case IX_PERFPROF_ACC_STATUS_XSCALE_PMU_EVENT_INVALID: printf("Invalid event chosen\n"); return IX_PERFPROF_ACC_STATUS_FAIL; case IX_PERFPROF_ACC_STATUS_SUCCESS: printf("Event count started\n"); break; default: printf("Started event counting successfully\n"); return IX_PERFPROF_ACC_STATUS_FAIL; } /* end switch */ /* Wait for fixed period of time for counting to continue. */ ixOsalSleep(DELAY); /* Stop event counting */ eventCountStatus = ixPerfProfAccXscalePmuEventCountStop (&eventCountStopResults); /* Check if any error is returned. If not success print message and exit */ switch(eventCountStatus) { case IX_PERFPROF_ACC_STATUS_XSCALE_PMU_START_NOT_CALLED: printf("Event Count Start not called\n"); return IX_PERFPROF_ACC_STATUS_FAIL; case IX_PERFPROF_ACC_STATUS_SUCCESS: printf("Event counter successfully stopped\n"); break; default: printf("Unknown error while stopping\n"); return IX_PERFPROF_ACC_STATUS_FAIL; } /* end switch */ /* Printf results to screen */ printf("Event 1 lower 32 bit = %u\n", eventCountStopResults.event1_value); printf("Event 1 upper 32 bit = %u\n", eventCountStopResults.event1_samples); printf("Event 2 lower 32 bit = %u\n", eventCountStopResults.event2_value); printf("Event 2 upper 32 bit = %u\n", eventCountStopResults.event2_samples); printf("Event 3 lower 32 bit = %u\n", eventCountStopResults.event3_value); printf("Event 3 upper 32 bit = %u\n", eventCountStopResults.event3_samples); printf("Event 4 lower 32 bit = %u\n", eventCountStopResults.event4_value); printf("Event 4 upper 32 bit = %u\n", eventCountStopResults.event4_samples); printf("Clock counter value = %u\n", eventCountStopResults.clk_value); return eventCountStatus;} /* end ixPerfProfAccXscalePmuEventCount *//* Function definition: ixPerfProfAccCodeletXscalePmuTimeSamp() * Run event sampling functionalities */IxPerfProfAccStatusixPerfProfAccCodeletXscalePmuTimeSamp(UINT32 param1, UINT32 param2){ IxPerfProfAccStatus timeSampStatus = IX_PERFPROF_ACC_STATUS_SUCCESS; IxPerfProfAccXscalePmuEvtCnt clkCount; UINT32 timeSampCount = 0; printf("\n**********************************\n"); printf("Executing Xscale PMU Time Sampling\n"); printf("**********************************\n"); timeSampStatus = ixPerfProfAccXscalePmuTimeSampStart(param1, param2); switch(timeSampStatus) { 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_FAIL: printf("Sampling rate bigger than maximum counter value\n"); return IX_PERFPROF_ACC_STATUS_FAIL; case IX_PERFPROF_ACC_STATUS_SUCCESS: printf("Successfully started time sampling\n"); break; default: printf("Unknown error\n"); return IX_PERFPROF_ACC_STATUS_FAIL; }/* end switch */ /* Delay while allowing sampling to continue. */ ixOsalSleep(DELAY); /* Stop sampling get results and print to screen. */ timeSampStatus = ixPerfProfAccXscalePmuTimeSampStop(&clkCount, timeProfile); switch(timeSampStatus) { case IX_PERFPROF_ACC_STATUS_XSCALE_PMU_START_NOT_CALLED: printf("Start function not called\n"); return IX_PERFPROF_ACC_STATUS_FAIL; case IX_PERFPROF_ACC_STATUS_SUCCESS: printf("Successfully stopped time sampling\n"); break; default: printf("Unknown error\n"); return IX_PERFPROF_ACC_STATUS_FAIL; }/* end switch */ printf("Printing top 5 samples\n"); printf("**********************\n"); for(timeSampCount=0; timeSampCount<SAMPLES_REQUIRED; timeSampCount++) { printf("Program counter value for sample %d = 0x%x\n", timeSampCount+1, timeProfile[timeSampCount].programCounter); printf("Frequency of occurance of sample %d = %u\n", timeSampCount+1, timeProfile[timeSampCount].freq); }/* end for */ return timeSampStatus;}/* end function ixPerfProfAccCodeletXscalePmuTimeSamp *//* Function definition: ixPerfProfAccCodeletXscalePmuEventSamp() * Run event sampling functionalities */IxPerfProfAccStatusixPerfProfAccCodeletXscalePmuEventSamp(UINT32 param1, UINT32 param2, UINT32 param3, UINT32 param4, UINT32 param5, UINT32 param6, UINT32 param7, UINT32 param8, UINT32 param9){ IxPerfProfAccStatus eventSampStatus = IX_PERFPROF_ACC_STATUS_SUCCESS; IxPerfProfAccXscalePmuResults eventSampResults; /* Stores results from GetResults during event sampling */ UINT32 eventSampCount = 0; /* Increments counters for event counting */ UINT32 frequency = 0; /* Frequency of samples */ UINT32 evt1Samp=0; /* Stores Event 1 sample */ UINT32 evt2Samp=0; /* Stores Event 2 sample */ UINT32 evt3Samp=0; /* Stores Event 3 sample */ UINT32 evt4Samp=0; /* Stores Event 4 sample */ UINT32 numPc = 0; /* Number of unique pc addresses */ printf("\n***********************************\n"); printf("Executing Xscale PMU Event Sampling\n"); printf("***********************************\n"); eventSampStatus = ixPerfProfAccXscalePmuEventSampStart(param1, param2, param3, param4, param5, param6, param7, param8, param9); switch(eventSampStatus) { case IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS: printf("Another utility currently in progress\n"); return IX_PERFPROF_ACC_STATUS_FAIL; case IX_PERFPROF_ACC_STATUS_XSCALE_PMU_NUM_INVALID: printf("Invalid number of events chosen\n"); return IX_PERFPROF_ACC_STATUS_FAIL; case IX_PERFPROF_ACC_STATUS_XSCALE_PMU_EVENT_INVALID: printf("Invalid event chosen\n"); return IX_PERFPROF_ACC_STATUS_FAIL; case IX_PERFPROF_ACC_STATUS_FAIL: printf("Sampling rate bigger than counter size\n"); return IX_PERFPROF_ACC_STATUS_FAIL; case IX_PERFPROF_ACC_STATUS_SUCCESS: printf("Event Sampling Started\n"); break; default: printf("Unknown error\n"); return IX_PERFPROF_ACC_STATUS_FAIL; }/* end switch */ /* Delay to enable event sampling to continue. */ ixOsalSleep(DELAY); /* Stop event sampling get results and print to screen */ eventSampStatus = ixPerfProfAccXscalePmuEventSampStop(eventProfile1, eventProfile2, eventProfile3, eventProfile4); switch(eventSampStatus) { case IX_PERFPROF_ACC_STATUS_XSCALE_PMU_START_NOT_CALLED: printf("Start function not called\n"); return IX_PERFPROF_ACC_STATUS_FAIL; case IX_PERFPROF_ACC_STATUS_SUCCESS: printf("Event Sampling Stopped\n"); break; default: printf("Unknown error while stopping\n"); return IX_PERFPROF_ACC_STATUS_FAIL; }/* end switch */ /* Get results */ ixPerfProfAccXscalePmuResultsGet(&eventSampResults); /* Get number of samples for event 1 */ evt1Samp = eventSampResults.event1_samples; numPc=0; frequency=0; /* For number of samples in event 1, get total frequency */ while (frequency < evt1Samp) { frequency += eventProfile1[numPc].freq; numPc++; }/* end while */ if (frequency != evt1Samp) { printf("\nALERT SAMPLE numbers does not match !"); }/* end if */ /* Print values of defined number of samples to the screen. */ printf("List of top 5 samples for every counter in descending frequency\n"); printf("***************************************************************\n\n"); for (eventSampCount=0; eventSampCount < SAMPLES_REQUIRED; eventSampCount++) { printf("Event 1 sample %d program counter = 0x%x\n", eventSampCount+1, eventProfile1[eventSampCount].programCounter); printf("Event 1 sample %d frequency = %u\n", eventSampCount+1, eventProfile1[eventSampCount].freq); }/* end for */ printf("*****************************************************\n\n"); /* Get number of samples collected for event 2 */ evt2Samp = eventSampResults.event2_samples; numPc=0; frequency=0; /* Get total frequency of all samples */ while (frequency < evt2Samp) { frequency += eventProfile2[numPc].freq; numPc++; } /* end while */ if (frequency != evt2Samp) { printf("\nALERT SAMPLE numbers does not match !"); } /* end if */ printf("List of samples for every counter of EventProfile2 in descending frequency\n"); printf("**************************************************************************\n\n"); for (eventSampCount=0; eventSampCount < SAMPLES_REQUIRED; eventSampCount++) { printf("Event 2 sample %d program counter = 0x%x\n", eventSampCount+1, eventProfile2[eventSampCount].programCounter); printf("Event 2 sample %d frequency = %u\n", eventSampCount+1, eventProfile2[eventSampCount].freq); } /* end for */ printf("*****************************************************\n\n"); /* Get total number of samples taken for event 3 */ evt3Samp = eventSampResults.event3_samples; numPc=0; frequency=0; /* Get total of the frequencies */ while (frequency < evt3Samp) { frequency += eventProfile3[numPc].freq; numPc++; } /* end while */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -