主要内容

删除从执行时间测量仪器管理费用

改善执行分析确定的硬件上运行的生成的代码,您可以运行processor-in-the-loop(公益诉讼)模拟,自动过滤与代码插装相关的开销。您可以使用目标硬件估计的平均开销值或可以手工指定的值。

请注意

默认情况下,软件过滤器的执行时间AUTOSAR运行时环境(RTE)代码和功能,在仿真软件中运行金宝app®例如,函数调用者块。

方法估计和消除仪器开销

建立公益诉讼的目标连接模拟时,您可以指定对象或函数估计和删除从执行测量仪器管理费用。

您可以:

  • 建立一个基准测试程序,仿真软件运行指定的次数在公益诉讼的开始模拟金宝app。基准程序估计开销计时器API和计时器冻结和解冻,任务和工具代码的函数。金宝app仿真软件得到仪表管理费用的平均值。

  • 手动指定仪器开销值。

在公益诉讼仿真,仿真软件减去仪表开销值执行测量。金宝app仿真数据检查和代码执行分析报告显示修正测量值。

此图显示了未修正的和纠正计时器值对应于调用的代码部分。

纠正计时器值不包括执行时间与仪表相关代码,RTE代码,功能仿真软件中运行的代码。金宝app

估计和删除从执行测量仪器管理费用:

  • 如果设立的公益诉讼连接使用目标包,使用开销类的包。

  • 如果设立的公益诉讼连接使用rtw.connectivity.Config类,使用功能的类。

删除仪器管理费用通过使用目标方案

提供仪器的软件开销值,使用这些方法之一:

  • 设置基准程序,估计开销值。

  • 使用开销类,手动指定开销值。

建立基准测试程序

当你设置目标连接,执行以下步骤:

  1. 检索target.Processortarget.Timer对象。

    处理器= target.get (“处理器”,myProcessorObjectId);计时器= target.get (“定时器”,myTimerObjectId);

  2. 创建一个target.ProfilingTaskOverhead对象。

    taskOverhead = target.create (“ProfilingTaskOverhead”,“名字”,计时器任务开销的);taskOverhead。计数器=定时器;taskOverhead。MinimumBenchmarkIterations = 150;

  3. 将开销值与处理器。

    处理器。管理费用= taskOverhead;

指定的开销值

当你设置目标连接类对象,并使用,创建开销价值属性指定的值对应的设备开销。

  1. 检索target.Processortarget.Timer对象。

    处理器= target.get (“处理器”,myProcessorObjectId);计时器= target.get (“定时器”,myTimerObjectId);

  2. 创建一个target.ProfilingTaskOverhead对象。

    taskOverhead = target.create (“ProfilingTaskOverhead”,“名字”,计时器任务开销的);taskOverhead。值= 10;taskOverhead。计数器=定时器;

  3. 创建一个target.ProfilingFunctionOverhead对象。

    functionOverhead = target.create (“ProfilingFunctionOverhead”,“名字”,定时器函数的开销的);functionOverhead。值= 20;functionOverhead。计数器=定时器;

  4. 创建一个target.ProfilingFreezingOverhead对象。

    freezingOverhead = target.create (“ProfilingFreezingOverhead”,“名字”,计时器冻结开销的);freezingOverhead。值= 30;freezingOverhead。计数器=定时器;

  5. 将开销值与处理器。

    处理器。管理费用=[taskOverhead, functionOverhead freezingOverhead];

删除仪器管理费用的使用功能rtw.connectivity.Config

rtw.connectivity.Config类提供了这些函数的仪表管理费用。

函数 描述

activateOverheadFiltering

obj。activateOverheadFiltering (价值);如果值是激活的过滤仪表管理费用真正的。如果值是启动开销,过滤

isOverheadFilteringActive

obj.isOverheadFilteringActive返回真正的如果仪器开销过滤被激活。否则,返回

runOverheadBenchmark

obj.runOverheadBenchmark (价值);如果值是运行基准测试程序真正的。如果值是不运行的基准程序

isOverheadBenchmarkExecuted

obj.isOverheadBenchmarkExecuted;返回真正的如果执行基准测试程序就完成了。否则,返回

setOverheadBenchmarkSteps

obj.setOverheadBenchmarkSteps (步骤);指定数量的基准程序的步骤。

getOverheadBenchmarkSteps

步骤= obj.getOverheadBenchmarkSteps返回指定的数量为基准程序步骤。

setOverheads

obj.setOverheads (taskInstrumentationOverhead,functionInstrumentationOverhead,freezingInstrumentation);指定任务的开销值,函数,分别和冷冻设备。

getOverheads

(taskInstrumentationOverhead,functionInstrumentationOverhead,freezingInstrumentation)= obj.getOverheads;返回任务的开销值,函数,分别和冷冻设备。

当你设置目标连接公益诉讼的模拟,通过一个配置的仪器管理费用rtw.connectivity.Config子类。例如,这个代码显示了如何运行基准测试程序。

classdefoverheadConnectivityConfig < rtw.connectivity.Config方法函数这= customConnectivityConfig (componentArgs)%创建生成器targetApplicationFramework =mypil.TargetApplicationFramework (componentArgs);builder = rtw.connectivity.MakefileBuilder (componentArgs,targetApplicationFramework,);%创建发射器发射器= mypil。发射器(componentArgs builder);%建立沟通hostCommunicator = rtw.connectivity.RtIOStreamHostCommunicator (componentArgs,发射器,rtiostreamLibTCPIP);%调用超类构造函数注册组件this@rtw.connectivity.Config (componentArgs建筑工人,发射器,hostCommunicator);%注册特定于硬件定时器,使%代码执行分析。这个示例使用%计时器主机平台。计时器= coder.profile.crlHostTimer ();this.setTimer(计时器);%指定删除分析仪器管理费用this.activateOverheadFiltering(真正的);this.runOverheadBenchmark(真正的);this.setOverheadBenchmarkSteps (50);结束结束结束

而不是运行基准测试程序,您可以使用setOverheads为仪器提供你的价值观开销。

使用手动指定值%去除仪器开销this.activateOverheadFiltering(真正的);这一点。setOverheads (taskInstrumentationOverheadfunctionInstrumentationOverhead freezingInstrumentation);

检索基准测试结果

公益诉讼模拟完成时,您可以从您指定的变量检索基准测试结果代码生成>验证>工作空间变量字段(CodeExecutionProfileVariable),例如,myExecutionProfile

benchmarkResults = myExecutionProfile.getOverheadBenchmarkData ();

benchmarkResults是一个结构,包含代码插装开销值。

> > benchmarkResults ans =结构体字段:TimestampOverhead: [1×1 struct] TaskOverhead: [1×1 struct] FunctionOverhead: [1×1 struct] FreezingOverhead: 1×1结构> > benchmarkResults。TaskOverhead ans =结构体字段:数据:[1×100 uint64] NumSamples: 100平均:45.2800

另请参阅

||||

相关的话题