本程序主要用来计算DMA数据读写过程中所花费的总得时间周期,依据公式T=tStart+ceil(L/4)*2+ceil(L/256)*tTransform*2

因为tTransform是一个常量(通常默认为11),因此只需根据debug文件分析出tStart即可。

一开始我以为tStart是一个变量,是buffer2-2(读)的开始时刻与准备时刻最后一个buffer2-17(写)的差值,因此写了

以下程序:

 #*************************************************************************

     # File Name: performance_testing.py
# Author: jiangjing
# Mail: jjdl@mail.ustc.edu.cn
# Created Time: Sat 15 Jul 2017 09:34:04 PM PDT
#************************************************************************\
import math
import sys def GetFirstBuffer2_2(path):
fDebug=open(path).read()
index2_2=fDebug.index("[buffer2-2]")
index_space=fDebug.index(" ",index2_2+17)
return [index2_2,fDebug[index2_2+17:index_space]] def GetLastBuffer2_17(path,index2_2):
fDebug=open(path).read()
index2_17=fDebug.rindex("[buffer2-17]",0,index2_2)
index_space=fDebug.index(" ",index2_17+18)
return [index2_17,fDebug[index2_17+18:index_space]] def GetTotalTime(L,path,tTransform=11): #the 'path' is the paht of debug file
buffer2_2=GetFirstBuffer2_2(path)
buffer2_17=GetLastBuffer2_17(path,buffer2_2[0])
return int(buffer2_2[1])-int(buffer2_17[1])+math.ceil(L/4)+math.ceil(L/256)*tTransform*2 #the code just for debug,you can comment the following code
if __name__=='__main__':
if(len(sys.argv)>1):
print(GetTotalTime(int(sys.argv[1]),sys.argv[2]))

但师兄说其实tStart也是一个常量,所以又将程序简化了以下:

 #*************************************************************************
# File Name: PerformanceTesting.py
# Author: jiangjing
# Mail: jjdl@mail.ustc.edu.cn
# Created Time: Sun 16 Jul 2017 06:12:22 AM PDT
#************************************************************************
import math tStart=2448
def GetTime(L,tTransform=11):
return tStart+math.ceil(L/4)+math.ceil(L/256)*tTransform*2 def GetTotalTime(lList):
totalTime=0
for l in lList:
L=l[4]
totalTime+=GetTime(L)
return totalTime

下面的这个test.py为测试样例:

 #*************************************************************************
# File Name: test.py
# Author: jiangjing
# Mail: jjdl@mail.ustc.edu.cn
# Created Time: Sun 16 Jul 2017 06:18:24 AM PDT
#************************************************************************
import PerformanceTesting as PT lList=[[0,0,0,0,65555],[0,0,0,0,672323]]
print(PT.GetTotalTime(lList))

考虑到测试的便捷性,师兄建议我采用c语言进行编写。

 一下为C语言版本代码:

 #include"stdio.h"
#include"math.h"
#include"conv2_route_plan.c"
#include"route_plan.h"
#define uint32_t unsigned long uint32_t tStart=;
uint32_t GetTime(uint32_t L){
return tStart+ceil(L/)*+ceil(L/)**;
} uint32_t GetTotalTime(route_plan_t lList){
uint32_t totalTime=;
uint32_t i;
for(i=;i<lList.num_item;i++)
{
totalTime+=GetTime(lList.route_item_array[i].len);
}
return totalTime;
} int main()
{
printf("%d\n",GetTotalTime(conv2_route_plan));
return ;
}

  其中“route_plan.h“是从师兄的项目中拷下来的,里面定义了输出数据的格式。

 #ifndef _ROUTE_PLAN_H_
#define _ROUTE_PLAN_H_ #include <stdint.h> typedef struct {
uint32_t src_buffer_id;
uint32_t src_buffer_offset;
uint32_t dest_buffer_id;
uint32_t dest_buffer_offset;
size_t len;
} route_item_t; typedef struct {
uint32_t num_item;
route_item_t* route_item_array;
} route_plan_t;
#endif // #ifndef _ROUTE_PLAN_H_

  其中“conv2_route_plan.c”文件是main.py文件运行输出的结果之一,里面包含了计算计算clock必要的数据。通过改变dsp的数目,本文件中的数据也会发生变化。

以下是dsp=32时的数据情况:

#include "route_plan.h"

route_item_t conv2_route_item_array[] = {
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
{, 0.0, , 462848.0, 57856.0},
{, 347136.0, , 0.0, 57856.0},
{, 0.0, , 57856.0, 404992.0},
};
route_plan_t conv2_route_plan = {
.num_item = ,
.route_item_array = conv2_route_item_array
};

  

最后的测试结果如下表:

