This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Listing all running threads


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]