<?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>get the number of items in a fcb</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111678/get-the-number-of-items-in-a-fcb</link><description>I need to get the number of items stored in a fcb and there doesn&amp;#39;t seem to be an easy way to get the count from the current read position (fcb_entry struct). 
 Can anyone advise on a good approach? 
 Some solutions I&amp;#39;ve considered: * Use fcb_getnext</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 31 Jul 2024 08:59:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111678/get-the-number-of-items-in-a-fcb" /><item><title>RE: get the number of items in a fcb</title><link>https://devzone.nordicsemi.com/thread/496372?ContentTypeID=1</link><pubDate>Wed, 31 Jul 2024 08:59:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1dee6aa5-8267-4e3f-a117-8fb668e4c1d2</guid><dc:creator>Shahin97</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/dwalks"&gt;dwalks&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;For context, &lt;a class="reference internal" title="fcb_getnext" href="https://docs.zephyrproject.org/latest/services/storage/fcb/fcb.html#c.fcb_getnext"&gt;&lt;code class="xref c c-func docutils literal notranslate"&gt;&lt;span class="pre"&gt;fcb_getnext()&lt;/span&gt;&lt;/code&gt;&lt;/a&gt;,&lt;span&gt;&amp;nbsp;followed by a&amp;nbsp;&amp;nbsp;&lt;a class="reference internal" title="flash_area_read" href="https://docs.zephyrproject.org/latest/services/storage/flash_map/flash_map.html#c.flash_area_read"&gt;&lt;code class="xref c c-func docutils literal notranslate"&gt;&lt;span class="pre"&gt;flash_area_read()&lt;/span&gt;&lt;/code&gt;&lt;/a&gt;&amp;nbsp;takes me about 1ms. Iterating through thousands of records takes a significant amount of time.&lt;br /&gt;&lt;br /&gt;I am looking at reducing this time, my current theory is that the flash IC is sleeping in between reads.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: get the number of items in a fcb</title><link>https://devzone.nordicsemi.com/thread/486867?ContentTypeID=1</link><pubDate>Fri, 31 May 2024 11:01:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5fab371-be6b-4189-8f4b-2d5e498b98c0</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The first option of using fcb_getnext() to iterate through the items sounds like a reasonable approach to me. I have not worked with FCB myself, so I have not tried to profile it, but it doesn&amp;#39;t seem like it should be that slow. Maybe you can time the execution first to see if it&amp;#39;s worth optimizing. You may also want to post this question on Discord(&lt;a href="https://discord.com/invite/Ck7jw53nU2"&gt;https://discord.com/invite/Ck7jw53nU2&lt;/a&gt;) to see if you can get more input on this.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: get the number of items in a fcb</title><link>https://devzone.nordicsemi.com/thread/486674?ContentTypeID=1</link><pubDate>Thu, 30 May 2024 12:50:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64a52a2b-80f0-4d3d-b04b-f8c78a824467</guid><dc:creator>dwalks</dc:creator><description>&lt;p&gt;link to the fcb documentation:&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/latest/services/storage/fcb/fcb.html"&gt;docs.zephyrproject.org/.../fcb.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>