/* * file test/src/firtest_perf.c * brief performance test for FIR algorithms library * author * date */ /* dependencies */ #include /* * performance test for FIR algorithms library */ void firtest_perf( TestPerf_obj *benchmark, uint8_t memoryModel, float * restrict output, void (*fir_fct) ( const float * restrict, const float * restrict, float * restrict, int, int) ) { CSL_Uint64 start, stop, duration=0; int32_t i, j, k; /* fix number of repetitions */ for (k=0; k < benchmark->perf_rep; k++) { /* performance test selection with memory model dependence */ if ( memoryModel == UMA_L2CACHE_L1DCACHE ) { /* caches levels initializations */ CACHE_setL2Size(CACHE_256KCACHE); CACHE_setL1DSize(CACHE_L1_32KCACHE); CACHE_setL1PSize(CACHE_L1_32KCACHE); /* read current TSC value */ start = CSL_tscRead (); /* call fir algorithm for performance test */ (*fir_fct) (xk_sp, a_sp, output, A_LENGTH, YK_LENGTH); /* processing time calculation */ stop = CSL_tscRead (); duration += stop-start; } #if ( TEST_FIR_L2SRAM_L1DCACHE != 0 ) else if ( memoryModel == UMA_L2SRAM_L1DCACHE ) { /* caches levels initializations */ CACHE_setL2Size(CACHE_32KCACHE); CACHE_setL1DSize(CACHE_L1_32KCACHE); CACHE_setL1PSize(CACHE_L1_32KCACHE); /* read current TSC value */ start = CSL_tscRead (); /* copy part of input array from DDR to L2 */ for(i=0; iperf_rep; benchmark->perf_nbcycles = duration; benchmark->perf_usertime_ms = (float32_t) duration * CPU_CLOCK_MS; benchmark->perf_macs = ((float32_t) FIR_NB_MACS) / ((float32_t) duration); }