I tried to get the cycle count for ADSP-SC573 -ARM in different ways. But i got cycle count=0 for every case. Listing out the different ways i tested for the same.
- Using Core Cycle-Counting Macros defined in cycle_count.h
#include <cycle_count.h>
#include<stdio.h>
#include<stdlib.h>int main()
{int i;
cycle_stats_t CyclsTst;
CYCLES_INIT(CyclsTst);
CYCLES_START(CyclsTst);
for (i=0;i<500;i++)
{
int c1=1,a=5,c2=2,b=10,sum;
sum = (c1*a)+(c2*b);
}CYCLES_STOP(CyclsTst);
CYCLES_STOP(CyclsTst);
printf("\n=========Print cycle count values=========\n");
CYCLES_PRINT(CyclsTst);return 0;
}
- Using A5_PMU source files which is attached in EngineerZone discussion:ADSP-SC58x/2158x PMU Overflow Interrupt- Example code
#include<stdio.h>
#include<stdlib.h>int main()
{A5_Start_Cycle_Count();
printf("Read Cycle_Count = %d\n", A5_Read_Cycle_Count());int i;
for (i=0;i<500;i++)
{
int c1=1,a=5,c2=2,b=10,sum;
sum = (c1*a)+(c2*b);
}A5_Stop_Cycle_Count();
printf("Read Cycle_Count = %d\n", A5_Read_Cycle_Count());return 0;
}
- Using example code downloaded from ARM community: DS-5 Development Studio | Using the PMU Event Counters in DS-5 – Arm Developer
#include<stdio.h>
#include<stdlib.h>int main()
{int i;
start_counters(); //Configure and Start the countersfor (i=0;i<500;i++)
{
int c1=1,a=5,c2=2,b=10,sum;
sum = (c1*a)+(c2*b);
}stop_counters(); //Stop the counters
printf("\nPerformance monitor results\n\n");
printf("Instructions Executed = %u\n", read_pmn(0) );
printf("Cycle Count (CCNT) = %u\n", read_ccnt() );
printf("Data Accesses = %u\n", read_pmn(1) );
printf("Data Reads = %u\n", read_pmn(2) );
printf("Data Writes = %u\n", read_pmn(3) );
inst=read_pmn(0);
cycl=read_ccnt();
cycl_inst=cycl/inst;
printf("Average cycles per instruction = %f\n",cycl_inst);return 0;
}
For all the above codes i am getting cycle count as 0. I am using QEMU(Debug Configuration used :- Application with GDB and QEMU(Simulator) ) simulator to view the output.