?
Solved

Process List in JAVA

Posted on 2005-03-07
7
Medium Priority
?
4,733 Views
Last Modified: 2010-05-18
Hi all,

I'm trying to build a JAVA application that, among many other things, fetches a list of the system processes currently executing on the machine and their properties (CPU usage, memory, etc). As it is now I'm parsing the result of a command (like ps on UNIX) to find this information. However this seems to be rather ineficient, especially on *NIX systems that typically have over 100 processes executing at a time.
On Windows I'm using another

I've read somewhere (another forum) that JNI would be the best way to do this task... I think I understood what it was but can someone point me out where to start looking for it?
Or can someone suggest another alternative on how to do this?

I'm fully aware of the fact that whatever the solution, it will be very dependent on the Operating System. My design is prepared to deal with that so it's more of an hassle than a problem.

Any help is much appreciated and the points may be increased to reflect that appreciation.
0
Comment
Question by:pauloaguia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 2000 total points
ID: 13475831
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13475832
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13475840
>> and the points may be increased to reflect that appreciation

500 is the max number of points you can give ;-)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 6

Expert Comment

by:durgaprasad_j
ID: 13476130
hi,
          You can use JNI for this , as the above one pointed.
           In windows, I used JNI and PDH  libraries for this same work. [ you could get many more with PDH].

           In linux, I used JNI and read /proc for getting the processes and cpu usage and everything.
           but, in linux, i dont think you need to use any JNI. You can directly read /proc from java itself.

            In windows , you can use PSAPI also. [I know much about this].

Hope this hleps
DP
0
 
LVL 9

Author Comment

by:pauloaguia
ID: 13476306
I had forgotten how fast things work around here ;)

TimYates: That frist link seems promising. I'll have a better look into them later today or maybe tomorrow before accepting any as an answer. I'll be wanting to make up a working example of my own before I can say that either of them is the way to go.

durgaprasad_j: I didn't know what PDH is and I had to take a look around. I don't think that I'll need that, especially since I'd still have to look deeper into it and I'm already charting unknow territory (with JNI). Thanks for the suggestion anyway :)

I'll get back to this later.
0
 
LVL 9

Author Comment

by:pauloaguia
ID: 13486945
As suspected, that first link contained the needed information (still in the process of tweaking it to my needs but I can see I'm on the right track).
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses
Course of the Month8 days, 1 hour left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question