简体   繁体   English

有关进程的Java信息

[英]Java information about process

Suppose I launched new process in JVM using ProcessBuilder. 假设我使用ProcessBuilder在JVM中启动了新进程。 How can get information about memory used by process and CPU time? 如何获取有关进程和CPU时间使用的内存的信息?

General, problem is this: I have a executable, I need to run it with CPUtime and memory restrictions, I need to set up some callbacks which works on event when CPU or memory restrictions failed. 一般,问题是这样的:我有一个可执行文件,我需要在CPU时间和内存限制下运行它,我需要设置一些在CPU或内存限制失败时对事件起作用的回调。 How can I do this in Java? 如何用Java做到这一点?

Thanks in advance 提前致谢

OSHI project could help: OSHI项目可以帮助:

OSHI is a free JNA-based (native) Operating System and Hardware Information library for Java. OSHI是Java的免费基于JNA的(本机)操作系统和硬件信息库。 It doesn't require the installation of any additional native libraries and aims to provide a cross-platform implementation to retrieve system information, such as OS version, processes, memory & CPU usage, disks & partitions, devices, sensors, etc. 它不需要安装任何其他本机库,并且旨在提供一种跨平台的实现来检索系统信息,例如操作系统版本,进程,内存和CPU使用率,磁盘和分区,设备,传感器等。

The feature you're looking for is: 您要寻找的功能是:

Process uptime, cpu, memory usage 进程正常运行时间,CPU,内存使用率

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM