<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic iMXRT: Profiling and Execution Speed in Model-Based Design Toolbox (MBDT)</title>
    <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/iMXRT-Profiling-and-Execution-Speed/m-p/1461064#M7331</link>
    <description>&lt;P&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/177536"&gt;@stefancinipeanu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I use MBDT to measure the execution speed of the iMXRT MCU? (Like the Profiler Block in the S32 MBDT Toolbox.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;</description>
    <pubDate>Thu, 19 May 2022 17:59:07 GMT</pubDate>
    <dc:creator>Sam_ECU</dc:creator>
    <dc:date>2022-05-19T17:59:07Z</dc:date>
    <item>
      <title>iMXRT: Profiling and Execution Speed</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/iMXRT-Profiling-and-Execution-Speed/m-p/1461064#M7331</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/177536"&gt;@stefancinipeanu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I use MBDT to measure the execution speed of the iMXRT MCU? (Like the Profiler Block in the S32 MBDT Toolbox.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 17:59:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/iMXRT-Profiling-and-Execution-Speed/m-p/1461064#M7331</guid>
      <dc:creator>Sam_ECU</dc:creator>
      <dc:date>2022-05-19T17:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: iMXRT: Profiling and Execution Speed</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/iMXRT-Profiling-and-Execution-Speed/m-p/1461368#M7335</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/189467"&gt;@Sam_ECU&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, for IMXRT Toolbox we don`t have support for Profiling blocks, but you can measure execution time in PIL simulation directly from Simulink. You can do this by going on &lt;STRONG&gt;Hardware settings&lt;/STRONG&gt; tab in your model and then&amp;nbsp;&lt;STRONG&gt;Configuration Parameters -&amp;gt; Code Generation -&amp;gt; Verification -&amp;gt; Code Profiling&lt;/STRONG&gt; and enable &lt;STRONG&gt;Measure execution time&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stefancinipeanu_0-1653030387173.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/180382i993FC3AED0FF4EBA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stefancinipeanu_0-1653030387173.png" alt="stefancinipeanu_0-1653030387173.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;After that, you can go to&amp;nbsp;&lt;STRONG&gt;Configuration Parameters -&amp;gt; Hardware Implementation -&amp;gt; Profiling Timers&amp;nbsp;&lt;/STRONG&gt;to choose which timer you want to use to measure execution and there are 2 options: PIT or GPT timer.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stefancinipeanu_1-1653030912689.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/180384i9FEA6BF82E8A81B6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stefancinipeanu_1-1653030912689.png" alt="stefancinipeanu_1-1653030912689.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But you have to enable these settings in top model and also in the referenced models.&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Stefan.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 07:17:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/iMXRT-Profiling-and-Execution-Speed/m-p/1461368#M7335</guid>
      <dc:creator>stefancinipeanu</dc:creator>
      <dc:date>2022-05-20T07:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: iMXRT: Profiling and Execution Speed</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/iMXRT-Profiling-and-Execution-Speed/m-p/1461593#M7336</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/189467"&gt;@Sam_ECU&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even if we do not support the profiling blocks, I have a sort of approach to measure execution time. For this, you can use the GPT, which is an up-counting timer.&amp;nbsp;The workflow on code perspective would be this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;GPT_StartTimer(GPT_instance);

/* code_to_be_measured */

ticks = GPT_GetCurrentTimerCount(GPT_instance);

GPT_StopTimer(GPT_instance);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you can put your algorithm you want to measure the time of execution in a subsystem, then you have to add the blocks for starting and stopping the GPT and the Timer Counter Value block to get the ticks from the timer.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stefancinipeanu_1-1653044007064.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/180431i69A0D6E1B85BA11A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stefancinipeanu_1-1653044007064.png" alt="stefancinipeanu_1-1653044007064.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In Simulink, to generate the code in the way described upper, you have to put priorities to the blocks. So the &lt;STRONG&gt;TimerStart&lt;/STRONG&gt; block has priority 0, &lt;STRONG&gt;Subsystem_To_Measure&lt;/STRONG&gt; has priority 1, &lt;STRONG&gt;TimerCounterValue&lt;/STRONG&gt; block has priority 2 and &lt;STRONG&gt;TimerStop&lt;/STRONG&gt; block has priority 3. To put priorities for each block/subsystem, you have to right-click on a block/subsystem, go to &lt;STRONG&gt;Properties...&lt;/STRONG&gt; and introduce the priority in the &lt;STRONG&gt;Priority&lt;/STRONG&gt; field.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stefancinipeanu_0-1653043934517.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/180430iA5418F65896E9E53/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stefancinipeanu_0-1653043934517.png" alt="stefancinipeanu_0-1653043934517.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In the mex file attached to the model, you have to set the GPT timer to run in &lt;STRONG&gt;Free Run Mode&lt;/STRONG&gt; in order to let the Timer to count to the maximum value (0xFFFFFFFF) and also enable &lt;STRONG&gt;Reset counter when re-enabled&lt;/STRONG&gt; checkbox in order to reset the current counter value to 0 when the GPT_StopTimer function is called.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stefancinipeanu_2-1653044387815.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/180432iB62EFF4B405E6445/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stefancinipeanu_2-1653044387815.png" alt="stefancinipeanu_2-1653044387815.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The current counter value is put in &lt;STRONG&gt;ticks&lt;/STRONG&gt; data memory store and it can be visualized in the FreeMASTER project attached.&lt;/P&gt;
&lt;P&gt;I have also attached the model. You can check it and see if it suits for your application.&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Stefan.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 11:28:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/iMXRT-Profiling-and-Execution-Speed/m-p/1461593#M7336</guid>
      <dc:creator>stefancinipeanu</dc:creator>
      <dc:date>2022-05-20T11:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: iMXRT: Profiling and Execution Speed</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/iMXRT-Profiling-and-Execution-Speed/m-p/1461739#M7338</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/177536"&gt;@stefancinipeanu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the response I'll look into it.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 15:17:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/iMXRT-Profiling-and-Execution-Speed/m-p/1461739#M7338</guid>
      <dc:creator>Sam_ECU</dc:creator>
      <dc:date>2022-05-20T15:17:09Z</dc:date>
    </item>
  </channel>
</rss>

