deamon help
Scott Lurndal
scott at convergent.com
Fri Feb 8 09:14:39 AEST 1991
|> In article <2304 at inews.intel.com> bhoughto at hopi.intel.com (Blair P. Houghton) writes:
|> >In article <BZS.91Feb5105600 at world.std.com> bzs at world.std.com (Barry Shein) writes:
|> >>For a problem like this I'll bet you a nickel crafting the whole thing
|> >>in C using /dev/kmem etc will not be much faster than the above
|> >>described script, and will take a week to get right instead of 30 minutes.
|> >
|> >Better, use popen(3) and top(1). Top usually gets the data
|> >much faster than ps. Why? Who knows? Could be anything
|> >from superior skills among public-domain software developers
|> >to abuse of /dev/null.
|>
Actually the best solution would be to use the /proc file system code if you
have a SVR4.0 system. Use opendir(3)/readdir(3) to fetch each process number,
open it, issue a PIOCPSINFO ioctl(2), and close it. The PIOCPSINFO ioctl(2) will
return the system and user times in seconds and nanoseconds (amongst other things).
This should be sufficient resolution to determine whether the process
is really doing anything.
Be aware that although the resolution of the field is in nanoseconds,
some systems may only support micro or milli-second resolution.
Scott.
More information about the Comp.unix.programmer
mailing list