mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 17:29:57 -04:00
Write the end of the run to the log file past its 64 MiB cap, up to a 4 MiB reserve counted on its own.
main.c log_sink wrote nothing to the file once g_log_bytes passed LOG_CAP: every later line, the exit summary, "frametime: exit", the stutter map's exit lines and FATAL and crash lines included, went to stderr only, which a game started from the launcher or Explorer does not keep. A trace = perf session reaches the cap in about 90 minutes (the fresh 0.10.0 log grew 12 KB/s), and the play-test asks for an hour or more of exactly that. A reserve compared against g_log_bytes would not help: that counter adds every line, dropped ones too, so 4 MiB of dropped lines (under 6 minutes at that rate) would use it up before the end came. The new rt_log_ending marks the process as ending; rt_exit_begin (the orderly ends) and perf_summary_flush (the frame-time summary, also on the cheats rebuild exit) call it, and rt_log_sync (a fatal error, the crash report) counts as ending too. The exit summary and the stutter map are written before rt_log_sync, so keying on g_log_final alone would have missed them. While ending, a line past the cap goes to the file through g_log_tail, a counter of the bytes written past the cap, up to LOG_END_RESERVE (4 MiB), after one line saying the end of the run follows. The cut line says the end will still come. The file can end 4 MiB past the cap. perf_summary_flush now calls rt_log_ending before ft_stop, so tests/exit_order_check.py's static check of it wants ft_stop before ft_report rather than first. The check also prints one closing line for the static checks and the program together: the program's own "ok" line had hidden a failing static check. Not reproduced before the change (no log here reached the cap). The new tests/log_cap_check.py builds log_sink with a 4 KiB cap and a 2 KiB reserve: past the cap ordinary lines are dropped with one cut line, and after rt_log_ending or rt_log_sync the end's lines fill the reserve after one "end follows" line, however much was dropped before. exit_order_check (rt_exit_begin marks the end once; exit code 0 at this commit), logq_check and the compile checks pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,7 @@ void rt_vlogf(const char *fmt, va_list ap);
|
||||
void rt_log_raw(const char *p, size_t n);
|
||||
const char *rt_log_path(void); // the log file, NULL when this run writes none
|
||||
void rt_log_sync(void); // writes the queued log lines now; later lines are written as they are made
|
||||
void rt_log_ending(void); // the process is ending: its lines reach the log file past its 64 MiB cap
|
||||
enum { RT_TRACE_SVC = 1, RT_TRACE_HOSTCALL = 2, RT_TRACE_IPC = 4, RT_TRACE_FS = 8, RT_TRACE_GFX = 16, RT_TRACE_PERF = 32,
|
||||
RT_TRACE_SCHED = 64, RT_TRACE_AUDIO = 128, RT_TRACE_PRESENT = 256 };
|
||||
extern unsigned rt_trace; // from NX2NAVI_TRACE=svc,host,ipc,fs,gfx,perf,sched,audio,present (or all)
|
||||
|
||||
Reference in New Issue
Block a user