This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Listing all running threads
- From: NavEcos <ecos at navosha dot com>
- To: "Tom Davis" <tdavis at telesyn dot com>,<ecos-discuss at sources dot redhat dot com>
- Date: Tue, 29 Oct 2002 14:07:53 -0800
- Subject: Re: [ECOS] Listing all running threads
- Organization: Navosha
- References: <000b01c27f5a$142776b0$3e0810ac@telesyn.corp>
- Reply-to: ecos at navosha dot com
On Tuesday 29 October 2002 06:47 am, Tom Davis wrote:
> Hi,
>
> I need to create a utility that lists all the running threads on a card
> much like the VxWorks "I" command. I have searched a great deal and
> cannot seem to find a means to get a list of all the threads.
>
> Any ideas?
>
> Thanks,
>
> Thomas Davis
This will do something like what you want. It polls the stack sizes. It
shows you how to walk the threads anyhow:
-Rich
----------------------snip-----------------
Cyg_Thread
*cygThread;
diag_printf ("Thread list\n");
diag_printf ("ThreadID : Stk Size : Used : Unused : Name\n");
diag_printf
("--------=|=--------=|=--------=|=--------=|=----------------\n
");
for (cygThread = Cyg_Thread::get_list_head() ; cygThread != NULL ;
cygThread = cygThread->get_list_next())
{
diag_printf ("%08lx : %08lx : %08lx : %08lx : %s\n",
(u32)cygThread,
cygThread->get_stack_size(),
cygThread->measure_stack_usage(),
cygThread->get_stack_size() - cygThread->measure_stack_usage(),
cygThread->get_name()==NULL?NULL:cygThread->get_name());
}
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss