FS#8565 - fix for runtime data causing extra spin ups. Included a debug menu update also.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16330 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Miika Pekkarinen 2008-02-17 18:35:27 +00:00
parent 8140705e99
commit 9eec03faa5
2 changed files with 29 additions and 20 deletions

View file

@ -1913,7 +1913,9 @@ static int database_callback(int btn, struct gui_synclist *lists)
simplelist_addline(SIMPLELIST_ADD_LINE, "Commit delayed: %s",
stat->commit_delayed ? "Yes" : "No");
simplelist_addline(SIMPLELIST_ADD_LINE, "Queue length: %d",
stat->queue_length);
if (synced)
{
synced = false;
@ -1937,7 +1939,11 @@ static bool dbg_tagcache_info(void)
simplelist_info_init(&info, "Database Info", 8, NULL);
info.action_callback = database_callback;
info.hide_selection = true;
info.timeout = TIMEOUT_NOBLOCK;
/* Don't do nonblock here, must give enough processing time
for tagcache thread. */
/* info.timeout = TIMEOUT_NOBLOCK; */
info.timeout = 1;
tagcache_screensync_enable(true);
return simplelist_show_list(&info);
}

View file

@ -57,6 +57,7 @@
#include <stdlib.h>
#include <ctype.h>
#include "config.h"
#include "ata_idle_notify.h"
#include "thread.h"
#include "kernel.h"
#include "system.h"
@ -154,9 +155,6 @@ static struct tagcache_command_entry command_queue[TAGCACHE_COMMAND_QUEUE_LENGTH
static volatile int command_queue_widx = 0;
static volatile int command_queue_ridx = 0;
static struct mutex command_queue_mutex;
/* Timestamp of the last added event, so we can wait a bit before committing the
* whole queue at once. */
static long command_queue_timestamp = 0;
/* Tag database structures. */
@ -3030,26 +3028,16 @@ static bool command_queue_is_full(void)
return (next == command_queue_ridx);
}
void run_command_queue(bool force)
bool command_queue_sync_callback(void)
{
struct master_header myhdr;
int masterfd;
if (COMMAND_QUEUE_IS_EMPTY)
return;
if (!force && !command_queue_is_full()
&& current_tick - TAGCACHE_COMMAND_QUEUE_COMMIT_DELAY
< command_queue_timestamp)
{
return;
}
mutex_lock(&command_queue_mutex);
if ( (masterfd = open_master_fd(&myhdr, true)) < 0)
return;
return false;
while (command_queue_ridx != command_queue_widx)
{
@ -3064,7 +3052,7 @@ void run_command_queue(bool force)
/* Re-open the masterfd. */
if ( (masterfd = open_master_fd(&myhdr, true)) < 0)
return;
return true;
break;
}
@ -3081,7 +3069,20 @@ void run_command_queue(bool force)
close(masterfd);
tc_stat.queue_length = 0;
mutex_unlock(&command_queue_mutex);
return true;
}
void run_command_queue(bool force)
{
if (COMMAND_QUEUE_IS_EMPTY)
return;
if (force || command_queue_is_full())
command_queue_sync_callback();
else
register_ata_idle_func(command_queue_sync_callback);
}
static void queue_command(int cmd, long idx_id, int tag, long data)
@ -3106,7 +3107,9 @@ static void queue_command(int cmd, long idx_id, int tag, long data)
ce->data = data;
command_queue_widx = next;
command_queue_timestamp = current_tick;
tc_stat.queue_length++;
mutex_unlock(&command_queue_mutex);
break;
}