Topic: 怎样得到程序运行期间,CPU和Memory的信息

  Print this page

1.怎样得到程序运行期间,CPU和Memory的信息 Copy to clipboard
Posted by: rostone
Posted on: 2003-11-11 22:28

包括整个操作系统cpu的负载,内存的占用
以及本Java程序的CPU的负载,内存的占用

2.Re:怎样得到程序运行期间,CPU和Memory的信息 [Re: rostone] Copy to clipboard
Posted by: vicious
Posted on: 2003-11-11 22:49

估计这个要调windows API

3.Re:怎样得到程序运行期间,CPU和Memory的信息 [Re: rostone] Copy to clipboard
Posted by: jameszhang
Posted on: 2003-11-12 08:21

应该到System、Runtime对象里找吧!

4.Re:怎样得到程序运行期间,CPU和Memory的信息 [Re: rostone] Copy to clipboard
Posted by: bluecrystal
Posted on: 2003-11-16 15:16

用c/c++写
然后用jni调用

5.Re:怎样得到程序运行期间,CPU和Memory的信息 [Re: rostone] Copy to clipboard
Posted by: pilgrimhuyu
Posted on: 2003-11-17 17:26

如果只是要看虚拟机的内存使用情况可以用
long tr = r.totalMemory();
//Returns the total amount of memory in the Java Virtual Machine.

long fr = r.freeMemory();
//Returns the amount of free memory in the system.

程序如下:
public class ShowMemory
{

  public static void main(String[] args)
  {
    java.lang.Runtime r =java.lang.Runtime.getRuntime();
    long tr = r.totalMemory();
    long fr = r.freeMemory();
    System.out.println("total:"+tr );
    System.out.println("free :"+fr );
  }
}

6.Re:怎样得到程序运行期间,CPU和Memory的信息 [Re: rostone] Copy to clipboard
Posted by: rostone
Posted on: 2003-11-18 09:44

有个teamstudio,大家用过没有

7.Re:怎样得到程序运行期间,CPU和Memory的信息 [Re: rostone] Copy to clipboard
Posted by: wyuanzheng
Posted on: 2003-11-18 13:33

Try JProfiler, which is the best one to your problem.


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923