* /proc, PIOCTUSAGE and friends
@ 2000-06-18 18:05 Wai-Sun Chia
0 siblings, 0 replies; only message in thread
From: Wai-Sun Chia @ 2000-06-18 18:05 UTC (permalink / raw)
To: tru64-unix-managers
Hello managers,
I'm have to write an utility which monitors the component threads in an
in-house developed multithreaded application (this is on Tru64 4.0f).
Something akin to ps and vmstat, but for individual threads within an
application...
Basing on proc(4), I've managed to figure out how PIOCNTHR and PIOCTLIST
work. Below is a code snippet:
/* Obtain a list tids for all the active threads */
ioctl(fd, PIOCNTHR, &nbr_thr);
tid = (tid_t *)calloc(nbr_thr, sizeof(tid_t));
ioctl(fd, PIOCTLIST, tid);
for (i = 0; i < nbr_thr; i++) {
printf("tid %d = 0x%lx\n", i, tid[i]);
}
Output is something like:
tid 0 = 0x5
tid 1 = 0x7
tid 2 = 0x9
tid 3 = 0xb
tid 4 = 0xd
tid 5 = 0xf
tid 6 = 0x11
tid 7 = 0x15
Problem is I'm stuck here, as I got no idea how to use the
thread-specific PIOCTSTATUS and the non-documented PIOCTUSAGE (only in
procfs.h) ioctl commands?
Any code samples is very much appreciated..
(I managed to get PIOCSTATUS and PIOCUSAGE working though; i.e. the
process level stuff).
--
Wai-Sun "squidster" Chia
Web/Unix Developer
Professional Services Division
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-06-18 18:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-06-18 18:05 /proc, PIOCTUSAGE and friends Wai-Sun Chia
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox