This is the README for tasks.N.bs.tar.gz [Download] [Browse] [Up]
Here's a program I through together over the weekend. It is a TOP like program that uses the Mach functions to get task and thread info. About 50% of the code was extracted directly from the NeXT on-line manuals. The display is almost exactly like the "ps u" display. The display uses VT control sequences and seems to work under Terminal and Stuart. Usage is: "tasks [n]" where n is the delay between screen updates (default is 3 seconds). NOTE: tasks has to be run by root or setuid to root. The output isn't sorted in any way it just so happens that the tasks get returned in order of increasing PID's. This program works on my single user machine but may have problems on machines with many running tasks because I do not limit the number of tasks that can be displayed (look at the pigs[] array - it has room for 50 entries). REFERENCES To see where I got the info to write this program, look at: /NextLibrary/Documentation/NextDev/OSSoftware/04_CFunctions Tasks.rtf Threads.rtf Hosts.rtf /usr/incude/sys task_info.h thread_info.h table.h BUGS The TTY column doesn't seem to work. If anyone fixes this, please forward the changes to me. The info should be sorted by CPU percentage... I thought of putting the info a linked-list of pig_struct's and doing the sorting when adding new nodes, with a limit of 10-20 entries... The display is an instantaneous snapshot of the CPU state, not an average over the display delay time. That is why tasks itself will appear to be using a lot of CPU - remember that it wasn't running during the delay...
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.