View previous topic :: View next topic |
Author |
Message |
mpe
Joined: 31 Jul 2007 Posts: 13
|
Posted: Thu Aug 07, 2008 2:49 pm Post subject: Fast calculation of free size |
|
|
The DISKFREE() function can be very slow. I have found about 30 s for an nearly empty 2 GB SD-RAM and the CPU running at 7.3 MHz!
Can anybody suggest a faster way to find the size of the free RAM. |
|
Back to top |
|
|
taroosheh
Joined: 16 Mar 2007 Posts: 32 Location: Iran
|
Posted: Sun Sep 28, 2008 8:40 pm Post subject: hi |
|
|
in my project this problem is very bad because this command get 3 seconds or more than
I had to define a long variable and at startup this function called and any times when generate a file or delete add/minus with this variable but this method not very good
I am working on memory allocation table in FAT independence form AVR-DOS maybe this problem solved with any way
good luck
http://www.electrorc.blogfa.com |
|
Back to top |
|
|
oe9vfj
Joined: 17 Jun 2004 Posts: 269 Location: Austria, Hard
|
Posted: Fri Feb 20, 2009 10:12 am Post subject: |
|
|
DISKFREE counts in all FAT-Sectors the free Cluster entries and calculates the Free Disk-space.
The main factor for the time, which DISKFREE needs to do its job is the count of FAT-sectors to check.
I use a 2GB SD-Card from SanDisk (Speed Class 2) and DISKFREE needs less than 1 second to calculate the free Disk space.
This Card is formatted with FAT16 and have 236 FAT-Sectors.
A Card with 2GB formatted in FAT32 have appr. 3800 FAT Sectors. So DISKFREE uses on a FAT32 appr. 16 times the time to get the free disk space.
Cards up to 2GB can be formatted with FAT16.
FAT16 has one disadvantage if you save a lot of very small files. On a 2GB Card the smallest allocation Unit is 32KB, so every File will need at least 32 KB on a 2GB Card formatted with FAT16.
If the majority of your files have 32KB or more, FAT16 will be the better option to format a 2GB Card. _________________ regards Josef
DOS - File System for BASCOM-AVR on http://members.aon.at/voegel |
|
Back to top |
|
|
mpe
Joined: 31 Jul 2007 Posts: 13
|
Posted: Sat May 23, 2009 5:10 pm Post subject: Free size |
|
|
I am more or less forced to use FAT32 as most of my files are about 10k and the maximum size is 24k.
But my problem was wrongly formulated. I am not really interested in the total free space, but I only want to know, if there is free space for the next file. Therefore. I am modifying the routine to check for 100k free space. This is fast and gives the information I need. The needed time is also independant of the total free size, so I can optimize the code. |
|
Back to top |
|
|
anatom
Joined: 06 Dec 2005 Posts: 93
|
Posted: Tue Oct 22, 2013 11:01 am Post subject: Re: Free size |
|
|
mpe wrote: | I am more or less forced to use FAT32 as most of my files are about 10k and the maximum size is 24k.
But my problem was wrongly formulated. I am not really interested in the total free space, but I only want to know, if there is free space for the next file. Therefore. I am modifying the routine to check for 100k free space. This is fast and gives the information I need. The needed time is also independant of the total free size, so I can optimize the code. |
As I have exact same problem I'd ask if you can explain how you modified routine? |
|
Back to top |
|
|
Tiny
Joined: 10 Nov 2010 Posts: 101 Location: The Netherlands
|
Posted: Thu Apr 04, 2019 7:18 am Post subject: |
|
|
Please will you share with you have modified, I also only need to know if there is freespace for the next logfile. |
|
Back to top |
|
|
|