From 329c44a03f5d3e4256c33b1410b397354ef3da7e Mon Sep 17 00:00:00 2001 From: "bernard.xiong" Date: Mon, 4 Jan 2010 15:30:26 +0000 Subject: [PATCH] add suspend thread display on mempool command. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@285 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- finsh/cmd.c | 87 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 38 deletions(-) diff --git a/finsh/cmd.c b/finsh/cmd.c index 56ecddbb31..e23fc2e6b0 100644 --- a/finsh/cmd.c +++ b/finsh/cmd.c @@ -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)); } }