[Yaffs] Re: How to calculate the exact ram usage of YAFFS(2)?
Wookey
wookey at aleph1.co.uk
Mon Sep 26 18:07:08 BST 2005
+++ Sven Höhne [05-09-26 16:12 +0200]:
> Hi!
>
> I am curerntly doing some research on YAFFS(2) and would like to
> calculate the exact RAM usage.
That is excllent - people would very much like to be easily able to
calculate this, and as you have discovered, it is currently not an easy
thing to determine.
> For my paper I do need some more information and better values to
> calculate the RAM usage.
> I would like to set up a kind of formula which would allow to calculate
> the RAM usage based on three parameters: NAND size, chunk size and the
> number of files. The calculation shall presuppose, that all space in
> NAND ist used by the given number of files, all of the same size.
>
> I basically came up with this kind of calculation:
>
> RAM usage = number of files * (Space for yaffs_Object + Space for tnode
> structure) + Space always needed (yaffs_Device, program in RAM, etc.)
That looks about right to me. There is some variability in the 'space always
needed' part - e.g. depending on how many yaffs_ShortOp_Caches you define,
for example - each one of those is another page's worth of bytes IIRC.
> For this, I would like to calculate the number of tnodes used for a
> given file size and would need some more info on the size of the
> strucures.
This is a bit complicated. It sounds like you have read
http://www.aleph1.co.uk/yaffs/yaffs-notes.html which is the best
documentation on this. Tnodes are 32bytes each (or at least they were when
the docs were written - check). Each Tnode indicates 16 'pages' (8K), except
that the pages indicated in Tnodes can actually cover up to 4 pages for the
largest YAFFS partitions, so on a big partition each tnode covers 24K
(8K/tnode up to 32Mb partition, 16K/tnode up to 64Mb, 24K/tnode up to 128Mb,
and so on up to 1Gb (I presume - not quite sure about that, nor if this has
changed at all for YAFFS2). Every 8 bottom-level tnodes you need another
2nd-tier Tnode to keep track of those 16. And for every 8 of those you need
a 3rd tier Tnode and so on.
If you haven't read it, this presentation:http://www.aleph1.co.uk/talks/yaffs/
has a useful summary of the RAM data structures, which is rather clearer
than the the info scattered through the other docs.
Charles will no doubt correct any errors in the above.
Wookey
--
Aleph One Ltd, Bottisham, CAMBRIDGE, CB5 9BA, UK Tel +44 (0) 1223 811679
work: http://www.aleph1.co.uk/ play: http://www.chaos.org.uk/~wookey/
More information about the yaffs
mailing list