Re: "busy" load counters

From: Albert Cahalan
Date: Sat Sep 13 2003 - 10:52:48 EST


On Sat, 2003-09-13 at 04:36, dada1 wrote:
> From: "Albert Cahalan" <albert@xxxxxxxxxxxxxxxxxxxxx>
> > The feature is available, but you'll need to upgrade
> > to procps-3.1.12 and linux-2.6.0-test4 at least.
> >
> > http://www.kernel.org/pub/linux/kernel/v2.6/
> > http://procps.sf.net/
> >
>
> With procps-3.1.12 and linux-2.6.0-test5, top and ps reports 0.00 time for
> multi-threaded programs.
>
> It seems only the 'main' thread is now visible in /proc, and its cpu time
> dont include the cpu time of other threads...

This is correct. For now, the kernel does not report the
existance of new-style threads. I intend to deal with this
problem during the coming week.

I could use a bit of help with research. If you have access
to a non-Linux system, please let me know how the native ps
and top programs handle threads. I do know that many non-Linux
implementations will group threads together in ps output.

Ways to display all threads include:

ps -m (Tru64, AIX)
ps m (Tru64, AIX)
ps -T (IRIX)
ps -L (Solaris, UnixWare)
ps H (FreeBSD)
ps k (OpenBSD)
ps s (NetBSD)

Examples:
AIX: ps -eo pid,thcount,tid,comm
Solaris: ps -eLf
Tru64: ps -emO THREAD

Please use procps-feedback@xxxxxxxxxxxx for this data.
Here's a program you can use for testing; you may need
to compile it as "cc foo.c -lpthread".

////////////////////////////////////////////
#include <unistd.h>
#include <pthread.h>
void *hanger(void *vp){
(void)vp;
for(;;) pause();
}
int main(int argc, char *argv[]){
pthread_t thread;
(void)argc;
(void)argv;
pthread_create(&thread, NULL, hanger, NULL);
hanger(NULL);
return 0; // keep gcc happy
}
/////////////////////////////////////////////



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/