<?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>Measuring code execution time</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/20515/measuring-code-execution-time</link><description>hi, 
 I would like to do some code profiling and measure execution time.
What is a lowest possible resolution for the counter is possible to achieve and how? 
 I am currently using RTC counter nrf_drv_rtc_counter_get() but have read that is not nessecery</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 16 Mar 2017 16:10:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/20515/measuring-code-execution-time" /><item><title>RE: Measuring code execution time</title><link>https://devzone.nordicsemi.com/thread/79983?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 16:10:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e37b6f9c-2844-4512-ab52-36fedf2ca29d</guid><dc:creator>Larry</dc:creator><description>&lt;p&gt;I see, to the highest resolution I can get is 30.517 μs using the RTC and the best option for more precise measurements is a logical analyzer.&lt;/p&gt;
&lt;p&gt;I would need to connect LA to GPIO and measure between toggle on/off.&lt;/p&gt;
&lt;p&gt;Sounds great Kristin!&lt;/p&gt;
&lt;p&gt;Tack så mycket!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Measuring code execution time</title><link>https://devzone.nordicsemi.com/thread/79984?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 10:38:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:abbb4424-d2b7-40f9-b846-0bb7244a7c45</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;The resolution of the RTC depends on the prescaler, see &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Frtc.html&amp;amp;cp=2_2_0_24&amp;amp;anchor=concept_rvn_vkj_sr"&gt;this&lt;/a&gt; section in the Product Specification (PS).&lt;/p&gt;
&lt;p&gt;A TIMER using the HFCLK will have higher resolution, see &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Ftimer.html&amp;amp;cp=2_2_0_23&amp;amp;anchor=concept_xbd_hqp_sr"&gt;this&lt;/a&gt; section in the PS.&lt;/p&gt;
&lt;p&gt;Another option is to toggle a GPIO right before and right after the code where you want to measure the  execution time, and then measure the execution time using a logic analyzer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>