Operational Systems & Java
Video Monitors:
Enumerate and get information on the user s video monitors: bit depth, bounds, and
more...
External Processes:
Create external processes, send basic commands to external processes, obtain the
PSN or HWND of a process you created, and enumerate the currently running
processes...
File Types:
Find applications associated with a given file type, find applications by name, and
convert between Windows file extensions and Mac creator/file type codes...
boruvek
Q: I would like to know if there are any program utilities like top that I can use to
extract each process uptime?
I can t find any info about the /proc/ directory that I can parse to extract the info. I
would be greatly appreciated if any of you can help. Thanks...
Answer: Well you seem to have answered the question yourself: you can use ps or
top command to get the information, but parsing their output can be tedious.
There *is* a man page "proc".
On Linux the files contain text so you can simply read /proc/pid/stat (or
/proc/self/stat) like any ordinary file and read the process times directly. The fields
are described on the man page.
On Linux and other Unix platforms you can use JNI to call getrusage() to get the
process times. This is probably the most portable way to do it.
/gordon
(c)1999, 2000, 2001. JavaFAQ.nu. All rights reserved worldwide.
This document is free for distribution, you can send it to everybody who is interested in Java.
This document can not be changed, either in whole or in part
without the express written permission of the publisher.
All questions please
mailto:info@javafaq.nu
file:///F|/a_jsite/350_tips/os_win_linux.htm (8 of 8) [2001 07 08 11:24:58]
footer
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved