Skip to content

Latest commit

ย 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

FastMouseLogger 0.1.0 [ALPHA] โ€” Native Raw Mouse Logging, Stream Compression & Heatmap Engine

Status License: MIT Java Platform JitPack


โšก High-performance raw mouse input logger, microsecond .mousebin dual-format streaming engine, and ARGB heatmap generator for Java.

FastMouseLogger captures raw Windows mouse input directly via FastMouse (WM_INPUT bypass of OS ballistics), compresses events in real-time into binary .mousebin logs using FastFileFormat & FastBinary, and computes high-resolution behavioral heatmaps and click density distributions.


Quick Start

import fastmouselogger.*;
import java.awt.image.BufferedImage;
import java.nio.file.Path;
import java.util.List;

public class Demo {
    public static void main(String[] args) throws Exception {
        Path logDir = Path.of("logs/mouse");

        // 1. Live background capture
        try (FastMouseLogger logger = new FastMouseLogger(logDir, 5000)) {
            logger.addListener(rec -> {
                if (rec.isButtonPress()) {
                    System.out.printf("Click at t=%d flags=0x%02X\n", rec.timestamp(), rec.flags());
                }
            });

            logger.start();
            Thread.sleep(3000);
            logger.stop(); // Flushes to timestamped .mousebin
        }

        // 2. High-speed FastFileFormat codec & heatmap rendering
        Path sessionFile = logDir.resolve("session.mousebin");
        List<MouseEventRecord> events = MousebinCodec.readFromFile(sessionFile);
        BufferedImage heatmap = HeatmapGenerator.generate(events, 1920, 1080);
    }
}

Key Features

  • ๐Ÿ–ฑ๏ธ Win32 Raw Input Interception โ€” Sub-millisecond direct mouse capture bypassing OS cursor smoothing via FastMouse.
  • โšก FastFileFormat .mousebin Compression โ€” Delta-timestamped VarInt event serialization (Payload ID 0x0003).
  • ๐Ÿ”ฅ Hardware-Accelerated Heatmap Generation โ€” High-speed ARGB accumulator and rasterizer for movement trajectories and click hotspots.
  • ๐Ÿ”„ Zero GC Pressure โ€” Contiguous memory buffers, reusable event records, and batch disk flush pipelines.
  • ๐Ÿ“ฆ Zero Heavy Dependencies โ€” Native-speed pure Java 17+ core backed by FastCore, FastBinary, and FastFileFormat.

Real-World Scenarios

  • ๐Ÿค– AI Agent Behavioral Recording โ€” Logging human mouse interaction trajectories for imitation learning and GUI robot training.
  • ๐ŸŽฎ Esports & Aim Analytics โ€” Tracking raw sensor deltas, acceleration curves, and click latencies in gaming environments.
  • ๐Ÿ“Š UX & Usability Heatmaps โ€” Visualizing user attention hotspots and click distributions on desktop applications.
  • ๐Ÿ›ก๏ธ Biometric Telemetry โ€” Capturing fine-grained micro-movement signatures for desktop authentication.

Performance Benchmarks

FastMouseLogger is profiled using JMH to guarantee maximum stream throughput and zero dropped input packets.

Benchmark Operation Score (ops/ms) Event Throughput Memory Overhead
Binary Stream Decoding (.mousebin) ~75,000 ops/ms > 75 Million events/sec Zero-Copy Streaming
Binary Stream Encoding (.mousebin) ~50,000 ops/ms > 50 Million events/sec Compact VarInt Delta Buffer
Heatmap Rasterization (800x600 ARGB) ~550 ops/sec 550 Full HD Frames/sec Direct Pixel Buffer Writing

Run the benchmarks locally: .\run-benchmark.bat


API Quick Reference

Method / Class Description
new FastMouseLogger(path, threshold) Creates a logger flushing every N records into timestamped .mousebin files.
logger.start() / logger.stop() Starts and stops native raw mouse event recording.
logger.addListener(listener) Subscribes to real-time mouse movement and click callbacks.
MousebinCodec.encode(events) Serializes event list into compressed FastFileFormat binary byte array.
MousebinCodec.decode(bytes) Deserializes .mousebin binary bytes back into List<MouseEventRecord>.
HeatmapGenerator.generate(events, w, h) Renders ARGB density heatmap BufferedImage from mouse records.

Technical Examples & Hero Demos

Case Java Example Launcher Description
Live Mouse Streamer & Heatmap Demo Demo.java run-demo.bat 3-second live raw recording, .mousebin encoding/decoding, and ARGB heatmap generation.
JMH Microbenchmark Suite Benchmark.java run-benchmark.bat High-throughput encoding/decoding benchmarks and heatmap rasterization speed.

Installation

Option 1: Maven (JitPack)

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>FastMouseLogger</artifactId>
        <version>0.1.0</version>
    </dependency>
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>FastMouse</artifactId>
        <version>0.1.0</version>
    </dependency>
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>FastFileFormat</artifactId>
        <version>0.1.0</version>
    </dependency>
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>FastBinary</artifactId>
        <version>0.1.0</version>
    </dependency>
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>fastcore</artifactId>
        <version>0.1.0</version>
    </dependency>
</dependencies>

Option 2: Gradle (via JitPack)

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.andrestubbe:FastMouseLogger:0.1.0'
    implementation 'com.github.andrestubbe:FastMouse:0.1.0'
    implementation 'com.github.andrestubbe:FastFileFormat:0.1.0'
    implementation 'com.github.andrestubbe:FastBinary:0.1.0'
    implementation 'com.github.andrestubbe:fastcore:0.1.0'
}

Option 3: Direct Download (No Build Tool)

Download the latest JARs directly to add them to your classpath:

  1. ๐Ÿ–ฑ๏ธ FastMouseLogger-0.1.0.jar (Mouse Logger & Heatmap Engine)
  2. โšก FastMouse-0.1.0.jar (Native Win32 Raw Mouse Input)
  3. ๐Ÿ“„ FastFileFormat-0.1.0.jar (Dual Binary & Text File Format)
  4. โšก FastBinary-0.1.0.jar (VarInt & Binary Packing)
  5. โš™๏ธ fastcore-0.1.0.jar (Foundation Library)

Documentation


Platform Support

Platform Status
Windows 10/11 (x64) โœ… Fully Supported (Win32 Raw Input)
Linux ๐Ÿšง Planned (evdev / XInput2)
macOS ๐Ÿšง Planned (CGEventTap)

License

MIT License. See LICENSE file for details.


Related Projects

  • FastMouse โ€” Ultra-low latency raw mouse capture for Windows
  • FastKeyboard โ€” Low-level raw keyboard event interceptor
  • FastKeylogger โ€” Biometric typing cadence and keystroke logger
  • FastFileFormat โ€” Universal dual-format binary & text document engine
  • FastSharedMemory โ€” Zero-copy inter-process shared memory for Java

Part of the FastJava Ecosystem โ€” Making the JVM faster. Small package. Maximum speed. Zero bloat. ๐Ÿš€๐Ÿ“‹

About

๐Ÿ–ฑ๏ธ High-speed raw mouse input logger, microsecond .mousebin dual-format stream compressor, and heatmap engine for Java.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages