JPDH

Windows Performance Data Helper for Java

License

License

GroupId

GroupId

com.arkanosis
ArtifactId

ArtifactId

jpdh
Last Version

Last Version

1.1.4
Release Date

Release Date

Type

Type

jar
Description

Description

JPDH
Windows Performance Data Helper for Java
Project URL

Project URL

https://jpdh.arkanosis.com/
Source Code Management

Source Code Management

https://github.com/Arkanosis/JPDH/

Download jpdh

How to add to project

<!-- https://jarcasting.com/artifacts/com.arkanosis/jpdh/ -->
<dependency>
    <groupId>com.arkanosis</groupId>
    <artifactId>jpdh</artifactId>
    <version>1.1.4</version>
</dependency>
// https://jarcasting.com/artifacts/com.arkanosis/jpdh/
implementation 'com.arkanosis:jpdh:1.1.4'
// https://jarcasting.com/artifacts/com.arkanosis/jpdh/
implementation ("com.arkanosis:jpdh:1.1.4")
'com.arkanosis:jpdh:jar:1.1.4'
<dependency org="com.arkanosis" name="jpdh" rev="1.1.4">
  <artifact name="jpdh" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.arkanosis', module='jpdh', version='1.1.4')
)
libraryDependencies += "com.arkanosis" % "jpdh" % "1.1.4"
[com.arkanosis/jpdh "1.1.4"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

JPDH — Windows Performance Data Helper for Java Maven Central License

JPDH is a Java library to retrieve performance counter values on Microsoft Windows using the PDH (Performance Data Helper) API and some additional features built on top of it.

Installation

Manually

Add jpdh.jar to your CLASSPATH.

With Maven

<dependency>
  <groupId>com.arkanosis</groupId>
  <artifactId>jpdh</artifactId>
  <version>1.1.4</version>
</dependency>

With Gradle

compile("com.arkanosis:jpdh:1.1.4")

Usage

import com.arkanosis.jpdh.Counter;
import com.arkanosis.jpdh.JPDH;
import com.arkanosis.jpdh.Query;

try (Query query = JPDH.openQuery()) {
	Counter diskCounter = query.addCounter("\\PhysicalDisk(_Total)\\Disk Read Bytes/sec");
	Counter cpuCounter = query.addCounter("\\PID(8584)\\% User Time");
	query.collectData();
	System.out.println(diskCounter.getDoubleValue());
	System.out.println(cpuCounter.getIntegerValue());
	query.removeCounter(diskCounter);
}

Any valid PDH counter path can be used, and additional counter path using the non-PDH “PID” object can be used as well:

\\computer\Process(parent/instance#index)\counter
\\computer\PID(pid)\counter

Build

Run make.

If you don't have a POSIX environment under Windows, you might want to have a look at MSYS2.

Additionally, you may run the test suite using make runtest.

History

  • 2019-09-20: version 1.1.4 — Bugfix release. Counters based on the virtual “PID” object sometimes couldn't be initialized while lots of processes were started of stopped.
  • 2017-09-14: version 1.1.3 — Bugfix release. The virtual “PID” object didn't work on localized (eg. German) versions of Windows.
  • 2016-06-08: version 1.1.2 — Bugfix release. Calling Query.removeCounter(counter) on counters associated with dead processes was throwing an exception.
  • 2016-06-01: version 1.1.1 — Bugfix release. Calling Query.removeCounter(counter) on counters associated with dead processes was throwing an exception.
  • 2016-04-19: version 1.1 — Additional “PID” object which maps to the “Process” object for the right process instance and index
  • 2016-04-01: version 1.0 — Initial version exposing PDH features in Java

Contact

Send an email to Jérémie Roquet [email protected].

License

JPDH is distributed under the BSD license, see the LICENSE file.

Versions

Version
1.1.4
1.1.3