diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2014-08-08 06:33:51 -0400 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2014-08-16 05:15:37 -0400 |
commit | 6ed00870abd566d7267d2436c2693f5a281cda2f (patch) | |
tree | 6011c73e302254fc73f61a1b8b1f295ded1f5d56 /apps/debug_menu.c | |
parent | eb63d8b4a2a7cbe4e98216b48a75391718fcebd7 (diff) | |
download | rockbox-6ed00870abd566d7267d2436c2693f5a281cda2f.tar.gz rockbox-6ed00870abd566d7267d2436c2693f5a281cda2f.zip |
Base scheduler queues off linked lists and do cleanup/consolidation
Abstracts threading from itself a bit, changes the way its queues are
handled and does type hiding for that as well.
Do alot here due to already required major brain surgery.
Threads may now be on a run queue and a wait queue simultaneously so
that the expired timer only has to wake the thread but not remove it
from the wait queue which simplifies the implicit wake handling.
List formats change for wait queues-- doubly-linked, not circular.
Timeout queue is now singly-linked. The run queue is still circular
as before.
Adds a better thread slot allocator that may keep the slot marked as
used regardless of the thread state. Assists in dumping special tasks
that switch_thread was tasked to perform (blocking tasks).
Deletes alot of code yet surprisingly, gets larger than expected.
Well, I'm not not minding that for the time being-- omlettes and break
a few eggs and all that.
Change-Id: I0834d7bb16b2aecb2f63b58886eeda6ae4f29d59
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r-- | apps/debug_menu.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index a11cff9350..61698f5025 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -151,25 +151,21 @@ static const char* threads_getname(int selected_item, void *data, | |||
151 | selected_item -= NUM_CORES; | 151 | selected_item -= NUM_CORES; |
152 | #endif | 152 | #endif |
153 | 153 | ||
154 | const char *fmtstr = "%2d: ---"; | ||
155 | |||
154 | struct thread_debug_info threadinfo; | 156 | struct thread_debug_info threadinfo; |
155 | if (thread_get_debug_info(selected_item, &threadinfo) <= 0) | 157 | if (thread_get_debug_info(selected_item, &threadinfo) > 0) |
156 | { | 158 | { |
157 | snprintf(buffer, buffer_len, "%2d: ---", selected_item); | 159 | fmtstr = "%2d:" IF_COP(" (%d)") " %s" IF_PRIO(" %d %d") |
158 | return buffer; | 160 | IFN_SDL(" %2d%%") " %s"; |
159 | } | 161 | } |
160 | 162 | ||
161 | snprintf(buffer, buffer_len, | 163 | snprintf(buffer, buffer_len, fmtstr, |
162 | "%2d: " IF_COP("(%d) ") "%s " IF_PRIO("%d %d ") "%2d%% %s", | ||
163 | selected_item, | 164 | selected_item, |
164 | #if NUM_CORES > 1 | 165 | IF_COP(threadinfo.core,) |
165 | threadinfo.core, | ||
166 | #endif | ||
167 | threadinfo.statusstr, | 166 | threadinfo.statusstr, |
168 | #ifdef HAVE_PRIORITY_SCHEDULING | 167 | IF_PRIO(threadinfo.base_priority, threadinfo.current_priority,) |
169 | threadinfo.base_priority, | 168 | IFN_SDL(threadinfo.stack_usage,) |
170 | threadinfo.current_priority, | ||
171 | #endif | ||
172 | threadinfo.stack_usage, | ||
173 | threadinfo.name); | 169 | threadinfo.name); |
174 | 170 | ||
175 | return buffer; | 171 | return buffer; |
@@ -187,16 +183,9 @@ static bool dbg_os(void) | |||
187 | { | 183 | { |
188 | struct simplelist_info info; | 184 | struct simplelist_info info; |
189 | simplelist_info_init(&info, IF_COP("Core and ") "Stack usage:", | 185 | simplelist_info_init(&info, IF_COP("Core and ") "Stack usage:", |
190 | #if NUM_CORES == 1 | 186 | MAXTHREADS IF_COP( + NUM_CORES ), NULL); |
191 | MAXTHREADS, | ||
192 | #else | ||
193 | MAXTHREADS+NUM_CORES, | ||
194 | #endif | ||
195 | NULL); | ||
196 | #ifndef ROCKBOX_HAS_LOGF | ||
197 | info.hide_selection = true; | 187 | info.hide_selection = true; |
198 | info.scroll_all = true; | 188 | info.scroll_all = true; |
199 | #endif | ||
200 | info.action_callback = dbg_threads_action_callback; | 189 | info.action_callback = dbg_threads_action_callback; |
201 | info.get_name = threads_getname; | 190 | info.get_name = threads_getname; |
202 | return simplelist_show_list(&info); | 191 | return simplelist_show_list(&info); |