add suspend thread display on mempool command.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@285 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong 2010-01-04 15:30:26 +00:00
parent 9b905b5443
commit 329c44a03f
1 changed files with 49 additions and 38 deletions

View File

@ -234,9 +234,20 @@ int list_mempool()
for (node = list->next; node != list; node = node->next)
{
mp = (struct rt_mempool*)rt_list_entry(node, struct rt_object, list);
rt_kprintf("%-8s %04d %04d %04d %d\n", mp->parent.name,
mp->block_size, mp->block_total_count, mp->block_free_count,
mp->suspend_thread_count);
if (mp->suspend_thread_count > 0)
{
rt_kprintf("%-8s %04d %04d %04d %d:", mp->parent.name,
mp->block_size, mp->block_total_count, mp->block_free_count,
mp->suspend_thread_count);
show_wait_queue(&(mp->suspend_thread));
rt_kprintf("\n");
}
else
{
rt_kprintf("%-8s %04d %04d %04d %d\n", mp->parent.name,
mp->block_size, mp->block_total_count, mp->block_free_count,
mp->suspend_thread_count);
}
}
return 0;
@ -363,24 +374,24 @@ static int str_is_prefix(const char* prefix, const char* str)
void list_prefix(char* prefix)
{
struct finsh_syscall_item* syscall_item;
struct finsh_sysvar_item* sysvar_item;
rt_uint16_t func_cnt, var_cnt;
const char* name_ptr;
func_cnt = 0;
struct finsh_sysvar_item* sysvar_item;
rt_uint16_t func_cnt, var_cnt;
const char* name_ptr;
func_cnt = 0;
var_cnt = 0;
{
struct finsh_syscall* index;
for (index = _syscall_table_begin; index < _syscall_table_end; index ++)
{
if (str_is_prefix(prefix, index->name) == 0)
{
{
if (func_cnt == 0)
rt_kprintf("--function:\n");
func_cnt ++;
/* set name_ptr */
name_ptr = index->name;
rt_kprintf("--function:\n");
func_cnt ++;
/* set name_ptr */
name_ptr = index->name;
#ifdef FINSH_USING_DESCRIPTION
rt_kprintf("%-16s -- %s\n", index->name, index->desc);
@ -396,13 +407,13 @@ void list_prefix(char* prefix)
while (syscall_item != NULL)
{
if (str_is_prefix(prefix, syscall_item->syscall.name) == 0)
{
{
if (func_cnt == 0)
rt_kprintf("--function:\n");
func_cnt ++;
/* set name_ptr */
name_ptr = syscall_item->syscall.name;
func_cnt ++;
/* set name_ptr */
name_ptr = syscall_item->syscall.name;
rt_kprintf("[l] %s\n", syscall_item->syscall.name);
}
syscall_item = syscall_item->next;
@ -413,13 +424,13 @@ void list_prefix(char* prefix)
for (index = _sysvar_table_begin; index < _sysvar_table_end; index ++)
{
if (str_is_prefix(prefix, index->name) == 0)
{
if (var_cnt == 0)
rt_kprintf("--variable:\n");
{
if (var_cnt == 0)
rt_kprintf("--variable:\n");
var_cnt ++;
/* set name ptr */
name_ptr = index->name;
var_cnt ++;
/* set name ptr */
name_ptr = index->name;
#ifdef FINSH_USING_DESCRIPTION
rt_kprintf("%-16s -- %s\n", index->name, index->desc);
@ -435,22 +446,22 @@ void list_prefix(char* prefix)
{
if (str_is_prefix(prefix, sysvar_item->sysvar.name) == 0)
{
if (var_cnt == 0)
rt_kprintf("--variable:\n");
var_cnt ++;
/* set name ptr */
name_ptr = sysvar_item->sysvar.name;
if (var_cnt == 0)
rt_kprintf("--variable:\n");
var_cnt ++;
/* set name ptr */
name_ptr = sysvar_item->sysvar.name;
rt_kprintf("[l] %s\n", sysvar_item->sysvar.name);
}
sysvar_item = sysvar_item->next;
}
/* only one matched */
if ((func_cnt + var_cnt) == 1)
{
rt_strncpy(prefix, name_ptr, strlen(name_ptr));
}
/* only one matched */
if ((func_cnt + var_cnt) == 1)
{
rt_strncpy(prefix, name_ptr, strlen(name_ptr));
}
}