DMA性能测试的更多相关文章

  1. 【STM32H7教程】第62章 STM32H7的MDMA,DMA2D和通用DMA性能比较

    完整教程下载地址:http://www.armbbs.cn/forum.php?mod=viewthread&tid=86980 第62章       STM32H7的MDMA,DMA2D和通 ...

  2. Arduino Due, Maple and Teensy3.0 的 W5200性能测试

    开源平台中以太网连接方案里W5100是众所周知的,W5200正在此领域越来越受欢迎.这个测试结果是在Arduino Due(Atmel CortexM3-84Mhz), Maple(ST Cortex ...

  3. 6款实用的硬盘、SSD固态硬盘、U盘、储存卡磁盘性能测试工具

    一.检测工具名称汇总 HDTune ATTO Disk Benchmark CrystalDiskMark AS SSD Benchmark Parkdale CrystalDiskInfo 二.各项 ...

  4. Ignite性能测试以及对redis的对比

    测试方法 为了对Ignite做一个基本了解,做了一个性能测试,测试方法也比较简单主要是针对client模式,因为这种方法和使用redis的方式特别像.测试方法很简单主要是下面几点: 不作参数优化,默认 ...

  5. 性能测试工具 wrk 安装与使用

    介绍 今天给大家介绍一款开源的性能测试工具 wrk,简单易用,没有Load Runner那么复杂,他和 apache benchmark(ab)同属于性能测试工具,但是比 ab 功能更加强大,并且可以 ...

  6. .NET Core性能测试组件BenchmarkDotNet 支持.NET Framework Mono

    .NET Core 超强性能测试组件BenchmarkDotNet 支持Full .NET Framework, .NET Core (RTM), Mono. BenchmarkDotNet支持 C# ...

  7. C#中实现并发的几种方法的性能测试

    C#中实现并发的几种方法的性能测试 0x00 起因 去年写的一个程序因为需要在局域网发送消息支持一些命令和简单数据的传输,所以写了一个C/S的通信模块.当时的做法很简单,服务端等待链接,有用户接入后开 ...

  8. STM32基于HAL库通过DMA读写SDIO

    通过STM32CUBEMX生成DMA读写sdio的工程,再读写过程中总会卡死在DMA中断等待读写完成的while中,最终发现while等待的标志在SDIO的中断里置位的,而SDIO中断优先级如果小于或 ...

  9. 「视频直播技术详解」系列之七:直播云 SDK 性能测试模型

    ​关于直播的技术文章不少,成体系的不多.我们将用七篇文章,更系统化地介绍当下大热的视频直播各环节的关键技术,帮助视频直播创业者们更全面.深入地了解视频直播技术,更好地技术选型. 本系列文章大纲如下: ...

随机推荐

  1. JQuery调用iframe子页面函数/对象的方法

    父页面有个ID为mainfrm的iframe,iframe连接b.html,该页面有个函数test 在父页面调用b.html的test方法为: $("#mainfrm")[0].c ...

  2. 总结近期CNN模型的发展(一)---- ResNet [1, 2] Wide ResNet [3] ResNeXt [4] DenseNet [5] DPNet [9] NASNet [10] SENet [11] Capsules [12]

    总结近期CNN模型的发展(一) from:https://zhuanlan.zhihu.com/p/30746099 余俊 计算机视觉及深度学习   1.前言 好久没有更新专栏了,最近因为项目的原因接 ...

  3. openfire XML流

    XML流 概览 两个基本概念,XML流和XML节,使得在出席信息已知的实体之间,异步交换低负载的结构化信息成为可能.这两个术语定义如下: XML流的定义:一个XML流是一个容器,包含了两个实体之间通过 ...

  4. css:before和after中的content属性

    css有一个属性叫做content.content只能使用在:after和:before之中.它用于在元素之前或者元素之后加上一些内容 就像这样: .email-address:before { co ...

  5. springAOP原理以及概念

    需求:1.拦截所有业务方法2.判断用户是否有权限,有权限就让他执行业务方法,没有权限就不允许执行.(是否有权限是根据user是否为null作为判断依据) 思考: 我们该如何实现? 思路1: 我们在每个 ...

  6. <opengl>使用glu绘制二次曲面

    绘制二次曲面通常要以下四步:   1.首先我们创建一个二次方程状态对象 GLUquadricObj *m_pObj;    //保存绘图模式.法线模式.法线朝向.纹理等信息 //创建二次方程状态对象 ...

  7. VIJOS:P1082丛林探险

    描述 东非大裂谷中有一片神秘的丛林,是全世界探险家的乐园,著名黄皮肤探险家BB一直想去试试.正好我国科学家2005年4月将首次对东非大裂谷进行科考,BB决定随科考队去神秘丛林探险.在出发之前,他搜集了 ...

  8. TCP 协议的消息

    TCP: SYN ACK FIN RST PSH URG 详解 TCP的三次握手是怎么进行的了:发送端发送一个SYN=1,ACK=0标志的数据包给接收端,请求进行连接,这是第一次握手:接收端收到请求并 ...

  9. Advanced R之数据结构

    看了几本R语言语法相关的书籍,感觉都不怎么好,在实际使用过程中仍然遇到很多难以理解的问题,后来看了Hadley Wickham的Advanced R,好多问题迎刃而解,今天重温了该书的第一章即数据结构 ...

  10. Exception in thread "main" java.lang.NoClassDefFoundError: antlr/ANTLRException 解决方法

    转自:https://blog.csdn.net/gengkunpeng/article/details/6225286?utm_source=blogxgwz4 1. struts2.3.15 hi ...