Capture Java and loaded mod identity in client and server comparisons

This commit is contained in:
Ludovic Marie
2026-10-04 05:24:44 +02:00
parent 1aaae62088
commit 110c75d712
10 changed files with 114 additions and 7 deletions
@@ -43,7 +43,10 @@ public final class HorizonLab implements ModInitializer {
public static synchronized boolean startTicks(String label, int seconds, Path output, String profile) {
if (ticks != null) return false;
ticks = new Recording(label, "ticks", output, seconds, Map.of("profile", profile, "minecraft", "26.3"));
Map<String, Object> context = dev.horizonlab.metrics.SoftwareContext.capture();
context.put("profile", profile);
context.put("minecraft", "26.3");
ticks = new Recording(label, "ticks", output, seconds, context);
return true;
}
@@ -107,9 +107,7 @@ public final class HorizonClient implements ClientModInitializer {
context.put("gpu", device.name());
context.put("graphics_backend", device.backendName());
context.put("graphics_driver", device.driverInfo());
context.put("mods", FabricLoader.getInstance().getAllMods().stream()
.map(mod -> mod.getMetadata().getId() + "@" + mod.getMetadata().getVersion().getFriendlyString())
.sorted().toList());
context.putAll(dev.horizonlab.metrics.SoftwareContext.capture());
frames = new Recording(label, "frames", output, seconds, context);
previousStart = 0;
if (client.getSingleplayerServer() != null) HorizonLab.startTicks(label, seconds, output, profile);
@@ -0,0 +1,21 @@
package dev.horizonlab.metrics;
import java.util.LinkedHashMap;
import java.util.Map;
import net.fabricmc.loader.api.FabricLoader;
/** Software identity captured once before a client or server recording starts. */
public final class SoftwareContext {
private SoftwareContext() {}
public static Map<String, Object> capture() {
Map<String, Object> context = new LinkedHashMap<>();
context.put("java_vendor", System.getProperty("java.vendor"));
context.put("java_vm_name", System.getProperty("java.vm.name"));
context.put("java_runtime_version", System.getProperty("java.runtime.version"));
context.put("mods", FabricLoader.getInstance().getAllMods().stream()
.map(mod -> mod.getMetadata().getId() + "@" + mod.getMetadata().getVersion().getFriendlyString())
.sorted().toList());
return context;
}
}
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "horizonlab",
"version": "0.16.0",
"version": "0.17.0",
"name": "Horizon Lab",
"description": "Client frame pacing and server tick measurements for reproducible optimization experiments.",
"authors": [