初始化:
int32_t value = 1;
value |= 2; // reset all counters to zero.
value |= 4; // reset cycle counter to zero.
// program the performance-counter control-register:
asm volatile ("MCR p15, 0, %0, c9, c12, 0\t\n" :: "r"(value));
// enable all counters:
asm volatile ("MCR p15, 0, %0, c9, c12, 1\t\n" :: "r"(0x8000000f));
// clear overflows:
asm volatile ("MCR p15, 0, %0, c9, c12, 3\t\n" :: "r"(0x8000000f));
读取计数器:
asm volatile ("MRC p15, 0, %0, c9, c13, 0\t\n": "=r"(value));
怎么解决呢?最好有linux的验证代码,目前没有看出这里的代码有什么问题。
Shine:
下面的网站上有代码。 stackoverflow.com/…/how-to-measure-program-execution-time-in-arm-cortex-a8-processor
rong chen:
回复 Shine:
没有看出来这个代码和我发的有什么差异,ti官方发行linux版本 的时候应该有验证这块功能的吧? TI支持没有板子验证一下吗?