TracySocketClient — This is a Java SDK for sending profiler events.
(zones, frames, frames, and other markers) in the native Tracy Profiler
via an intermediate TCP server Tracy Socket Server.
This project implements a convenient layer for profiling Java applications.,
Minecraft mods (Forge / NeoForge/Fabric) and any real-time JVM programs without the need to write a JNI/JNA implementation
- 📡 Sending the
StartZoneEvent/EndZoneEventzones - 🧩 Support for frames (
MarkFrameEvent) - 🧵 Support for multiple threads (
Thread.currentThread().getId()) - ⚙️ Flexible serialization system (
SerializerRegister,ProfilerSerializer) - 💬 Extensible events (
NetworkEventbase class) - 📦 Without third - party dependencies — only Java SE 17+
dev.sdm.profiler/
├── buffer/
│ └── SharedBuffer.java ← binary buffer with auto-indexing
├── events/
│ ├── NetworkEvent.java ← basic interface
│ ├── StartZoneEvent.java ← the beginning of the zone
│ ├── EndZoneEvent.java ← end of the zone
│ └── MarkFrameEvent.java ← frame mark
├── network/
│ ├── TcpClient.java ← TCP client, message queue
│ ├── SerializerRegister.java ← registry of serializers
│ ├── Serializers.java ← serializer interface
│ └── ProfilerSerializer.java ← a common event serializer
└── TracyProfiler.java ← high-level API for profiling
On the C++ side (see Tracy Socket Server):
TracySocketServer.exe
[C++] Server listening on port 9001...TracyProfiler.startConnection();
[Java] Connected to TracySocketServer server- Launch Tracy.exe
- Click Connect → 127.0.0.1
public class Example {
public static void main(String[] args) throws Exception {
try {
TracyProfiler.startConnection();
TracyProfiler.startZone("LoadWorld");
Thread.sleep(100);
TracyProfiler.startZone("GenerateTerrain");
Thread.sleep(50);
TracyProfiler.endZone();
TracyProfiler.endZone();
TracyProfiler.markFrame();
TracyProfiler.disconnect();
} catch(Exception e) {
e.printStackTrace();
}
}
}The Java client serializes the data into a binary buffer and sends it over TCP.
On the C++ side, the TracySocketServer' receives and translates them into real ScopedZone` Tracy objects.
TracySocketClient — developed as part of the BehindTheScenery / SDM Team project for profiling JVM parts of the BTS Engine