Files
d2r-mobile/dm/host/dm_prof.h
afad65c895 Rift density halved, audio-gap and volume-key fixes, Mac and renderer fixes
- Rift: monster density and elite group counts are about half of before (to
  hold 60 fps), and the progress needed to clear a Rift is halved to match.
  Invading bosses only spawn where the player can walk.
- iPhone: after pressing a volume button the picture could freeze (looked like
  a black screen or a crash). If the display callback stops for more than
  0.5 s while the game is active, the app now presents frames itself and
  switches back to the display callback afterwards.
- Audio: the buffer-release notifier thread runs at user-interactive QoS, to
  reduce gaps while moving (from @dormonbear's PR #52).
- Diagnostics: minimap state, level-change requests and the level after
  object interactions are logged, to investigate #47 and #49 (from
  @hubeiqiao's PR #51).
- New setting "Custom > 3D Quality": smoothness first (default; lowers the 3D
  render scale when frames keep dropping and raises it again once stable) or
  quality first.
- Mac: when the window is fully covered by another window, frames are not
  presented (no false stall warning); the game keeps running.
- Fixes: switching gamepad / touch layout while the belt auto-refill runs no
  longer crashes; dragging the Horadric Cube onto the stash no longer locks the
  panel; the bottom bar stays visible while an NPC dialogue menu is open.
- Host: top-level panels are looked up among the direct children of the UI
  root instead of a full-tree search every frame.

Co-authored-by: dormonbear <8454341+dormonbear@users.noreply.github.com>
Co-authored-by: hubeiqiao <12777592+hubeiqiao@users.noreply.github.com>
2026-10-15 17:12:20 +08:00

14 lines
1.6 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 宿主每帧模块的指令数读数(测试开关 DM_PUMP_PROF=1):每个模块前后各读一次本线程累计执行的指令数(thread_selfcounts,libsystem_kernel 导出、
// Apple 性能工具在用;指令数不受线程被调到哪种核影响,同样的活就是同样的数),按模块累计,每 600 次 dm_ipf_frame 打一行排行。
// 不开开关时每处只多一次已缓存的判断。只在游戏主线程(取手柄处)和服务端拍里用,两处各自一张表、不加锁。
// Per-frame instruction counts of host modules (test switch DM_PUMP_PROF=1): reads this thread's accumulated executed-instruction count before and after each module (thread_selfcounts, exported by libsystem_kernel,
// used by Apple's performance tools; the instruction count does not depend on which kind of core the thread was scheduled on, so the same work gives the same number), accumulates per module, and prints one ranking line every 600 dm_ipf_frame calls.
// With the switch off, each site costs only one cached check. Used only on the game main thread (where the gamepad is read) and in the server tick, each with its own table and no lock.
#pragma once
#include <stdint.h>
int dm_ipf_on(void);
uint64_t dm_ipf_instr(void);
void dm_ipf_add(int table, const char *name, uint64_t instr);
void dm_ipf_frame(int table); // table 0 = 主线程每帧(取手柄处),1 = 服务端每拍 | table 0 = main thread per frame (where the gamepad is read), 1 = server per tick
#define DM_PROF(table, name, stmt) do { if (dm_ipf_on()) { uint64_t _p0 = dm_ipf_instr(); stmt; dm_ipf_add(table, name, dm_ipf_instr() - _p0); } else { stmt; } } while (0)