7 Replies Latest reply: May 4, 2010 6:09 AM by 843798 RSS

    profiling java process

    843798
      Hi,

      I have application that run on different operation system (Windows,Linux,Solaris).
      I need to get the cpu and memory usage for the process.
      I am using Java1.6 .

      How can I find the cpu usage for the process ?

      can I run the jconsole programaly and get the info it collect ?

      Thanks
        • 1. Re: profiling java process
          791266
          idan72 wrote:
          Hi,

          I have application that run on different operation system (Windows,Linux,Solaris).
          I need to get the cpu and memory usage for the process.
          I am using Java1.6 .

          How can I find the cpu usage for the process ?

          can I run the jconsole programaly and get the info it collect ?

          Thanks
          From within the application, or from another application? Many operating systems has tools that can give you cpu usage.

          Kaj
          • 2. Re: profiling java process
            843798
            Hi,

            I have 2 java application.
            One of them is executing and monitor the other (Can execute the second application several times).
            The applications run on windows,linux,sun.

            I need to get the numbers so I can used them and not tool like jconsole.
            • 3. Re: profiling java process
              843798
              idan72 wrote:
              I need to get the numbers so I can used them and not tool like jconsole.
              JConsole simply uses JMX to query other running VMs for those numbers. You can do the same.
              • 4. Re: profiling java process
                843798
                How can I find with JMX the values of process cpu usage and overall cpu usage for windows also
                • 5. Re: profiling java process
                  843798
                  idan72 wrote:
                  How can I find with JMX the values of process cpu usage
                  For any random non-VM process? I don't think you can
                  and overall cpu usage for windows also
                  I don't think you can.

                  You'll need to use OS-specific libraries for that (probably via JNI/JNA). I'm sure there are existing third-party libraries for this.
                  • 6. Re: profiling java process
                    843798
                    I need to know the cpu usage of java process.
                    Do you know how JConsole do that ?
                    • 7. Re: profiling java process
                      843798
                      idan72 wrote:
                      I need to know the cpu usage of java process.
                      Do you know how JConsole do that ?
                      Via JMX, I already told you that. There's a ManagementMBean for that. Google for it.