<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Execution time on nrf52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/44666/execution-time-on-nrf52840</link><description>Hi, 
 What are the options to measure the execution time of code snippets? I used app_timer_cnt_get() now and is giving 50 ticks for 1ms. Is there any way I can measure lesser time?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 12 Mar 2019 16:25:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/44666/execution-time-on-nrf52840" /><item><title>RE: Execution time on nrf52840</title><link>https://devzone.nordicsemi.com/thread/175751?ContentTypeID=1</link><pubDate>Tue, 12 Mar 2019 16:25:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50f8d79f-56f4-41f1-80f7-a1e9f9f4f39c</guid><dc:creator>kirkus</dc:creator><description>&lt;p&gt;The cycle counter works really well for short measurements:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t start;
uint32_t stop;
uint32_t elapsed;

// enable DWT
CoreDebug-&amp;gt;DEMCR |= 0x01000000;

// Reset cycle counter
DWT-&amp;gt;CYCCNT = 0;

// enable cycle counter
DWT-&amp;gt;CTRL |= 0x1;

start = DWT-&amp;gt;CYCCNT;
nrf_delay_ms(1000);
stop = DWT-&amp;gt;CYCCNT;
elapsed = stop-start;
NRF_LOG_INFO(&amp;quot;cycles for nrf_delay_ms(1000) = %u&amp;quot;, elapsed);
// &amp;lt;info&amp;gt; app: cycles for nrf_delay_ms(1000) = 64018002
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execution time on nrf52840</title><link>https://devzone.nordicsemi.com/thread/175329?ContentTypeID=1</link><pubDate>Mon, 11 Mar 2019 13:08:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3648d03a-8bd8-458b-8bd9-ff69d61d2168</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://devzone.nordicsemi.com/tutorials/b/software-development-kit/posts/application-timer-tutorial"&gt;Application timer&lt;/a&gt; use the LFCLK, try using the &lt;a href="https://www.nordicsemi.com/DocLib/Content/Product_Spec/nRF52840/latest/timer?1062#concept_xbd_hqp_sr"&gt;Timer peripheral&lt;/a&gt; instead. It uses the HFCLK.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>