手臂 Cortex_A8 上的轮廓分析 [英] Profling on arm Cortex_A8

查看:21
本文介绍了手臂 Cortex_A8 上的轮廓分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 ARM 处理器上对我的应用程序进行分析.我发现 oprofile 不起作用.几年前有人用下面的代码测试过.循环计数器确实有效,性能监视器计数器仍然无效.我又测试了一遍,还是一样.对于下面的代码,我得到了循环计数:2109,性能监视器计数:0.我用谷歌搜索过,到目前为止,我还没有找到解决方案.有人解决了这个问题吗?

I want to do profiling for my application on ARM processor. I found the oprofile doesn't work. Someone used the following code to test a few years ago. the cyclic counter does work, the performance monitor counter still doesn't work. I tested it again, it is same. For following code, I got cycle count: 2109, performance monitor count: 0. I have searched by google, so far, I have not found a solution. Has someone 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);

推荐答案

我刚刚遇到了同样的问题,就我而言,这是由于 NIDENm 信号被拉低所致.

I just ran into the same issue, and in my case it was due to the NIDENm signal being pulled low.

来自 ARM 文档:

PMU 仅在启用非侵入式调试时对事件进行计数,即当 DBGENmNIDENm 输入被断言时.无论是否启用非侵入式调试,循环计数 (PMCCNTR) 寄存器始终启用,除非设置了 PMCR 寄存器的 DP 位.

The PMU only counts events when non-invasive debug is enabled, that is, when either DBGENm or NIDENm inputs are asserted. The Cycle Count (PMCCNTR) Register is always enabled regardless of whether non-invasive debug is enabled, unless the DP bit of the PMCR register is set.

NIDENm 信号是 ARM 内核的输入,因此它的确切控制方式取决于内核外部的处理器部件.就我而言,我发现了一个控制 NIDEN 的寄存器.在您的情况下,它可能是一个寄存器或引脚,或者(可能)信号只是被拉低而您无法使用该功能.

That NIDENm signal is an 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 register controlling NIDEN. In your case, it may be a register, or a pin, or (possibly) the signal is just pulled low and you can't use the feature.

同样来自 ARM 文档:

Also from the ARM documentation:

DBGENmNIDENm 信号的值可以通过轮询 DBGDSCR[17:16]DBGDSCR[15] 来确定:14]DBGAUTHSTATUS.

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

因此,如果您能阅读其中之一,则可以确认问题出在 NIDENm.

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

这篇关于手臂 Cortex_A8 上的轮廓分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