作者:chenzhufly QQ:36886052 ( 转载请注明出处)
好久没发心得了,最近有些忙,进展还是可以的,一直没有记录而已。
曾经有人说你如何保证测试的正确性,这个确实很难以回答。所以我会采用一些开放的工具,得到一些大家在同等条件下得到的一些测试结果,供大家参考
先来看看我采用的工具:memxfer: a simple benchmark for memory transfer 网站:http://www.jjj.de/memxfer/memxferpage.html
memxfer简介,英文的就不翻译了,做这行不懂英文就可以不干了,哈哈 With memxfer you can compare the memory transfer performance between 1. copying techniques like the strcpy vs. copying integers or doubles. 2. machines (in case you can access them) 3. BIOS settings 4. copying with or without unrolling and prefetching
采用TI自带的编辑器,修改makefile #OPTS= -DATHLON -W -Wall -O2 -ffast-math -fomit-frame-pointer -fno-exceptions OPTS= -W -Wall -O2 -ffast-math -fomit-frame-pointer -fno-exceptions CROSS_COMPILE=/home/chenzhufly/beaglebone/linux-devkit/bin/arm-arago-linux-gnueabi-gcc .PHONY: memxfer memxfer: $(CROSS_COMPILE) $(OPTS) memxferjj.cc -o memxferjj
#NICE=nice -n -20
.PHONY: run run: for m in $$(seq 0 12); do $(NICE) ./memxferjj -s 32M 2 $$m ; done for m in $$(seq 0 12); do $(NICE) ./memxferjj -s 32k 2000 $$m ; done
SZS= 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 .PHONY: srun srun: for s in $(SZS); do $(NICE) ./memxferjj -s $${s}k 100 6 ; done for s in $(SZS); do $(NICE) ./memxferjj -s $${s}k 100 10 ; done[/quote]
执行后的结果:还是挺强大的 root@beaglebone:/home/sd# ./memxferjj -s 1m 10 0 1 2 3 4 5 6 7 8 avg: 1048576 [ 0]"memcpy" 733.465 MB/s avg: 1048576 [ 1]"char *" 112.502 MB/s avg: 1048576 [ 2]"short *" 215.318 MB/s avg: 1048576 [ 3]"int *" 388.395 MB/s avg: 1048576 [ 4]"long *" 386.832 MB/s avg: 1048576 [ 5]"long * (4x unrolled)" 549.209 MB/s avg: 1048576 [ 6]"int64 *" 512.613 MB/s avg: 1048576 [ 7]"double *" 512.663 MB/s avg: 1048576 [ 8]"double * (4x unrolled)" 512.660 MB/s[/quote]
再看看我笔记本电脑执行的结果,ubuntu系统,cpu是I5 [quote]root@chenzhufly-desktop:/mnt/nfs/test/memxfer_cpu# ./memxferjj -s 1m 10 0 1 2 3 4 5 6 7 8 avg: 1048576 [ 0]"memcpy" 4151.100 MB/s avg: 1048576 [ 1]"char *" 755.059 MB/s avg: 1048576 [ 2]"short *" 810.110 MB/s avg: 1048576 [ 3]"int *" 548.155 MB/s avg: 1048576 [ 4]"long *" 3070.310 MB/s avg: 1048576 [ 5]"long * (4x unrolled)" 4370.629 MB/s avg: 1048576 [ 6]"int64 *" 699.056 MB/s avg: 1048576 [ 7]"double *" 4130.524 MB/s avg: 1048576 [ 8]"double * (4x unrolled)" 4100.041 MB/s
可能这些结果还不够直观,我们来看看网上其他平台的一些测试结果把,这样就可以看出来BeagleBone还是很强大的。 [quote]/MOXA-IA240 //CPU ARM920 192MHZ
root@Moxa:/home# ./memxferjj-art -s 1m 10 0 1 2 3 4 5 6 7 8 avg: 1048576 [ 0]"memcpy" 10.125 MB/s avg: 1048576 [ 1]"char *" 7.556 MB/s avg: 1048576 [ 2]"short *" 8.909 MB/s avg: 1048576 [ 3]"int *" 10.138 MB/s avg: 1048576 [ 4]"long *" 10.117 MB/s avg: 1048576 [ 5]"long * (4x unrolled)" 10.130 MB/s avg: 1048576 [ 6]"int64 *" 10.081 MB/s avg: 1048576 [ 7]"double *" 10.150 MB/s avg: 1048576 [ 8]"double * (4x unrolled)" 10.075 MB/s
------------------------------------------------------------------ moxa_DA662 CPU:arm11(intel XScale IXP425 533MHZ)
root@Moxa:/home# ./memxferjj-da662 -s 1m 10 0 1 2 3 4 5 6 7 8 avg: 1048576 [ 0]"memcpy" 49.951 MB/s avg: 1048576 [ 1]"char *" 16.218 MB/s avg: 1048576 [ 2]"short *" 29.268 MB/s avg: 1048576 [ 3]"int *" 48.763 MB/s avg: 1048576 [ 4]"long *" 48.798 MB/s avg: 1048576 [ 5]"long * (4x unrolled)" 49.549 MB/s avg: 1048576 [ 6]"int64 *" 49.140 MB/s avg: 1048576 [ 7]"double *" 49.128 MB/s avg: 1048576 [ 8]"double * (4x unrolled)" 49.121 MB/s
------------------------------------------------------------------ ATOP CPU:IDT MIPS 266MHZ
# ./memxferjj-mips -s 1m 10 0 1 2 3 4 5 6 7 8 avg: 1048576 [ 0]"memcpy" 166.667 MB/s avg: 1048576 [ 1]"char *" 35.714 MB/s avg: 1048576 [ 2]"short *" 66.667 MB/s avg: 1048576 [ 3]"int *" 142.857 MB/s avg: 1048576 [ 4]"long *" 142.857 MB/s avg: 1048576 [ 5]"long * (4x unrolled)" 142.857 MB/s avg: 1048576 [ 6]"int64 *" 166.667 MB/s avg: 1048576 [ 7]"double *" 0.539 MB/s avg: 1048576 [ 8]"double * (4x unrolled)" 0.540 MB/s
------------------------------------------------------------------ ATOP CPU:Freescale MPC5200B 400M主频
# ./memxferjj-ppc -s 10m 10 0 1 2 3 4 5 6 7 8 avg: 10485760 [ 0]"memcpy" 132.615 MB/s avg: 10485760 [ 1]"char *" 58.949 MB/s avg: 10485760 [ 2]"short *" 88.168 MB/s avg: 10485760 [ 3]"int *" 116.789 MB/s avg: 10485760 [ 4]"long *" 116.770 MB/s avg: 10485760 [ 5]"long * (4x unrolled)" 132.567 MB/s avg: 10485760 [ 6]"int64 *" 132.448 MB/s avg: 10485760 [ 7]"double *" 132.578 MB/s avg: 10485760 [ 8]"double * (4x unrolled)" 132.106 MB/s ------------------------------------------------------------------
成都中嵌科技 CPU:ATMEL9200 180M主频 [root@(none) test]$./memxferjj-AT9200 -s 1m 10 0 1 2 3 4 5 6 7 8 avg: 1048576 [ 0]"memcpy" 52.174 MB/s avg: 1048576 [ 1]"char *" 18.427 MB/s avg: 1048576 [ 2]"short *" 28.416 MB/s avg: 1048576 [ 3]"int *" 42.938 MB/s avg: 1048576 [ 4]"long *" 42.937 MB/s avg: 1048576 [ 5]"long * (4x unrolled)" 44.260 MB/s avg: 1048576 [ 6]"int64 *" 47.847 MB/s avg: 1048576 [ 7]"double *" 47.851 MB/s avg: 1048576 [ 8]"double * (4x unrolled)" 45.380 MB/s
编译后的源代码,欢迎提供其他平台的测试结果:
[ 本帖最后由 chenzhufly 于 2012-5-26 00:37 编辑 ]
|