FS#6761 - Database progress reads above 100%

Attached to Project: Rockbox
Opened by Steve Bavin (pondlife) - Thursday, 08 March 2007, 16:10 GMT
Last edited by amaury pouly (pamaury) - Tuesday, 02 February 2010, 21:10 GMT
Task Type Bugs
Category ID3 / meta data
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


1) Start with the following settings:
System > Disk > Directory Cache : No
Database > Load to RAM : No
> Auto Update : Yes
> Gather Runtime Data : Yes
> Initialise Now

2) Go into Debug > View database info and wait for updating to complete.
Mine displays -1% while counting and ends on Progress: -1% (12477 entries), then commits before resetting to 0% and counting up to 100% (12486 entries). I assume this is an update pass.

3) Now change the setting Database > Load to RAM : Yes

4) Shut down and restart

5) Go into Debug > View database info.
Progress counts up from 0% to 120% (12486 entries)!
This task depends upon

Closed by  amaury pouly (pamaury)
Tuesday, 02 February 2010, 21:10 GMT
Reason for closing:  Not a Bug
Comment by Alan F (alsaf) - Saturday, 10 March 2007, 15:10 GMT
DAP: H120
Version: r12579-070304

I have similar results. In step 2, the count is 4106 entries but 4115 on commit. In step 5 Progress counts to 144% with 4115 entries.
Comment by Alan F (alsaf) - Sunday, 11 March 2007, 11:13 GMT
I think the numbers are coming from get_progress() function in line 3864 of tagcache.c

The total is dependent of pre=processors (apologies if this is wrong, I haven't done C in years). If HAVE_DIRCACHE is defined the total is got from the entry count returned by dircache_get_entry_count() in dircache.c. If HAVE_TC_RAMCACHE is defined, things start to get a bit complicated. The total is set by the following if statement:

if (hdr && tc_stat.ramcache)
total_count = hdr->h.tch.entry_count;

My knowledge of C as mentioned is basic and of rockbox absolutely nill but hopefully this will give a start to somebody with more knowledge than myself to identify problem.
Comment by Alan F (alsaf) - Sunday, 11 March 2007, 11:56 GMT
I repeated tests again with Load to Ram yes & directory cache set to no before intitalising database and at end the progress was 144%.

I then did test with Load to Ram no & directory cache set to yes before initalising database and at end the progress was 97%.
Comment by Alan F (alsaf) - Monday, 12 March 2007, 17:59 GMT
I may be picking this up wrong but the progress is a percentage of database entries over number of directory entries (files plus folders) This is from the line 3895 in tagcache.c

The processed_dir_count variable is a count of all folders and file in the DAP hard drive (as obtained from the opendir_cached function in dirchache.c). This is done in the check_dir function (in tagcache.c).

For this to be an accurate percentage the process_dir_count will need to be a count of music files only?

Comment by Marc Guay (Marc_Guay) - Thursday, 03 April 2008, 05:17 GMT
Just ran through the recipe on the e200 w/ r16929 and got "2197% (2417 entries)".
Comment by Clément Pit--Claudel (CFP) - Friday, 03 October 2008, 20:30 GMT
I think this task is related to  FS#8982  (Database update progress stuck to -1%) :
Comment by amaury pouly (pamaury) - Tuesday, 02 February 2010, 21:10 GMT
The debug menu is for developers and is not supposed to provide helpful informations for normal users ;)