[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hpux-devtools
Subject:    RE: HPUX-DEVTOOLS: RE: CXX-DEV: Thread Counting
From:       "VUPPULA,HIMABINDU (HP-Cupertino,ex1)" <himabindu.vuppula () hp ! com>
Date:       2002-12-17 21:01:09
[Download RAW message or body]

>  I don't think there is a way to find about the number of
> user threads without using ttrace and knowledge of the internals
> the MxN libpthread implementation. gdb should be able to do so.

pstat call cannot report the number of user threads in the system in an MxN
threaded application.
gdb gives a list of all (kernel and user) threads for MxN threaded
applications. You should be able to figure out from the info threads output
whether a particular thread is only user thread, only kernel thread or both.
By default, gdb does not report 'only kernel threads' via info threads
output. User can request them to be reported by setting "set
show-all-threads 1".


> One consequence
> > of using ttrace(), tusc or any of the debuggers is that you 
> will get an
> > additional thread the first time any of these attach. So, 
> don't be surprised
> > if you have one more than you expect if this is the case.
> 
>  However I don't think this thread is made visible to ttrace
> clients (via GET_FIRST_LWP_STATE/GET_NEXT_LWP_STATE). 

That's true. gdb is unaware of such a thread that might have been created
with attach. It does not show any extra threads.

-Bindu

> 
>  This leads to the questions (to Prashun):
>  - what is it exactly that you'd like to know:
>     - # of kernel threads (all)
>     - # of kernel threads (executing application code only)
>     - # of user threads
>     - # of user threads (excluding 'service' threads)
> 
>  - in what circumstances do you want this information ?
>     - is it for debugging purposes only ?
>     - how often (once a day, every millisecond, ...) ?
>     - how much overhead is tolerable ?
>     - is using gdb (manually or via a script) acceptable ?
>     - is getting this information worth losing thread performance
>       for _all_ threaded applications (by forcing the pthread library
>       to inform the kernel at every thread creation/termination) ?
>       (hard to imagine, but it's worth asking)
> 
>  Regards - Eric
> 
> > 
> > Tool wise, glance can also tell you the thread count.
> > 
> > > -----Original Message-----
> > > From: STREIBER,MARIO (HP-Germany,ex2) 
> [mailto:mario_streiber@hp.com]
> > > Sent: 17 December 2002 11:59
> > > To: hpux-devtools@cxx.cup.hp.com; cxx-dev@cxx.cup.hp.com
> > > Subject: RE: CXX-DEV: Thread Counting
> > >
> > >
> > > > Do we have any tool or technique by which we can find
> > > number of Posix
> > > > threads attached to a process externally.
> > >
> > > You could attach to the process with gdb or tusc.
> > >
> > > I think there is also a pstat(2) call which can tell you 
> the number of
> > > threads of a process. You could write your own program using
> > > pstat()...
> > >
> > > Mario
> > >  _________________________________________________________________
> > >  To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
> > >     with the message UNSUBSCRIBE cxx-dev
> > >  _________________________________________________________________
> > >
> >  _________________________________________________________________
> >  To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
> >     with the message UNSUBSCRIBE hpux-devtools
> >  _________________________________________________________________
> 
> -- 
> Eric Gouriou                             egouriou@cup.hp.com
>  _________________________________________________________________
>  To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
>     with the message UNSUBSCRIBE hpux-devtools
>  _________________________________________________________________
> 
 _________________________________________________________________
 To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
    with the message UNSUBSCRIBE hpux-devtools
 _________________________________________________________________
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic