Profling手臂Cortex_A8 [英] Profling on arm Cortex_A8

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

问题描述

我要为我在ARM处理器上的应用程序做分析。我发现oprofile的不起作用。有人使用了以下code键几年前测试。循环计数器
没有工作,性能监视器计数器仍然无法正常工作。我再次测试它,它是一样的。对于以下code,我得到了循环计数:2109性能监视器数:0我已经通过谷歌搜索,到目前为止,我还没有找到一个解决方案。有人已经修复了这个问题?

  uint32_t的值= 0
    uint32_t的计数= 0;
    timeval结构电视;
    结构时区TZ;    //启用所有计数器
    __asm​​__ __volatile__(MCR P15,0,%0,C9,C12,1::R(0x8000000f));    //选择计数器0,
    __asm​​__ __volatile __(MCR P15,0,%0,C9,C12,5::R(为0x0));
    //选择事件
    __asm​​__ __volatile__(MCR P15,0,%0,C9,C13,1::R(0×57));    //重新设置所有计数器ERO,使所有的计数器
    __asm​​__ __volatile__(MRC P15,0,0%,C9,C12,0:= R(值));
    值| = 0xF的;
    __asm​​__ __volatile__(MCR P15,0,%0,C9,C12,0::R(值));    函数gettimeofday(安培;电视,功放及; TZ);    __asm​​__ __volatile __(MRC P15,0,0%,C9,C13,0:= R(计数));
    的printf(周期数数:%d,计数);    __asm​​__ __volatile__(MRC P15,0,0%,C9,C13,2:= R(计数));
    的printf(性能监视器数数:%d,计数);


解决方案

我只是碰到了同样的问题,在我的情况下,它是由于 NIDENm 信号为拉低。

从ARM文档:


  

在PMU只计算活动时,启用非侵入性的调试,也就是当任 DBGENm NIDENm 输入有效。的周期计数(PMCCNTR)注册始终不管非侵入调试是否启用启用,除非PMCR寄存器的DP位被置


也就是说的 NIDENm 信号是输入到ARM核心,所以它如何精确控制将取决于所述处理器外部的芯的部分。就我而言,我发现了一个寄存器控制NIDEN。根据你的情况,它可能是一个寄存器或脚,或(可能的)信号只是拉低,则无法使用该功能。

同样来自ARM文档:


  

DBGENm NIDENm 信号可以通过查询确定 DBGDSCR的值[ 17:16] DBGDSCR [15:14] DBGAUTHSTATUS


所以,如果你能读其中之一,你可以确认问题是的 NIDENm

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);

解决方案

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

From the ARM documentation:

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.

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.

Also from the ARM documentation:

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

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

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

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