返回信息流我现在用的是ARM CortexA9,每次跑程序耗时差别很大,我是处理图像的,有时候处理同一幅图像90ms,有时又耗时240ms,这是为什么呢?没有内存泄露,板子上没有跑其他程序。
这是一条镜像帖。来源:北邮人论坛 / embedded-system / #12511同步于 2012/7/26
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Embedded_System机器人发帖
【求各位大牛指导】ARM CortexA9,每次跑程序耗时差别很大?
lovexia
2012/7/26镜像同步9 回复
订阅后,新回复会通过你的通知中心匿名送达。
9 条回复
不知道
不过你确定你测定时间的方法是一定准确的么~~
【 在 lovexia (BUPT) 的大作中提到: 】
: 我现在用的是ARM CortexA9,每次跑程序耗时差别很大,我是处理图像的,有时候处理同一幅图像90ms,有时又耗时240ms,这是为什么呢?没有内存泄露,板子上没有跑其他程序。
【 在 nickluchen 的大作中提到: 】
: 用PMU测的?Cache初始化正确吗
我是用clock测得,你说的PMU全称是什么啊?我怎么没有查到这个可以测量耗时啊。谢谢
Performance Monitor Unit
ARM的手册上边有详细的解释。你是跑的bare metal,还是arm-linux?
【 在 lovexia 的大作中提到: 】
:
: 我是用clock测得,你说的PMU全称是什么啊?我怎么没有查到这个可以测量耗时啊。谢谢
如果是arm-linux的话,应该用的uboot做的bootloader吧?cache初始化应该在uboot里都配置好了,应该没有问题。linux系统中user mode应该访问不了pmu。
我们这里是给OS打了patch,让user mode下应用程序可以访问PMU,然后做的performance test。
对了 忘了个很重要的问题 你用的cortex-a9是双核的吧?如果带linux系统,你的程序可能会在两个核上边切换。你要指定程序只在一个核上运行。不过我们程序是读取PMU,不知道timer是不是两个核各自都有。
之前我们做过test,给你转一下我的笔记:
Reason:
Our panda board is running Linux OS. ARM Cortex-a9 on Panda Board has two CPU cores.
By default, our program can be switched between these two cores due to the schedule policy of Linux.
Test for CPU affinity:
1) without taskset
command:
panda2@panda2-desktop:~/clu$ ./ffttest.axf 512 0 sine_6dB_400Hz_10s_44.1kHz_2ch.wav &
panda2@panda2-desktop:~/clu$ while :; do ps -eo pid,ni,pri,pcpu,psr,comm | grep "ffttest"; sleep 1;done
output on tty: (column 5 indicates the current CPU id)
15297 0 19 88.0 0 ffttest.axf
15297 0 19 94.6 0 ffttest.axf
15297 0 19 97.5 0 ffttest.axf
15297 0 19 99.0 0 ffttest.axf
15297 0 19 100 0 ffttest.axf
15297 0 19 101 0 ffttest.axf
15297 0 19 101 0 ffttest.axf
15297 0 19 102 1 ffttest.axf
15297 0 19 102 1 ffttest.axf
15297 0 19 94.3 0 ffttest.axf
15297 0 19 95.0 0 ffttest.axf
15297 0 19 96.0 0 ffttest.axf
15297 0 19 96.7 0 ffttest.axf
15297 0 19 97.2 1 ffttest.axf
15297 0 19 97.8 1 ffttest.axf
15297 0 19 98.2 1 ffttest.axf
15297 0 19 98.6 1 ffttest.axf
15297 0 19 99.1 1 ffttest.axf
15297 0 19 99.4 1 ffttest.axf
15297 0 19 99.8 1 ffttest.axf
15297 0 19 100 1 ffttest.axf
15297 0 19 96.3 1 ffttest.axf
15297 0 19 96.6 1 ffttest.axf
15297 0 19 97.0 1 ffttest.axf
15297 0 19 97.2 0 ffttest.axf
15297 0 19 97.5 0 ffttest.axf
15297 0 19 97.8 1 ffttest.axf
15297 0 19 98.0 1 ffttest.axf
15297 0 19 98.3 0 ffttest.axf
15297 0 19 98.6 0 ffttest.axf
15297 0 19 98.8 0 ffttest.axf
15297 0 19 99.0 0 ffttest.axf
15297 0 19 99.2 0 ffttest.axf
2) use taskset
command:
panda2@panda2-desktop:~/clu$ taskset 0x01 ./ffttest.axf 512 0 sine_6dB_400Hz_10s_44.1kHz_2ch.wav &
panda2@panda2-desktop:~/clu$ while :; do ps -eo pid,ni,pri,pcpu,psr,comm | grep "ffttest"; sleep 1;done
output on tty:
15422 0 19 113 0 ffttest.axf
15422 0 19 111 0 ffttest.axf
15422 0 19 110 0 ffttest.axf
15422 0 19 109 0 ffttest.axf
15422 0 19 109 0 ffttest.axf
15422 0 19 108 0 ffttest.axf
15422 0 19 97.8 0 ffttest.axf
15422 0 19 98.6 0 ffttest.axf
15422 0 19 99.1 0 ffttest.axf
15422 0 19 99.6 0 ffttest.axf
15422 0 19 100 0 ffttest.axf
15422 0 19 100 0 ffttest.axf
15422 0 19 101 0 ffttest.axf
15422 0 19 101 0 ffttest.axf
15422 0 19 101 0 ffttest.axf
15422 0 19 101 0 ffttest.axf
15422 0 19 102 0 ffttest.axf
15422 0 19 102 0 ffttest.axf
15422 0 19 98.1 0 ffttest.axf
15422 0 19 98.4 0 ffttest.axf
15422 0 19 98.7 0 ffttest.axf
15422 0 19 99.0 0 ffttest.axf
15422 0 19 99.3 0 ffttest.axf
15422 0 19 99.5 0 ffttest.axf
15422 0 19 99.8 0 ffttest.axf
15422 0 19 100 0 ffttest.axf
15422 0 19 100 0 ffttest.axf
15422 0 19 100 0 ffttest.axf
15422 0 19 100 0 ffttest.axf
15422 0 19 100 0 ffttest.axf
15422 0 19 101 0 ffttest.axf
【 在 lovexia 的大作中提到: 】
: 我现在用的是ARM CortexA9,每次跑程序耗时差别很大,我是处理图像的,有时候处理同一幅图像90ms,有时又耗时240ms,这是为什么呢?没有内存泄露,板子上没有跑其他程序。
【 在 nickluchen 的大作中提到: 】
: [face=Tahoma]对了 忘了个很重要的问题 你用的cortex-a9是双核的吧?如果带linux系统,你的程序可能会在两个核上边切换。你要指定程序只在一个核上运行。不过我们程序是读取PMU,不知道timer是不是两个核各自都有。
: 之前我们做过test,给你转一下我的笔记:
: Reason:
: ...................
非常感谢,我用的是arm-linux,我这个A9是单核的,我今天早上重新测时,发现耗时稳定了,我使用的是NFS挂载,如果把要运行的程序拷贝到arm上运行耗时就会稳定,如果是在远端的PC上,运行程序耗时就会非常不稳定。谢谢您的指导,非常感谢。至于您说的那个PMU我还没怎么搞懂,我遇到问题在问您吧,谢谢!
【 在 lovexia 的大作中提到: 】
: 非常感谢,我用的是arm-linux,我这个A9是单核的,我今天早上重新测时,发现耗时稳定了,我使用的是NFS挂载,如果把要运行的程序拷贝到arm上运行耗时就会稳定,如果是在远端的PC上,运行程序耗时就会非常不稳定。谢谢您的指导,非常感谢。至于您说的那个PMU我还没怎么搞懂,我遇到问题在问您吧,谢谢!
arm上运行是板卡真实时间吧,远端的PC上是指仿真器?
right,问题就出在nfs上,网络在ms级别上是不稳定的,mount一个tmpfs然后拷贝到里面跑就可以了。
【 在 lovexia (BUPT) 的大作中提到: 】
: 非常感谢,我用的是arm-linux,我这个A9是单核的,我今天早上重新测时,发现耗时稳定了,我使用的是NFS挂载,如果把要运行的程序拷贝到arm上运行耗时就会稳定,如果是在远端的PC上,运行程序耗时就会非常不稳定。谢谢您的指导,非常感谢。至于您说的那个PMU我还没怎么搞