Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Diskfree() performance

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR-DOS
View previous topic :: View next topic  
Author Message
chipperia

Bascom Member



Joined: 25 Mar 2006
Posts: 13

blank.gif
PostPosted: Sun Mar 26, 2006 12:26 pm    Post subject: Diskfree() performance Reply with quote

I'm building a data logger on a 1 GB SD, and wondering about the best file structure (need to record about 10 kB of data every second or so).
I think that deeply nested directory should make file access easier and more faster, especially if each directory contains a limited number of files in order to keep its size within one sector.

For example, making different subdirectories for year, month, day, hour, minute, and at last a different data file for each second should grant file retriaval after accessing new sectors about 5 or 6 times (Y+M+D+H+M = 5); is that assumption correct?

Next step is to detect when the card is (almost) full, in order to delete automatically some of older files to make space for fresh data.
Is Diskfree() suitable for this use? My guess is it works scanning the FAT, which can take quite long especially for FAT32 volumes.

Any suggestion for a quick-and-dirty way for estimating disk occupation?
Back to top
View user's profile
oe9vfj

Moderator



Joined: 17 Jun 2004
Posts: 269
Location: Austria, Hard

austria.gif
PostPosted: Mon Mar 27, 2006 10:17 am    Post subject: Reply with quote

You are right. DiskFree is scanning the FAT Sectors for free marked cluster entries.
On a FAT16 partition there is a maximum of appr. 250 FAT Sectors. On a FAT32 partition you have much more FAT-Sectors to scan.

With FAT16 you have in root-directory 'only' 512 directory entries. Please consider, that a long file name (not supported from AVR-DOS) occupies several directory entries. With a FAT16 on a 1GB partition you have a cluster-size of 16KB, so small files always occupies storage size of 16KB on the card.
In a sub-directory you have on FAT16 and FAT32 in AVR-DOS a limit of 65530 directory entries.
I hope this information helps to plan your application.

_________________
regards Josef

DOS - File System for BASCOM-AVR on http://members.aon.at/voegel
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR-DOS All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum