summaryrefslogtreecommitdiff
path: root/apps/debug_menu.c
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2006-09-16 16:18:11 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2006-09-16 16:18:11 +0000
commita85044bf9eaa0a7206c1978d3cfd57ab2d7fae2f (patch)
treea30695ed540bf32365d577f46398f712c7a494c4 /apps/debug_menu.c
parentbaf5494341cdd6cdb9590e21d429920b9bc4a2c6 (diff)
downloadrockbox-a85044bf9eaa0a7206c1978d3cfd57ab2d7fae2f.zip
rockbox-a85044bf9eaa0a7206c1978d3cfd57ab2d7fae2f.tar.gz
rockbox-a85044bf9eaa0a7206c1978d3cfd57ab2d7fae2f.tar.bz2
rockbox-a85044bf9eaa0a7206c1978d3cfd57ab2d7fae2f.tar.xz
New scheduler, with priorities for swcodec platforms. Frequent task
switching should be more efficient and tasks are stored in linked lists to eliminate unnecessary task switching to improve performance. Audio should no longer skip on swcodec targets caused by too CPU hungry UI thread or background threads. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10958 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r--apps/debug_menu.c56
1 files changed, 50 insertions, 6 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 60f405a..bda5a5c 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -80,13 +80,27 @@ extern char ata_device;
extern int ata_io_address;
extern struct core_entry cores[NUM_CORES];
+char thread_status_char(int status)
+{
+ switch (status)
+ {
+ case STATE_RUNNING : return 'R';
+ case STATE_BLOCKED : return 'B';
+ case STATE_SLEEPING : return 'S';
+ case STATE_BLOCKED_W_TMO: return 'T';
+ }
+
+ return '?';
+}
#ifdef HAVE_LCD_BITMAP
/* Test code!!! */
bool dbg_os(void)
{
+ struct thread_entry *thread;
char buf[32];
int i;
int usage;
+ int status;
#if NUM_CORES > 1
unsigned int core;
int line;
@@ -98,24 +112,54 @@ bool dbg_os(void)
while(1)
{
+#if 0 /* Enable to simulate UI lag. */
+ int _x;
+ for (_x = 0; _x < 1000000L; _x++) ;
+#endif
#if NUM_CORES > 1
lcd_puts(0, 0, "Core and stack usage:");
line = 0;
for(core = 0; core < NUM_CORES; core++)
{
- for(i = 0; i < num_threads[core]; i++)
+ for(i = 0; i < MAXTHREADS; i++)
{
- usage = thread_stack_usage_on_core(core, i);
- snprintf(buf, 32, "(%d) %s: %d%%", core, thread_name[core][i], usage);
+ thread = &cores[core].threads[i];
+ if (thread->name == NULL)
+ continue;
+
+ usage = thread_stack_usage(thread);
+ status = thread_get_status(thread);
+
+ snprintf(buf, 32, "(%d) %c%c %d %s: %d%%", core,
+ (status == STATE_RUNNING) ? '*' : ' ',
+ thread_status_char(status),
+ cores[CURRENT_CORE].threads[i].priority,
+ cores[core].threads[i].name, usage);
lcd_puts(0, ++line, buf);
}
}
#else
lcd_puts(0, 0, "Stack usage:");
- for(i = 0; i < cores[CURRENT_CORE].num_threads;i++)
+ for(i = 0; i < MAXTHREADS; i++)
{
- usage = thread_stack_usage(i);
- snprintf(buf, 32, "%s: %d%%", cores[CURRENT_CORE].threads[i].name, usage);
+ thread = &cores[CURRENT_CORE].threads[i];
+ if (thread->name == NULL)
+ continue;
+
+ usage = thread_stack_usage(thread);
+ status = thread_get_status(thread);
+# ifdef HAVE_PRIORITY_SCHEDULING
+ snprintf(buf, 32, "%c%c %d %s: %d%%",
+ (status == STATE_RUNNING) ? '*' : ' ',
+ thread_status_char(status),
+ cores[CURRENT_CORE].threads[i].priority,
+ cores[CURRENT_CORE].threads[i].name, usage);
+# else
+ snprintf(buf, 32, "%c%c %s: %d%%",
+ (status == STATE_RUNNING) ? '*' : ' ',
+ (status == STATE_BLOCKED) ? 'B' : ' ',
+ cores[CURRENT_CORE].threads[i].name, usage);
+# endif
lcd_puts(0, 1+i, buf);
}
#endif