You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**⚡ Zero-overhead native hardware telemetry for Java. Monitor CPU usage, CPU temperature, RAM, and GPU temperature directly via Win32 PDH and WMI — no JMX, no process spawning, no bloat.**
9
+
---
10
+
11
+
**⚡ Zero-overhead native hardware telemetry for Java.**
10
12
11
-
**FastHardware** bypasses the JVM's heavy `OperatingSystemMXBean` and shell-based `wmic` calls entirely. By binding directly to Win32 PDH counters and WMI COM objects via JNI, it delivers accurate, low-latency hardware telemetry at native speed.
13
+
**FastHardware** gives your Java application direct access to real-time system health — CPU usage, CPU temperature, physical RAM, and GPU temperature — without shelling out to `wmic`, without polling `OperatingSystemMXBean`, and without spawning background processes. By binding directly to Win32 PDH counters and WMI COM objects via JNI, it delivers accurate, low-latency hardware telemetry at native speed.
14
+
15
+
[**Watch the Demo (YouTube)**](https://www.youtube.com/watch?v=BZsqQl7WqWk)
Standard Java approaches to hardware monitoring have fundamental limitations when used in production:
74
+
75
+
-**`OperatingSystemMXBean`**: Only provides a 1-minute rolling load average (`getSystemLoadAverage()`) — not real-time CPU usage. Has no temperature, no per-core data, and no physical RAM (only JVM heap).
76
+
-**`Runtime.freeMemory()`**: Reports JVM heap free memory only — completely unrelated to OS-level physical RAM.
77
+
-**`wmic` / process spawning**: Executes a child process per call. Startup overhead is ~100–300 ms per query, utterly unsuitable for polling loops.
78
+
-**No thermal sensor API**: Java has zero built-in access to CPU or GPU temperature. There is no standard API — full stop.
32
79
33
-
-**📊 Real-Time Telemetry** — CPU usage %, per-core CPU usage, CPU temperature, physical RAM, GPU temperature.
34
-
-**⚡ Native Win32 Speed** — PDH counters (`\\Processor(_Total)\\% Processor Time`) registered once, polled in microseconds. RAM via `GlobalMemoryStatusEx` (direct kernel table read). Temperature via WMI `MSAcpi_ThermalZoneTemperature` in `ROOT\WMI`.
35
-
-**🧊 Zero Overhead** — All JNI calls use primitives (`jlong`, `jdouble`, `jdoubleArray`). No heap allocation per query.
36
-
-**📦 Atomic Snapshot** — `getSnapshot()` returns a frozen `HardwareSnapshot` record with all fields captured in a single native round-trip.
37
-
-**🔌 FastCore Auto-Load** — `fasthardware.dll` is embedded in the JAR. `FastCore` extracts and loads it at runtime — no manual DLL management.
80
+
**FastHardware** solves all of these by going directly to the OS:
81
+
82
+
-**True CPU Usage**: PDH counter `\\Processor(_Total)\\% Processor Time` — registered once at startup, polled in microseconds for every subsequent call. Real-time, not delayed.
83
+
-**Physical RAM**: Win32 `GlobalMemoryStatusEx` — a direct kernel memory table read in nanoseconds, returns actual OS-level free and total physical RAM.
84
+
-**Temperature**: WMI `MSAcpi_ThermalZoneTemperature` in the `ROOT\WMI` namespace — native ACPI thermal zone readings via COM without any process spawn.
85
+
-**Per-Core CPU**: One PDH counter per logical core, all polled in a single JNI call, returned as a `double[]`.
38
86
39
87
---
40
88
41
-
## Quick Start
89
+
## Key Features
90
+
91
+
-**📊 Real-Time Telemetry** — CPU%, per-core CPU%, CPU temperature, physical free RAM, total RAM, GPU temperature.
92
+
-**⚡ Native Win32 Speed** — PDH counters registered once, polled in microseconds. RAM via `GlobalMemoryStatusEx`. Temperatures via WMI ACPI.
93
+
-**🧊 Zero Heap Allocation** — All JNI calls use primitives (`jlong`, `jdouble`, `jdoubleArray`). No objects allocated per query. GC-invisible hot path.
94
+
-**📦 Atomic Snapshot** — `getSnapshot()` captures all fields in a single native round-trip and returns a frozen `HardwareSnapshot` record.
95
+
-**🔌 Auto-Loading Native** — `fasthardware.dll` is embedded inside the JAR. `FastCore` extracts and loads it automatically at runtime — no manual DLL path management.
96
+
-**🖥️ Ecosystem Ready** — Integrates cleanly into the FastJava ecosystem. Feed telemetry into `FastAgent`, drive adaptive quality in `FastAnimation`, or gate resource-intensive `FastGPU` kernels.
97
+
98
+
---
99
+
100
+
## Real-Life Examples
101
+
102
+
**System Health Dashboard** — poll every 500 ms and print live data:
103
+
```java
104
+
FastHardware hw =FastHardware.create();
105
+
hw.getSnapshot(); Thread.sleep(1100); // warm up PDH
System.out.printf("⚠ Core %d overloaded: %.1f%%%n", i, cores[i]);
139
+
}
140
+
}
59
141
```
60
142
61
-
> [!IMPORTANT]
62
-
> PDH CPU counters require **two collection intervals** to compute a rate. Call `hw.getSnapshot()` once, wait ~1 second, then read real values. FastHardware handles this automatically after the first poll.
143
+
---
144
+
145
+
## Performance Benchmarks
146
+
147
+
FastHardware is profiled using **JMH** against standard Java equivalents. Run `run-benchmark.bat` for live numbers.
| CPU temperature | ❌ Not available |**WMI ACPI `ROOT\WMI`**| FastHardware exclusive |
156
+
| GPU temperature | ❌ Not available |**WMI (discrete GPUs)**| FastHardware exclusive |
157
+
158
+
> [!NOTE]
159
+
> CPU temperature accuracy depends on BIOS ACPI implementation. Intel integrated GPU platforms may report static ACPI thermal zone values — this is a firmware limitation, not a FastHardware bug. Discrete NVIDIA/AMD GPUs and desktop motherboards typically provide continuously updating values.
160
+
161
+
*Measured on Windows 11, Intel Core i5-1135G7 (Surface Pro 8), JDK 21.0.12.*
| CPU temperature | ❌ No API |**WMI `ROOT\WMI` ACPI sensor**|**FastHardware exclusive**|
109
-
| GPU temperature | ❌ No API |**WMI discrete GPU sensor**|**FastHardware exclusive**|
110
-
111
-
*Run `run-benchmark.bat` for live JMH throughput numbers on your machine.*
112
-
113
-
---
114
-
115
197
## Examples & Demos
116
198
117
-
| Case |File| Launcher | Description |
118
-
|------|------|----------|-------------|
119
-
|**Live Terminal Dashboard**|[Demo.java](examples/Demo/src/main/java/fasthardware/Demo.java)|`run-demo.bat`| ANSI terminal monitor — CPU%, CPU°C, RAM, GPU°C as live bars + scrolling sparklines. Pure FastHardware, no extra deps. |
120
-
|**JMH Benchmark Suite**|[Benchmark.java](examples/Benchmark/src/main/java/fasthardware/benchmark/Benchmark.java)|`run-benchmark.bat`| 7-group JMH throughput suite comparing FastHardware native vs Java JMX/Runtime. |
199
+
| Case |Java Example| Launcher | Description |
200
+
|------|--------------|----------|-------------|
201
+
|**Live Terminal Dashboard**|[Demo.java](examples/Demo/src/main/java/fasthardware/Demo.java)|`run-demo.bat`| ANSI terminal monitor — CPU%, CPU°C, RAM, GPU°C as neon bars + scrolling sparklines. Pure FastHardware, no extra deps. |
202
+
|**JMH Benchmark Suite**|[Benchmark.java](examples/Benchmark/src/main/java/fasthardware/benchmark/Benchmark.java)|`run-benchmark.bat`| 7-group JMH throughput suite — FastHardware native vs Java JMX/Runtime across all telemetry dimensions. |
121
203
122
204
---
123
205
124
206
## Installation
125
207
126
208
### Option 1: Maven (Recommended)
127
-
Add the JitPack repository and the dependencies to your `pom.xml`:
209
+
210
+
Add the JitPack repository and the dependency to your `pom.xml`:
128
211
129
212
```xml
130
213
<repositories>
@@ -141,8 +224,7 @@ Add the JitPack repository and the dependencies to your `pom.xml`:
141
224
<artifactId>FastHardware</artifactId>
142
225
<version>0.1.1</version>
143
226
</dependency>
144
-
145
-
<!-- FastCore (Required Native Loader) -->
227
+
<!-- FastCore — Required Native JNI Loader -->
146
228
<dependency>
147
229
<groupId>com.github.andrestubbe</groupId>
148
230
<artifactId>FastCore</artifactId>
@@ -152,6 +234,7 @@ Add the JitPack repository and the dependencies to your `pom.xml`:
152
234
```
153
235
154
236
### Option 2: Gradle (via JitPack)
237
+
155
238
```groovy
156
239
repositories {
157
240
maven { url 'https://jitpack.io' }
@@ -164,24 +247,23 @@ dependencies {
164
247
```
165
248
166
249
### Option 3: Direct Download (No Build Tool)
250
+
167
251
1. 📦 **[FastHardware-0.1.1.jar](https://github.com/andrestubbe/FastHardware/releases/download/0.1.1/FastHardware-0.1.1.jar)** — The Core Library
168
-
2. ⚙️ **[FastCore-0.1.0.jar](https://github.com/andrestubbe/FastCore/releases/download/0.1.0/fastcore-0.1.0.jar)** — The Mandatory Native Loader
> Both JARs must be on your classpath. FastCore extracts `fasthardware.dll` to `%USERPROFILE%\.fastcore\native\` at runtime.
255
+
> Both JARs must be on your classpath. `FastCore` extracts `fasthardware.dll` to `%USERPROFILE%\.fastcore\native\fasthardware\` at runtime automatically.
172
256
173
257
---
174
258
175
259
## Documentation
176
260
177
-
| File | Description |
178
-
|------|-------------|
179
-
|[ARCHITECTURE.md](docs/ARCHITECTURE.md)| Win32 PDH, WMI COM, and JNI boundary details. |
180
-
|[REFERENCE.md](docs/REFERENCE.md)| Full API specification and JNI contracts. |
181
-
|[COMPILE.md](docs/COMPILE.md)| Build guide for the native DLL from source. |
182
-
|[PHILOSOPHY.md](docs/PHILOSOPHY.md)| Why native-first telemetry matters in Java. |
183
-
|[CHANGELOG.md](docs/CHANGELOG.md)| Version history. |
184
-
|[ROADMAP.md](docs/ROADMAP.md)| Future development milestones. |
261
+
***[ARCHITECTURE.md](docs/ARCHITECTURE.md)**: Win32 PDH, WMI COM bridge, and JNI boundary architecture.
262
+
***[REFERENCE.md](docs/REFERENCE.md)**: Full API specification and JNI contracts.
263
+
***[COMPILE.md](docs/COMPILE.md)**: Build guide for compiling the native DLL from C++ source.
264
+
***[PHILOSOPHY.md](docs/PHILOSOPHY.md)**: Why native-first telemetry matters for Java performance monitoring.
265
+
***[CHANGELOG.md](docs/CHANGELOG.md)**: Version history and release notes.
0 commit comments