From: Wai-Sun Chia <waisun.chia () msa ! dec ! com>
To: tru64-unix-managers
Subject: /proc, PIOCTUSAGE and friends
Date: Sun, 18 Jun 2000 18:05:39 +0000 [thread overview]
Message-ID: <96135161508741.tru64-unix-managers.marc@archive.invalid> (raw)
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
reply other threads:[~2000-06-18 18:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox