Profiling on hand Cortex_A8

I want to do profiling for my application on an ARM processor. I found that oprofile is not working. Someone used the following code for testing several years ago. the cyclical counter does the job, the performance monitor counter is still not working. I tested it again, it is the same. For the following code, I got the number of cycles: 2109, performance monitor counter: 0. I searched Google, so far I have not found a solution. Has anyone fixed this issue?

uint32_t value = 0 uint32_t count = 0; struct timeval tv; struct timezone tz; // enable all counters __asm__ __volatile__ ("mcr p15, 0, %0, c9, c12, 1" ::"r" (0x8000000f)); // select counter 0, __asm__ __volatile__("mcr p15, 0, %0, c9, c12, 5" ::"r" (0x0)); // select event __asm__ __volatile__ ("mcr p15, 0, %0, c9, c13, 1" ::"r"(0x57)); // reset all counters to ero and enable all counters __asm__ __volatile__ ("mrc p15, 0, %0, c9, c12, 0" : "=r" (value)); value |= 0xF; __asm__ __volatile__ ("mcr p15, 0, %0, c9, c12, 0" :: "r" (value)); gettimeofday(&tv, &tz); __asm__ __volatile__("mrc p15, 0, %0, c9, c13, 0" : "=r" (count)); printf("cycle count: %d", count); __asm__ __volatile__ ("mrc P15, 0, %0, c9, c13, 2": "=r" (count)); printf("performance monitor count: %d", count); 
0
source share
1 answer

I just ran into the same problem, and in my case, it was due to the low signal level of NIDENm .

From the ARM documentation:

The PMU only counts events when a non-invasive debug file is included, that is, when approving DBGENm or NIDENm . The Cycle Counter Register (PMCCNTR) is always on regardless of whether non-invasive debugging is enabled if the DP bit of the PMCR register is not set.

This NIDENm signal is the input to the ARM core, so exactly how it is controlled will depend on the parts of the processor external to the core. In my case, I found a registry that controls NIDEN. In your case, it can be a register or a pin, or (possibly) the signal will simply be pulled low, and you cannot use this function.

Also from the ARM documentation:

The values โ€‹โ€‹of the DBGENm and NIDENm can be determined by polling DBGDSCR[17:16] , DBGDSCR[15:14] or DBGAUTHSTATUS .

So, if you can read one of them, you can confirm that the problem is NIDENm .

0
source

All Articles