I am referring the data sheet spna138a as a reference to measure the time taken for execution of my part of code.
I used the same example given in the data sheet to measure the time. However ,the cycle count is always zero ie there is no update of any variable
Do I need to configure anything in Halcogen to enable PMU? I just included the sys_pmu.h and used the following API
The API should invoke the assembly code right ? But I cannot see it when I debug??
Code is added for reference
_pmuInit_(); _pmuEnableCountersGlobal_(); _pmuSetCountEvent_(pmuCOUNTER0, PMU_CYCLE_COUNT); // PMU_INST_ARCH_EXECUTED _pmuResetCounters_(); _pmuStartCounters_(pmuCOUNTER0); cycles_PMU_start = _pmuGetEventCount_(pmuCOUNTER0); /* Place the task here to measure the time */ //for(i = 0 ; i < 100000; i++); for(i = 0 ; i < 10000; i++) { for(j = 0 ; j < 10000; j++); } /* for(i = 0 ; i < 10000; i++) { for(j = 0 ; j < 10000; i++); } */ _pmuStopCounters_(pmuCOUNTER0); cycles_PMU_end = _pmuGetEventCount_(pmuCOUNTER0); cycles_PMU_measure = cycles_PMU_end - cycles_PMU_start; /* Measure the time compensation */ _pmuResetCounters_(); _pmuStartCounters_(pmuCOUNTER0); cycles_PMU_start = _pmuGetEventCount_(pmuCOUNTER0); _pmuStopCounters_(pmuCOUNTER0); cycles_PMU_end = _pmuGetEventCount_(pmuCOUNTER0); cycles_PMU_comp = cycles_PMU_end - cycles_PMU_start; /* Calculate Time */ cycles_PMU_code = cycles_PMU_measure - cycles_PMU_comp; time_PMU_code = cycles_PMU_code / (f_HCLK); // time_code [us], f_HCLK [MHz]