4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-02-28 07:47:21 +08:00

Use precision message output in command list.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2099 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2012-04-23 06:04:12 +00:00
parent da44d15132
commit 209da6823c

View File

@ -79,6 +79,7 @@ static long _list_thread(struct rt_list_node* list)
if (thread->stat == RT_THREAD_READY) rt_kprintf(" ready "); if (thread->stat == RT_THREAD_READY) rt_kprintf(" ready ");
else if (thread->stat == RT_THREAD_SUSPEND) rt_kprintf(" suspend"); else if (thread->stat == RT_THREAD_SUSPEND) rt_kprintf(" suspend");
else if (thread->stat == RT_THREAD_INIT) rt_kprintf(" init "); else if (thread->stat == RT_THREAD_INIT) rt_kprintf(" init ");
else if (thread->stat == RT_THREAD_CLOSE) rt_kprintf(" close ");
ptr = (rt_uint8_t*)thread->stack_addr; ptr = (rt_uint8_t*)thread->stack_addr;
while (*ptr == '#')ptr ++; while (*ptr == '#')ptr ++;
@ -126,13 +127,15 @@ static long _list_sem(struct rt_list_node *list)
sem = (struct rt_semaphore*)(rt_list_entry(node, struct rt_object, list)); sem = (struct rt_semaphore*)(rt_list_entry(node, struct rt_object, list));
if( !rt_list_isempty(&sem->parent.suspend_thread) ) if( !rt_list_isempty(&sem->parent.suspend_thread) )
{ {
rt_kprintf("%-8s %03d %d:", sem->parent.parent.name, sem->value, rt_list_len(&sem->parent.suspend_thread) ); rt_kprintf("%-8.*s %03d %d:", RT_NAME_MAX, sem->parent.parent.name, sem->value,
rt_list_len(&sem->parent.suspend_thread) );
show_wait_queue(&(sem->parent.suspend_thread)); show_wait_queue(&(sem->parent.suspend_thread));
rt_kprintf("\n"); rt_kprintf("\n");
} }
else else
{ {
rt_kprintf("%-8s %03d %d\n", sem->parent.parent.name, sem->value, rt_list_len(&sem->parent.suspend_thread)); rt_kprintf("%-8.*s %03d %d\n", RT_NAME_MAX, sem->parent.parent.name, sem->value,
rt_list_len(&sem->parent.suspend_thread));
} }
} }
@ -159,7 +162,7 @@ static long _list_event(struct rt_list_node *list)
e = (struct rt_event*)(rt_list_entry(node, struct rt_object, list)); e = (struct rt_event*)(rt_list_entry(node, struct rt_object, list));
if( !rt_list_isempty(&e->parent.suspend_thread) ) if( !rt_list_isempty(&e->parent.suspend_thread) )
{ {
rt_kprintf("%-8s 0x%08x %03d\n", e->parent.parent.name, e->set, rt_list_len(&e->parent.suspend_thread)); rt_kprintf("%-8s 0x%08x %03d:", e->parent.parent.name, e->set, rt_list_len(&e->parent.suspend_thread));
show_wait_queue(&(e->parent.suspend_thread)); show_wait_queue(&(e->parent.suspend_thread));
rt_kprintf("\n"); rt_kprintf("\n");
} }
@ -190,7 +193,8 @@ static long _list_mutex(struct rt_list_node *list)
for (node = list->next; node != list; node = node->next) for (node = list->next; node != list; node = node->next)
{ {
m = (struct rt_mutex*)(rt_list_entry(node, struct rt_object, list)); m = (struct rt_mutex*)(rt_list_entry(node, struct rt_object, list));
rt_kprintf("%-8s %-8s %04d %d\n", m->parent.parent.name, m->owner->name, m->hold, rt_list_len(&m->parent.suspend_thread)); rt_kprintf("%-8.*s %-8.*s %04d %d\n", RT_NAME_MAX, m->parent.parent.name,
RT_NAME_MAX, m->owner->name, m->hold, rt_list_len(&m->parent.suspend_thread));
} }
return 0; return 0;