Commit Graph
108 Commits
Author SHA1 Message Date
Xiao-no-love 3fbc956a62 fix(ticket): guard DistanceManager ticket iteration with DR shared lock
问题:TicketScanService.visitTicketChunks 无锁遍历 DistanceManager.tickets
(Long2ObjectOpenHashMap,非线程安全)。DR 维度线程在 tick 中并发增删 ticket,
与主线程遍历冲突 -> fastutil fail-fast 迭代器 NPE(实测崩溃:
Long2ObjectOpenHashMap$MapIterator.nextEntry "this.wrapped is null")。

修法:新增 CrossModLocks 反射获取 DR 的共享锁
(dev.modzuozhi.core.compat.DistanceManagerLock.LOCK),遍历时持锁并在锁内
快照 entry 到局部 List,锁外再执行 visitor。DR 未加载则锁为 null,退化为
原无锁行为(向后兼容)。

- 新增 CrossModLocks(反射 + 缓存)
- TicketScanService 遍历加锁 + 快照
2026-10-13 17:02:08 +08:00
Xiao-no-love ed609f65d8 fix(sampling): make PerfWorkTracker scope per-thread to stop subtask AIOOBE
问题:DR 细粒度并行(fine=on)下,多个 dimensionalripper_subtask_* 线程
并发 enter/exit,因未显式 enterScope 而全部 fallback 到共享的 MAIN_SCOPE,
竞争 depth++/-- 导致 slots[-1]/-2/32 越界(实测崩服)。

修法(治本):CURRENT_SCOPE 改用 ThreadLocal.withInitial,每线程首次访问
自动获得一份线程私有 Scope,永不返回 null、永不共享。exitScope 从 remove
改为 set(new Scope(null)),保持线程私有语义。

- currentScope() 去掉 null->MAIN_SCOPE fallback
- 线程私有 scope 不注册 ACTIVE_SCOPES(subtask 非独立 tick 轴)
- 热路径 enter*/exit/claimSlot 字节码仍零分配(NEW 在 withInitial 工厂里)
- 全量测试 + PerfWorkTrackerAllocationTest 通过

实测背景:fine=on 时 PerfWorkTracker$Scope.claimSlot 越界崩溃。
2026-10-13 16:49:30 +08:00
Xiao-no-love 2d4136ca28 feat(perf): sample across all active scopes (round-robin)
- PerfSamplerSession.sampleActiveScope: 从「读当前线程单一作用域」改为遍历所有活跃作用域
- round-robin 游标,多个并发作用域(主线程 + DR 各维度)被均匀采样
- 保持「1 次采样 = 1 个样本」语义,不破坏 sampleAttempts 统计
- DR 未注册维度作用域时,行为与改造前等价(只有主作用域)

配合 PerfWorkTracker 的 Scope 化,采样端现在能看到全部并发 tick 轴。
2026-10-13 15:24:54 +08:00
Xiao-no-love 9b71e57083 refactor(perf): make PerfWorkTracker scope-based for DR multi-dimension ticking
- 把 static SLOTS[32]+depth+current 封装进 Scope(绑采样作用域,不绑线程)
- ThreadLocal<Scope> CURRENT_SCOPE 让每个线程指向自己的作用域
- 新增 enterScope/exitScope/unregisterScope/activeScopes 供多维度轴使用
- 热路径 enter*/exit 只做 ThreadLocal.get() + 字段读写,保持零分配
- 保留 claimSlot(Scope) 转发方法以兼容 PerfWorkTrackerAllocationTest
- 未 activate/enterScope 的线程 fallback 到预创建 MAIN_SCOPE,永不 NPE/越界

根因:DR 让多维度线程并发 enter/exit 竞争 static depth++/--,导致 SLOTS[负] 越界。
本改动后每个作用域独立栈,消除竞态。PerfWorkTrackerAllocationTest 通过。
2026-10-13 15:20:29 +08:00
MoePus 863d17f493 bump version to 2.1.1.4 2026-10-09 21:26:44 +09:00
MoePus ff9c1ae9d3 Fix loader target indexing and ticket lifecycle cleanup 2026-10-07 21:33:40 +09:00
MoePus 54593167d6 Guard client config reads until config is loaded 2026-10-02 00:27:00 +09:00
MoePus 681c6ed99b Bump version to 2.1.1.3 2026-10-02 00:16:48 +09:00
MoePus c938534a94 bump version to 2.1.1.2 2026-09-15 22:53:53 +09:00
MoePus a543ddc56c Simplify perf sampling and ticket owner layers
- sampling: 删除 SamplingPlatform / SampleMetricMode,采样入口直接使用 JfrAsyncStackSampler,
  JFR 不可用改为在采样器内降级;SampleMetricContext / SampleStatistics 去掉 DIRECT_INTERVAL 分支;
  TickSamples 去掉 metricMode 维度;PerfWorkTracker 去掉 Task 发布路径与 TickTaskAccessor。
