来自java的Windows性能计数器 [英] Windows performance counters from java

查看:75
本文介绍了来自java的Windows性能计数器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种从 Java 程序中的 Windows 性能监视器获取性能计数器的方法.我知道在 .NET 或 PowerShell 中获取这个计数器非常容易.谁知道在 Java 中可以实现吗?

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?

推荐答案

参见 从 Java 访问 Windows 性能监视器计数器:

对于那些运行 Java 应用程序或服务的人来说,Windows 性能监视器 (WPM) 包含宝贵信息的宝库——请参见图 1.有数百(或数千)个称为计数器的实时可用的性能统计信息,并且衡量关键的系统性能因素.本文概述了一种从 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."

提供了三个选项:

  1. 配置 WPM 以记录特定的性能计数器:WPM 可以采用一组可配置的计数器并将它们以配置的频率记录到文件中.Windows XP 和 Windows 2003 还允许将 WPM 数据直接记录到 ODBC(开放数据库连接)数据源.将此数据记录到其最终目的地后,使用 java.io 或 java.nio 包读取日志文件应该就足够了.
  2. WPM 的本机(Java 本机接口)接口
  3. NSClient4j 是一个纯 Java 客户端,它提供了一个用于访问 WPM 性能计数器数据的简单 API.它使用名为 NSClient 的 Windows 服务.

推荐的方法似乎是选项 3 ...

The recommended approach appears to be option 3 ...

这篇关于来自java的Windows性能计数器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