Windows performance counters from java

匆匆过客 提交于 2021-01-29 04:21:38

问题


I'm looking for a way to get performance counters from Windows Performance monitor in Java program. I know it's pretty easy to get this counters in .NET or PowerShell. Who knows is it possible in Java?


回答1:


See Access Windows Performance Monitor counters from Java:

"For those running Java applications or services, the Windows Performance Monitor (WPM) contains a treasure trove of valuable information—see Figure 1. There are hundreds (or thousands) of performance statistics called counters that are available in real time and measure critical system performance factors. This article outlines a simple way to access those performance statistics from Java."

Three options are presented:

  1. Configure WPM to log specific performance counters: WPM can take a configurable set of counters and log them to a file on a configured frequency. Windows XP and Windows 2003 also allow WPM data to be logged directly to an ODBC (Open Database Connectivity) datasource. Once this data has been logged to its final destination, it should be trivial enough to read the logging file using the java.io or java.nio packages.
  2. Native (Java Native Interface) interface to WPM
  3. NSClient4j is a pure Java client that provides a simple API for accessing WPM performance counter data. It uses a Windows service called NSClient.

The recommended approach appears to be option 3 ...



来源:https://stackoverflow.com/questions/25035543/windows-performance-counters-from-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!