- ticket/owner: 删除 owner 缓存、TicketPauseService、OwnerChunks 的统计与双视图收集。
- 客户端状态:ClientPerfReportState / ClientPerfReportStore 合并进 ClientPerfMapState。
- 测试:新增 testsupport fixture 与 gametest 混入探针,替换旧探针与 PerfWorkTrackerTest。
- 构建:移除 JEI、Xaero Minimap、curios 依赖声明。
2026-09-15 22:51:43 +09:00
MoePus 8f4b409379 Bump version to 2.1.1.1 2026-09-03 20:11:21 +09:00
MoePus 76a4756424 Keep block entity tracker scopes server-side 2026-09-03 20:09:16 +09:00
MoePus e08a8e3e96 Fix object MSPT and rolling MAX metrics 2026-09-03 16:32:49 +09:00
MoePus ddb5a94c4d Refine performance detail attribution 2026-09-03 12:18:49 +09:00
MoePus 85820e1d00 Fix Unknown stack detail attribution 2026-09-02 23:34:06 +09:00
MoePus 08b8eb1962 Fix block entity tracker scope pairing 2026-09-02 22:08:26 +09:00
MoePus 53cd7e6cd2 Rework performance sampling with stackless primary timer 2026-09-02 19:50:26 +09:00
MoePus 5a4c4d914b Reduce world overlay render overhead 2026-09-02 15:12:08 +09:00
MoePus 598bb95ff9 Make world overlay marker limits configurable 2026-09-02 15:11:18 +09:00
MoePus da6a2bae00 Avoid idle performance report materialization 2026-09-02 15:06:55 +09:00
MoePus 744c2a3339 chore: bump version to 2.1.0.1 2026-09-01 22:21:23 +09:00
MoePus a9e39186c5 feat(client): copy representative Unknown stacks on demand 2026-09-01 22:17:17 +09:00
MoePus c74859bff8 feat(network): serve Unknown stack details on demand 2026-09-01 22:16:41 +09:00
MoePus fcbbc1cdc6 feat(perf): retain and cluster fallback Unknown stacks 2026-09-01 22:16:14 +09:00
MoePus 8c93815c60 chore: bump version to 2.1.0.1 2026-09-01 22:09:14 +09:00
MoePus 15029103c7 docs: expand the feature and configuration guide 2026-09-01 22:08:59 +09:00
MoePus 67a81cb274 refactor(client): model performance report row capabilities 2026-09-01 22:08:31 +09:00
MoePus 80abcafafc fix(perf): measure fallback Unknown samples directly 2026-09-01 22:08:11 +09:00
MoePus 6597a789fc feat(client): make the world overlay optional 2026-09-01 22:07:44 +09:00
MoePus 3695559578 feat(config): make server safeguards configurable 2026-09-01 22:07:16 +09:00
MoePus b2aec4465c fix(client): fade chunk beacons by horizontal distance 2026-08-30 11:20:13 +09:00
MoePus b0f5e03c4f fix(network): unify performance access in singleplayer 2026-08-30 11:19:40 +09:00
MoePus 56d00786f7 fix(client): let flame severity follow average load 2026-08-29 23:02:15 +09:00
MoePus bf353ede62 Bump version to 2.1.0.0 2026-08-29 17:06:31 +09:00
MoePus d621322018 fix(perf): normalize entity hotspot lifetimes 2026-08-29 16:01:31 +09:00
MoePus fcd53a9668 feat(client): add GPU world performance overlay 2026-08-29 16:00:27 +09:00
MoePus d0cafbcc82 feat(map): add live spatial performance overlays 2026-08-29 15:56:22 +09:00
MoePus f55573fc8a feat(network): stream spatial performance snapshots 2026-08-29 15:55:29 +09:00
MoePus 17c437127f feat(perf): publish bounded object hotspots 2026-08-29 15:48:47 +09:00
MoePus bf4c04d6e3 fix: relax MixinLite version range 2026-08-24 10:32:29 +09:00
MoePus b8b0c8b94a perf: reuse C2ME ticket attribution 2026-08-19 19:56:07 +09:00
MoePus 937c7f2edb fix(perf): avoid periodic attribution stalls 2026-08-19 19:21:26 +09:00
MoePus d886b1370b Include Minecraft version in artifact names 2026-08-18 22:21:54 +09:00
MoePus 52db9920b3 Allow deleting entities from strong load chunk 2026-08-18 17:42:12 +09:00
MoePus da5293c880 bump version to 2.0.4 2026-08-18 14:52:58 +09:00
MoePus 7db7fe575b fix(perf): expose gc as a tickable row 2026-08-18 14:36:24 +09:00
MoePus a31f8c486f fix(perf): refine idle and gc attribution 2026-08-18 14:20:53 +09:00
MoePus ed41c6134b test(perf): cover stack attribution runtime 2026-08-18 13:51:14 +09:00
MoePus f8932a0ba4 feat(client): show profiler handler details 2026-08-18 13:50:46 +09:00
MoePus 03bf028855 feat(perf): add stack fallback sampling 2026-08-18 13:50:28 +09:00