【问题标题】:Is it possible to get information about an item in the Processes tab of the Task Manager (Windows)是否可以在任务管理器的“进程”选项卡中获取有关项目的信息(Windows)
【发布时间】:2012-09-06 07:24:36
【问题描述】:

我想知道是否可以获得有关正在运行的进程的信息(如内存使用情况),这些信息通常可以在 Windows 任务管理器的“进程”选项卡中看到。 如果是,有什么方法可以使用 java 吗?

【问题讨论】:

标签: java windows operating-system taskmanager


【解决方案1】:

Windows 有一个名为 tasklist 的命令,可以为您提供

Image Name                     PID Session Name        Session#    Mem Usage

您可以使用Runtime.getRuntime().exec("tasklist.exe") 阅读该信息。

类似这样的:

Process process = Runtime.getRuntime().exec("tasklist.exe");
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while((line = reader.readLine()) != null){
    System.out.println(line);
}

【讨论】:

  • @Ameoo:很高兴为您提供帮助 :) 但是,您可能还想看看 SIGAR APIs 以及
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-07-30
  • 2016-01-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多