The moose likes Performance and the fly likes Taking Memory Usage Periodically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Taking Memory Usage Periodically" Watch "Taking Memory Usage Periodically" New topic

Taking Memory Usage Periodically

Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 103


I want to take memory usage within two hours time interval of an enterprise application ?

Sudheer Bhat
Ranch Hand

Joined: Feb 22, 2011
Posts: 75
Do you want to do that in Java?
you can monitor a process via a cron job scheduled to run periodically at 2 hour intervals.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Presumably you are familiar with the java.lang.Runtime methods related to memory, right?

Is that the kind of information you want to record?

Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 103
Actually the scenario is that the application is deployed in JBoss.JBoss will be up and running.Now I want to check the nenory usage details within two hour time interval.Now in linux what I do to take the memory usage is view the content of /proc/meminfo.Once before running the application once after running the application.Now since there are no other application will be running it almost give me a rough estimate of the memory usage of the application.In my local machine I also use VisualVM to do the same.But what I want this process to be automated and run within two hour interval both in Window and Linux environment.
Rishi Shehrawat
Ranch Hand

Joined: Aug 11, 2010
Posts: 218

You can look at -Xloggc option. It will log garbage collection information to seperate file & does not have much overhead. You can use tools like gc viewer to view the file.
I agree. Here's the link:
subject: Taking Memory Usage Periodically
It's not a secret anymore!