[ECOS] Listing all running threads

NavEcos ecos@navosha.com
Tue Oct 29 14:00:00 GMT 2002


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



More information about the Ecos-discuss mailing list